Skip to content

improvements

improvements #131

Workflow file for this run

name: Docker image release
on:
push:
tags:
- "v*.*.*"
- "v*.*.*-test"
env:
REGISTRY_IMAGE: holisticon/bpm-ai-connectors-camunda-8
jobs:
build-jvm:
strategy:
matrix:
include:
- runner: ubuntu-latest
arch: amd64
- runner: buildjet-8vcpu-ubuntu-2204-arm
arch: arm64
runs-on: ${{ matrix.runner }}
defaults:
run:
working-directory: ./feel-engine-wrapper
steps:
-
name: Checkout code
uses: actions/checkout@v4
-
name: Setup GraalVM JDK 21
uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
-
name: Cache local Maven repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ matrix.runner }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ matrix.runner }}-maven-
-
name: Install upx for executable compression
run: |
wget -O upx.tar.xz "https://github.com/upx/upx/releases/download/v4.2.2/upx-4.2.2-${{ matrix.arch }}_linux.tar.xz"
sudo tar -xvf upx.tar.xz -C /usr/local/bin/ upx-4.2.2-${{ matrix.arch }}_linux/upx --strip-components=1
-
name: Prepare Maven Wrapper
run: chmod +x ./mvnw
-
name: Build native executable with Maven
run: ./mvnw package -Dnative-compress
-
name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: feel-engine-wrapper-${{ matrix.arch }}-runner
path: feel-engine-wrapper/target/feel-engine-wrapper-runner # action does not respect working-directory...
if-no-files-found: error
build-python:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./bpm-ai-connectors-c8
steps:
-
name: Checkout code
uses: actions/checkout@v4
-
run: sudo apt-get install -y tesseract-ocr poppler-utils
-
name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
-
name: Set up poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: "1.6.1"
-
name: Create local environment in project for caching
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
-
uses: actions/cache@v3
name: Set up cache based on dependencies lock file
with:
path: ./bpm-ai-connectors-c8/.venv
key: venv-${{ hashFiles('**/poetry.lock') }}
-
name: Install dependencies
run: poetry install --only main
-
name: Build
run: poetry build
-
name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: bpm-ai-connectors-c8
path: bpm-ai-connectors-c8/dist/ # action does not respect working-directory...
if-no-files-found: error
build-push:
needs: [build-jvm]
strategy:
matrix:
include:
- arch: amd64
- arch: arm64
runs-on: ubuntu-latest
outputs:
image: ${{ steps.image.outputs.image }}
steps:
-
name: Checkout code
uses: actions/checkout@v4
-
uses: actions/download-artifact@v4
with:
name: feel-engine-wrapper-${{ matrix.arch }}-runner
path: feel-engine-wrapper/target
-
name: Set up QEMU
uses: docker/setup-qemu-action@v3
-
run: docker context create builders
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
endpoint: builders
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Get the version
id: vars
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10})
-
name: Build and push
uses: docker/build-push-action@v5
with:
platforms: linux/${{ matrix.arch }}
provenance: false # otherwise a manifest list is created and create-push-manifest job fails
context: .
file: ./Dockerfile.prebuilt
push: true
tags: |
${{ env.REGISTRY_IMAGE }}:${{ steps.vars.outputs.tag }}-${{ matrix.arch }}
${{ env.REGISTRY_IMAGE }}:latest-${{ matrix.arch }}
-
id: image
run: echo "::set-output name=image::$(echo ${{ env.REGISTRY_IMAGE }}:latest)"
build-push-inference:
needs: [ build-jvm ]
strategy:
matrix:
include:
- arch: amd64
- arch: arm64
runs-on: ubuntu-latest
outputs:
image: ${{ steps.image.outputs.image }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: feel-engine-wrapper-${{ matrix.arch }}-runner
path: feel-engine-wrapper/target
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- run: docker context create builders
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: latest
endpoint: builders
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Get the version
id: vars
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10})
- name: Build and push
uses: docker/build-push-action@v5
with:
platforms: linux/${{ matrix.arch }}
provenance: false # otherwise a manifest list is created and create-push-manifest job fails
context: .
file: ./Dockerfile.prebuilt
build-args: |
FLAVOR=inference
PYTHON_VERSION=3.11
push: true
tags: |
${{ env.REGISTRY_IMAGE }}:${{ steps.vars.outputs.tag }}-inference-${{ matrix.arch }}
${{ env.REGISTRY_IMAGE }}:latest-inference-${{ matrix.arch }}
- id: image
run: echo "::set-output name=image::$(echo ${{ env.REGISTRY_IMAGE }}:latest-inference)"
pytest-docker:
needs: [build-push]
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./bpm-ai-connectors-c8/tests
steps:
-
name: Checkout code
uses: actions/checkout@v4
-
name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
-
name: Set up poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: "1.6.1"
-
name: Create local environment in project for caching
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
-
uses: actions/cache@v3
name: Set up cache based on dependencies lock file
with:
path: ./bpm-ai-connectors-c8/.venv
key: venv-${{ hashFiles('**/poetry.lock') }}
-
name: Install dependencies
run: poetry install --only test --no-root --no-cache
-
name: Run pytest
run: ZEEBE_TEST_IMAGE_TAG=8.4.0 CONNECTOR_IMAGE=${{ needs.build-push.outputs.image }}-amd64 OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} poetry run pytest
pytest-docker-inference:
needs: [ build-push-inference ]
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./bpm-ai-connectors-c8/tests
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Set up poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: "1.6.1"
- name: Create local environment in project for caching
run: |
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local
- uses: actions/cache@v3
name: Set up cache based on dependencies lock file
with:
path: ./bpm-ai-connectors-c8/.venv
key: venv-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: poetry install --only test --no-root --no-cache
- name: Run pytest
run: ZEEBE_TEST_IMAGE_TAG=8.4.0 CONNECTOR_IMAGE=${{ needs.build-push-inference.outputs.image }}-amd64 OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} poetry run pytest
create-push-manifest:
runs-on: ubuntu-latest
needs: [build-push, pytest-docker]
steps:
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Get version
id: vars
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10})
-
name: Create version-manifest and push
run: |
docker manifest create \
${{ env.REGISTRY_IMAGE }}:${{ steps.vars.outputs.tag }} \
--amend ${{ env.REGISTRY_IMAGE }}:${{ steps.vars.outputs.tag }}-amd64 \
--amend ${{ env.REGISTRY_IMAGE }}:${{ steps.vars.outputs.tag }}-arm64
docker manifest push ${{ env.REGISTRY_IMAGE }}:${{ steps.vars.outputs.tag }}
-
name: Create latest-manifest and push
run: |
docker manifest create \
${{ env.REGISTRY_IMAGE }}:latest \
--amend ${{ env.REGISTRY_IMAGE }}:latest-amd64 \
--amend ${{ env.REGISTRY_IMAGE }}:latest-arm64
docker manifest push ${{ env.REGISTRY_IMAGE }}:latest
create-push-manifest-inference:
runs-on: ubuntu-latest
needs: [build-push-inference, pytest-docker-inference]
steps:
-
name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
-
name: Get version
id: vars
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10})
-
name: Create version-manifest and push
run: |
docker manifest create \
${{ env.REGISTRY_IMAGE }}:${{ steps.vars.outputs.tag }}-inference \
--amend ${{ env.REGISTRY_IMAGE }}:${{ steps.vars.outputs.tag }}-inference-amd64 \
--amend ${{ env.REGISTRY_IMAGE }}:${{ steps.vars.outputs.tag }}-inference-arm64
docker manifest push ${{ env.REGISTRY_IMAGE }}:${{ steps.vars.outputs.tag }}-inference
-
name: Create latest-manifest and push
run: |
docker manifest create \
${{ env.REGISTRY_IMAGE }}:latest-inference \
--amend ${{ env.REGISTRY_IMAGE }}:latest-inference-amd64 \
--amend ${{ env.REGISTRY_IMAGE }}:latest-inference-arm64
docker manifest push ${{ env.REGISTRY_IMAGE }}:latest-inference