Skip to content

Add Keycloak 26

Add Keycloak 26 #669

name: CI
on:
push:
branches:
- main
- 0.0.x
paths-ignore:
- "README.md"
- ".github/ISSUE_TEMPLATE/*.md"
pull_request:
branches:
- main
- 0.0.x
jobs:
build-maven:
name: Build Maven
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.version.outputs.version }}
tag: ${{ steps.tag.outputs.tag }}
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: "temurin" # See 'Supported distributions' for available options
java-version: "17"
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: New version
id: version
run: |
filter=$( awk -F '[.]' '{printf "v"$1"."$2".*"}' <<< $( yq -p xml '.project.version' pom.xml ) )
tag=$(git tag -l $filter --sort=-creatordate | head -1)
new_tag=$( cut -c2- <<< "$( awk -F '[.]' '{printf $1"."$2"."}' <<< $tag)$[$( awk -F '[.]' '{printf $3}' <<< $tag)+1]" )
echo "version=$new_tag" >> $GITHUB_OUTPUT
- name: New tag
id: tag
run: |
if [[ ${{ github.event_name }} == 'push' ]]; then
export TAG=$NEW_VERSION
export RELEASE="true"
else
export TAG=pr-${{ github.event.pull_request.number }}
export RELEASE="false"
fi
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "release=$RELEASE" >> $GITHUB_OUTPUT
env:
NEW_VERSION: ${{ steps.version.outputs.version }}
- name: MVN set version
run: |
if [[ ${{ github.event_name }} == 'push' ]]; then
mvn versions:set -DnewVersion=$NEW_VERSION
else
mvn versions:set -DnewVersion=$NEW_VERSION-PR-${{ github.event.pull_request.number }}-SNAPSHOT
fi
env:
NEW_VERSION: ${{ steps.version.outputs.version }}
- name: test and build JAR
run: mvn package -ntp -Drepo.login=${{ github.actor }} -Drepo.pwd=${{ secrets.GH_TOKEN }} -s .m2/settings.xml -Dmaven.test.skip
- name: Upload new versions in maven registry
run: |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
mvn deploy -ntp -Drepo.login=${{ github.actor }} -Drepo.pwd=${{ secrets.GH_TOKEN }} -s .m2/settings.xml -DskipTests
fi
- name: Build and push Docker image camunda-formio-react-app
uses: softcannery/.github/actions/github-docker-registry@master
with:
chart-path: ./camunda-formio-react-app
git-username: ${{ github.actor }}
git-token: ${{ secrets.GH_TOKEN }}
image-name: camunda-formio-react-app
version: ${{ steps.tag.outputs.tag }}
release: ${{ steps.tag.outputs.release }}
- name: Build and push Docker image camunda-formio-example
uses: softcannery/.github/actions/github-docker-registry@master
with:
chart-path: ./camunda-formio-example
git-username: ${{ github.actor }}
git-token: ${{ secrets.GH_TOKEN }}
image-name: camunda-formio-example
version: ${{ steps.tag.outputs.tag }}
release: ${{ steps.tag.outputs.release }}
- name: Build and push Docker image camunda-formio-content
uses: softcannery/.github/actions/github-docker-registry@master
with:
chart-path: ./camunda-formio-content
git-username: ${{ github.actor }}
git-token: ${{ secrets.GH_TOKEN }}
image-name: camunda-formio-content
version: ${{ steps.tag.outputs.tag }}
release: ${{ steps.tag.outputs.release }}
build-plugin:
name: Build Camunda Modeler Plugin
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
- name: build plugin
run: |
cd ./camunda-modeler-formio-plugin
chmod +x ./install.sh
export MODELER_DIR=$(pwd)
npm install -f
npm run build
cd ${MODELER_DIR}/resources/plugins/formio-plugin
zip -r -l ~/formio-plugin.zip ./
env:
NODE_OPTIONS: "--openssl-legacy-provider"
- name: Upload build results
uses: actions/upload-artifact@v4
with:
name: plugin
path: ~/formio-plugin.zip
retention-days: 1
build-deployment-plugin:
name: Build Camunda Modeler Deployment Plugin
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 18
- name: build plugin
run: |
cd ./camunda-modeler-deployment-plugin
chmod +x ./install.sh
export MODELER_DIR=$(pwd)
npm install -f
npm run build
cd ${MODELER_DIR}/resources/plugins/deploy-plugin
zip -r -l ~/deploy-plugin.zip ./
env:
NODE_OPTIONS: "--openssl-legacy-provider"
- name: Upload build results
uses: actions/upload-artifact@v4
with:
name: deploy-plugin
path: ~/deploy-plugin.zip
retention-days: 1
run-modeler-tests:
name: Run modeler tests
needs:
- build-plugin
- build-deployment-plugin
- build-maven
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
- uses: actions/download-artifact@v4
with:
name: plugin
path: ./
- uses: actions/download-artifact@v4
with:
name: deploy-plugin
path: ./
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_TOKEN }}
- name: run services
env:
CR_PAT: ${{ secrets.GH_TOKEN }}
run: |
sed -i -e "s/IMAGE_TAG=.*/IMAGE_TAG=${{ needs.build-maven.outputs.tag }}/" ./.env
docker compose pull
docker compose -f "docker-compose.yml" up -d --no-build
- name: install modeller
run: |
wget https://downloads.camunda.cloud/release/camunda-modeler/5.30.0/camunda-modeler-5.30.0-linux-x64.tar.gz
tar -xvf camunda-modeler*.tar.gz
mkdir -p ~/.config/camunda-modeler/plugins
unzip formio-plugin.zip -d ~/.config/camunda-modeler/plugins/formio-plugin
unzip deploy-plugin.zip -d ~/.config/camunda-modeler/plugins/deploy-plugin
cd ./cucumber-tests
chmod +x ./healthcheck.sh
./healthcheck.sh
- name: Run Camunda Modeler test
uses: coactions/setup-xvfb@v1.0.1
with:
run: mvn clean verify -ntp -Dcucumber.filter.tags="@modeler"
working-directory: ./cucumber-tests
run-tests:
name: Run Tests
needs: [ build-maven ]
runs-on: ubuntu-22.04
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "temurin" # See 'Supported distributions' for available options
java-version: "17"
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GH_TOKEN }}
- name: run services
env:
CR_PAT: ${{ secrets.GH_TOKEN }}
run: |
curr_ip=$( ip addr show | grep -A3 eth0 | grep "inet " | awk '/inet /{print $2}' | cut -d'/' -f1 )
ip addr show
echo "Current IP: $curr_ip"
sed -i -e "s/OAUTH2_SSO_HOST=.*/OAUTH2_SSO_HOST=$curr_ip/" ./.env
sed -i -e "s/IMAGE_TAG=.*/IMAGE_TAG=${{ needs.build-maven.outputs.tag }}/" ./.env
docker compose pull
docker compose -f "docker-compose.yml" up -d --no-build
- name: run cucumber tests
run: |
cd ./cucumber-tests
chmod +x ./healthcheck.sh
./healthcheck.sh
mvn clean verify -ntp -Dcucumber.filter.tags="@web"
- name: save test report
if: always()
run: |
cd ./cucumber-tests/target/site/serenity
zip -r -l ~/report.zip ./
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-report
path: ~/report.zip
release:
name: Publish Release
if: github.event_name == 'push'
needs:
- build-maven
- build-plugin
- build-deployment-plugin
- run-modeler-tests
- run-tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
distribution: "temurin" # See 'Supported distributions' for available options
java-version: "17"
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- uses: actions/download-artifact@v4
with:
name: plugin
path: ./
- uses: actions/download-artifact@v4
with:
name: deploy-plugin
path: ./
- name: MVN set version
run: |
mvn versions:set -DnewVersion=$NEW_VERSION
sed -i "s/^IMAGE_TAG=.*/IMAGE_TAG=${NEW_VERSION}/" .env
env:
NEW_VERSION: ${{ needs.build-maven.outputs.version }}
- name: Create Release Tag
uses: softcannery/.github/actions/release-tag@master
with:
git-token: ${{ secrets.GH_TOKEN }}
version: v${{ needs.build-maven.outputs.version }}
- name: test and build JAR
run: mvn package -ntp -Drepo.login=${{ github.actor }} -Drepo.pwd=${{ secrets.GH_TOKEN }} -s .m2/settings.xml -Dmaven.test.skip
- name: Upload new versions in maven registry
run: |
mvn deploy -ntp -Drepo.login=${{ github.actor }} -Drepo.pwd=${{ secrets.GH_TOKEN }} -s .m2/settings.xml -DskipTests
- name: Release it
run: |
export PREV_VERSION=$(gh release list | grep Latest | awk '{print $3}')
gh release create v$NEW_VERSION --title v$NEW_VERSION --notes-start-tag $PREV_VERSION --generate-notes --latest ./formio-plugin.zip ./deploy-plugin.zip
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NEW_VERSION: ${{ needs.build-maven.outputs.version }}