-
Notifications
You must be signed in to change notification settings - Fork 2
223 lines (216 loc) · 6.56 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
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@v3
-
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"
tar -xvf upx.tar.xz -C /usr/bin/ upx-4.2.2-${{ matrix.arch }}_linux/upx
-
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@v3
-
name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'
-
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
steps:
-
name: Checkout code
uses: actions/checkout@v3
-
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@v2
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 }}
context: .
file: ./Dockerfile.prebuilt
push: true
tags: |
${{ env.REGISTRY_IMAGE }}:${{ steps.vars.outputs.tag }}-${{ matrix.arch }}
${{ env.REGISTRY_IMAGE }}:latest-${{ matrix.arch }}
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.12
uses: actions/setup-python@v4
with:
python-version: '3.12'
-
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 OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} TEST_RUNTIME=docker 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@v2
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