Skip to content

CI TASKANA adapter #1887

CI TASKANA adapter

CI TASKANA adapter #1887

name: CI TASKANA adapter
on:
workflow_dispatch:
push:
branches-ignore:
- dependabot/**
tags:
- '[0-9]+\.[0-9]+\.[0-9]+/[0-9]+\.[0-9]+\.[0-9]+'
pull_request:
branches:
- master
schedule:
- cron: '0 3 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.repository }}/${{ github.ref }}
cancel-in-progress: true
env:
JAVA_VERSION: 17
CACHE_MAVEN_NAME: ma2aen
CACHE_SONAR_NAME: sonar
ARTIFACTS_JACOCO_REPORTS_NAME: jacoco-reports
ARTIFACTS_JACOCO_REPORTS_PATH: '**/jacoco.exec'
jobs:
compile_and_test:
name: Test
runs-on: ubuntu-20.04
steps:
- name: Git checkout
uses: actions/checkout@v4
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: ${{ env.JAVA_VERSION }}
- name: Cache maven dependencies
id: cache
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}
- name: Test
run: ./mvnw -B verify
- name: Upload JaCoCo Report
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACTS_JACOCO_REPORTS_NAME }}
path: ${{ env.ARTIFACTS_JACOCO_REPORTS_PATH }}
if-no-files-found: ignore
- name: Remove taskana artifacts from cache
run: rm -rf ~/.m2/repository/pro/taskana
release_artifacts:
runs-on: ubuntu-20.04
name: Release artifacts to OSS Sonatype
if: github.repository == 'Taskana/TaskanaAdapter' && ( startsWith(github.ref, 'refs/tags') || github.ref == 'refs/heads/master' ) && github.head_ref == ''
needs: [ compile_and_test ]
# as documented in the gpg manual (https://www.gnupg.org/documentation/manuals/gnupg/Invoking-GPG_002dAGENT.html)
# we should execute this command before interacting with gpg (otherwise gpg won't work)
env:
GPG_TTY: $(tty)
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # necessary for push back
# NOTE @v2 uses the token as an auth http header. Set it to
# a Personal Access Token instead of secrets.GITHUB_TOKEN
# so that tag pushes trigger repo push events.
# source: https://github.community/t/action-does-not-trigger-another-on-push-tag-action/17148/7
token: ${{ secrets.ADMIN_PERSONAL_ACCESS_TOKEN }}
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: ${{ env.JAVA_VERSION }}
- name: Cache maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}
- name: Import GPG Key
run: echo -n "$GPG_KEY" | base64 --decode | gpg --batch --import
env:
GPG_KEY: ${{ secrets.GPG_KEY }}
- name: Change versions to match tag
run: ci/change_version.sh -m .
- name: Release artifacts to OSS Sonatype
run: |
./mvnw -B deploy -P $([[ "$GITHUB_REF" =~ ^refs/tags/[0-9]+\.[0-9]+\.[0-9]+/[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo "release" || echo "snapshot") \
--settings ci/mvnsettings.xml -DskipTests -Dcheckstyle.skip -Djacoco.skip \
-pl :taskana-adapter-parent,\
:taskana-adapter,:taskana-adapter-camunda-system-connector,:taskana-adapter-taskana-connector,\
:taskana-adapter-camunda-listener,:taskana-adapter-camunda-outbox-rest,\
:taskana-adapter-camunda-outbox-rest-spring-boot-starter
env:
GPG_KEY_NAME: ${{ secrets.GPG_KEY_NAME }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
MAVEN_USERNAME: 44pdzWD8
MAVEN_PASSWORD: eJZ25rsRdH7ZiePJO52JUy7LyVkNIgXxXEBmnTNH3aOM
- name: Update version to next snapshot and push back
run: |
ci/change_version.sh -i -m .
ci/commitPoms.sh
env:
GH_EMAIL: ${{ secrets.GH_EMAIL }}
GH_USERNAME: ${{ secrets.GH_USERNAME }}
- name: Remove taskana artifacts from cache
run: rm -rf ~/.m2/repository/pro/taskana
- name: Cancel workflow
if: failure()
uses: andymckay/[email protected]
upload_to_sonar:
runs-on: ubuntu-20.04
name: Upload SonarQube analysis to sonarcloud
# no pull request and not on release
if: github.head_ref == '' && !startsWith(github.ref, 'refs/tags')
needs: [ compile_and_test ]
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
distribution: adopt
java-version: ${{ env.JAVA_VERSION }}
- name: Cache SonarCloud packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-${{ env.CACHE_SONAR_NAME }}
restore-keys: ${{ runner.os }}-${{ env.CACHE_SONAR_NAME }}
- name: Cache maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}
- name: Download JaCoCo reports
uses: actions/download-artifact@v4
with:
name: ${{ env.ARTIFACTS_JACOCO_REPORTS_NAME }}
- name: Install taskana adapter
run: ./mvnw -B install -DskipTests -Dcheckstyle.skip -Dmaven.javadoc.skip
- name: Upload SonarQube analysis
run: ./mvnw -B sonar:sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_PROJECT_KEY: ${{ secrets.SONAR_PROJECT_KEY }}
SONAR_ORGANIZATION: ${{ secrets.SONAR_ORGANIZATION }}
- name: Remove taskana artifacts from cache
run: rm -rf ~/.m2/repository/pro/taskana
- name: Cancel workflow
if: failure()
uses: andymckay/[email protected]