Skip to content

Commit

Permalink
ci: add GitHub actions and workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-sh committed Mar 6, 2024
1 parent cb1426a commit aa8d237
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Bug reports and questions on CAP CDS Language Support for IntelliJ
url: https://github.com/cap-js/cds-intellij/issues
about: Please ask questions here.
49 changes: 49 additions & 0 deletions .github/actions/gradle-run/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: gradle-run
description: Build the plugin using gradle

inputs:
steps:
description: 'The run steps to perform'
required: true

runs:
using: composite

steps:
- name: Install fontconfig
# required for headless gradle
run: |
apt-get -y update
apt-get -y install fontconfig
shell: bash
env:
DEBIAN_FRONTEND: noninteractive
TZ: Etc/UTC

- uses: actions/setup-node@v3
with:
node-version: 18

- uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 17

- name: Build
if: ${{ contains(inputs.steps, 'build') }}
shell: bash
run: |
./gradlew buildPlugin
ls -la build/distributions
- name: Test
if: ${{ contains(inputs.steps, 'test') }}
shell: bash
run: |
./gradlew test --info
- uses: actions/upload-artifact@v3
if: ${{ contains(inputs.steps, 'test') }}
with:
name: test-results
path: ./build/test-results/test
31 changes: 31 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Main

on:
push:
branches: [main]
workflow_dispatch:

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true

jobs:
main-build:
runs-on: ubuntu-latest
container:
image: ubuntu:22.04
steps:
- uses: actions/checkout@v3

- uses: ./.github/actions/gradle-run
with:
steps: |-
build
test
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: build results
path: build/distributions/intellij-cds.zip
retention-days: 5
31 changes: 31 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: PR

on:
pull_request:
paths:
- src/**
- lsp/**
- build.gradle
- gradle.properties
- local.properties
- .github/**
workflow_dispatch:

concurrency:
group: build-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
pr-build:
runs-on: ubuntu-latest
container:
image: ubuntu:22.04
env:
CI: true
steps:
- uses: actions/checkout@v3

- uses: ./.github/actions/gradle-run
with:
steps: |-
test
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release

on:
push:
branches: [release]
workflow_dispatch:

concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true

jobs:
release-build:
runs-on: ubuntu-latest
container:
image: ubuntu:22.04
steps:
- uses: actions/checkout@v3

- uses: ./.github/actions/gradle-run
with:
steps: |-
build
test
- id: setenv
run: |
echo RELEASE_TAG=$(awk '/pluginVersion/ { print $3 }' gradle.properties) >> $GITHUB_OUTPUT
echo "TODAY_DATE=$(date +%Y-%m-%d)" >> $GITHUB_OUTPUT
echo "CHANGE_LOG=$(awk '/<change-notes>/ { a=1; next } a==1 && /<ul>/ { a=2 } a==2 { gsub(/^[ \t]+/, ""); ORS=" "; print; if (/<\/ul>/) exit }' src/main/resources/META-INF/plugin.xml)" >> $GITHUB_OUTPUT
- run: |
echo "${{ steps.setenv.outputs.RELEASE_TAG }}"
echo "${{ steps.setenv.outputs.TODAY_DATE }}"
echo "${{ steps.setenv.outputs.CHANGE_LOG }}"
- uses: ncipollo/release-action@v1
with:
tag: ${{ steps.setenv.outputs.RELEASE_TAG }}
commit: main
token: ${{ secrets.GITHUB_TOKEN }}
draft: false
body: Build ${{ github.run_number }}<br>${{ steps.setenv.outputs.CHANGE_LOG }}
artifacts: build/distributions/intellij-cds.zip

0 comments on commit aa8d237

Please sign in to comment.