Skip to content

Commit 111da0e

Browse files
committed
feat: add new compatibility test workflow
1 parent 13eea8a commit 111da0e

File tree

2 files changed

+382
-0
lines changed

2 files changed

+382
-0
lines changed
Lines changed: 337 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,337 @@
1+
name: Integration Tests - Version Matrix
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
specific_version:
7+
description: 'Specific Camunda version to test (optional, e.g., 8.8.0 or 8.9.0-SNAPSHOT). Leave empty to test all discovered versions.'
8+
required: false
9+
type: string
10+
skip_cache:
11+
description: 'Skip version cache and retest all versions'
12+
required: false
13+
type: boolean
14+
default: false
15+
schedule:
16+
# Run daily at 2 AM UTC
17+
- cron: '0 2 * * *'
18+
push:
19+
branches:
20+
- nicpuppa/sdk-compatibility-workflow
21+
22+
jobs:
23+
discover-versions:
24+
runs-on: ubuntu-latest
25+
outputs:
26+
versions: ${{ steps.filter-versions.outputs.versions }}
27+
steps:
28+
- name: Checkout SDK repository
29+
uses: actions/checkout@v4
30+
31+
- name: Restore tested versions cache
32+
id: cache-tested
33+
uses: actions/cache/restore@v4
34+
with:
35+
path: .github/tested-versions.txt
36+
key: tested-versions-${{ github.run_id }}
37+
restore-keys: |
38+
tested-versions-
39+
40+
- name: Checkout camunda/camunda repository
41+
uses: actions/checkout@v4
42+
with:
43+
repository: camunda/camunda
44+
fetch-depth: 0 # Fetch all tags
45+
path: camunda-repo
46+
47+
- name: Get versions from tags and main pom
48+
id: get-versions
49+
working-directory: camunda-repo
50+
run: |
51+
# Get all tags, filter for versions >= 8.8.0, sort and get unique versions
52+
echo "Fetching git tags..."
53+
git fetch --tags
54+
55+
# Debug: show all tags
56+
echo "All tags in repository:"
57+
git tag -l | head -20
58+
59+
# Extract version tags (format: 8.x.y, exclude alpha/beta/rc)
60+
# Filter for versions >= 8.8.0, exclude alpha/beta/rc, sort and get unique versions
61+
echo "Filtering for version 8.8.0+"
62+
63+
# First, get all tags matching version pattern
64+
all_version_tags=$(git tag -l | grep -E '^8\.[0-9]+\.[0-9]+(-.*)?$')
65+
echo "Tags matching version pattern:"
66+
echo "$all_version_tags" | head -20
67+
68+
# Filter out alpha/beta/rc
69+
filtered_tags=$(echo "$all_version_tags" | grep -v -E '-(alpha|beta|rc)')
70+
echo "After filtering alpha/beta/rc:"
71+
echo "$filtered_tags" | head -20
72+
73+
# Filter for >= 8.8.0
74+
versions=$(echo "$filtered_tags" | \
75+
awk -F'[-.]' '{
76+
major=$1; minor=$2; patch=$3;
77+
if (major == 8 && minor >= 8) {
78+
print $0
79+
}
80+
}' | sort -V -u)
81+
82+
echo "Found stable release versions from tags:"
83+
echo "$versions"
84+
85+
# Get current version from main branch pom.xml (this will be the SNAPSHOT version)
86+
echo "Fetching current SNAPSHOT version from main branch..."
87+
git checkout main
88+
current_version=$(grep -m 1 '<version>' pom.xml | sed 's/.*<version>\(.*\)<\/version>.*/\1/' | tr -d '[:space:]')
89+
echo "Current main version: $current_version"
90+
91+
# Combine stable releases from tags with SNAPSHOT from main
92+
all_versions=$(echo -e "$versions\n$current_version" | sort -V -u)
93+
94+
echo "All versions to test (stable releases + SNAPSHOT):"
95+
echo "$all_versions"
96+
97+
# Save all versions for filtering
98+
echo "$all_versions" > /tmp/all-versions.txt
99+
echo "All discovered versions:"
100+
cat /tmp/all-versions.txt
101+
102+
- name: Filter out already tested versions
103+
id: filter-versions
104+
run: |
105+
# Check if a specific version was requested
106+
if [ -n "${{ github.event.inputs.specific_version }}" ]; then
107+
echo "Testing specific version: ${{ github.event.inputs.specific_version }}"
108+
json_versions='["${{ github.event.inputs.specific_version }}"]'
109+
echo "versions=$json_versions" >> $GITHUB_OUTPUT
110+
echo "Skipping cache check for manual version override"
111+
exit 0
112+
fi
113+
114+
# Create tested versions file if it doesn't exist
115+
mkdir -p .github
116+
touch .github/tested-versions.txt
117+
118+
echo "Previously tested versions:"
119+
cat .github/tested-versions.txt || echo "None"
120+
121+
# Check if cache should be skipped
122+
if [ "${{ github.event.inputs.skip_cache }}" = "true" ]; then
123+
echo "Skipping cache - retesting all versions"
124+
new_versions=$(cat /tmp/all-versions.txt)
125+
elif [ -f ".github/tested-versions.txt" ]; then
126+
# Filter out already tested versions
127+
new_versions=$(comm -23 <(sort /tmp/all-versions.txt) <(sort .github/tested-versions.txt))
128+
else
129+
new_versions=$(cat /tmp/all-versions.txt)
130+
fi
131+
132+
if [ -z "$new_versions" ]; then
133+
echo "No new versions to test"
134+
echo "versions=[]" >> $GITHUB_OUTPUT
135+
else
136+
# Convert to JSON array for matrix strategy
137+
json_versions=$(echo "$new_versions" | jq -R -s -c 'split("\n") | map(select(length > 0))')
138+
echo "versions=$json_versions" >> $GITHUB_OUTPUT
139+
140+
echo "New versions to test:"
141+
echo "$json_versions" | jq '.'
142+
fi
143+
144+
integration-tests:
145+
needs: discover-versions
146+
if: ${{ needs.discover-versions.outputs.versions != '[]' }}
147+
runs-on: ubuntu-latest
148+
strategy:
149+
fail-fast: false
150+
matrix:
151+
version: ${{ fromJson(needs.discover-versions.outputs.versions) }}
152+
153+
steps:
154+
- name: Check out the SDK repo
155+
uses: actions/checkout@v4
156+
157+
- name: Use Node.js
158+
uses: actions/setup-node@v4
159+
with:
160+
node-version: "22"
161+
162+
- name: Install dependencies
163+
run: npm install
164+
165+
# Workaround for https://github.com/actions/runner-images/issues/2821
166+
- name: Remove mono blocking 8084 port
167+
run: sudo lsof -t -i:8084 | xargs -r sudo kill -9
168+
169+
- name: Set up Docker authentication
170+
run: |
171+
echo ${{ secrets.DOCKER_PASSWORD }} | docker login --username joshua.wulf --password-stdin registry.camunda.cloud
172+
173+
- name: Determine test command
174+
id: docker-config
175+
run: |
176+
version="${{ matrix.version }}"
177+
178+
# Extract major.minor version (e.g., 8.8 from 8.8.0 or 8.8.1-SNAPSHOT)
179+
major_minor=$(echo "$version" | grep -oE '^[0-9]+\.[0-9]+')
180+
181+
# Use matrix compose file with version variable
182+
echo "compose_file=docker/docker-compose-matrix.yaml" >> $GITHUB_OUTPUT
183+
184+
# Determine test command based on major.minor version
185+
echo "test_command=test:${major_minor}:sm" >> $GITHUB_OUTPUT
186+
187+
echo "Using compose file: docker/docker-compose-matrix.yaml"
188+
echo "Using test command: test:${major_minor}:sm"
189+
echo "Testing Camunda version: $version"
190+
191+
- name: Check if Docker image exists
192+
id: check-image
193+
run: |
194+
version="${{ matrix.version }}"
195+
echo "Checking if Docker image exists: camunda/camunda:$version"
196+
197+
# Try to get the image manifest
198+
if docker manifest inspect camunda/camunda:$version > /dev/null 2>&1; then
199+
echo "Image exists"
200+
echo "exists=true" >> $GITHUB_OUTPUT
201+
else
202+
echo "Image does not exist - skipping version $version"
203+
echo "exists=false" >> $GITHUB_OUTPUT
204+
fi
205+
206+
- name: Pull Camunda images for version ${{ matrix.version }}
207+
if: steps.check-image.outputs.exists == 'true'
208+
run: |
209+
export CAMUNDA_VERSION="${{ matrix.version }}"
210+
echo "Pulling images for Camunda version: $CAMUNDA_VERSION"
211+
docker compose -f docker/docker-compose-matrix.yaml pull
212+
213+
- name: Start Docker Compose
214+
if: steps.check-image.outputs.exists == 'true'
215+
run: |
216+
export CAMUNDA_VERSION="${{ matrix.version }}"
217+
docker compose -f docker/docker-compose-matrix.yaml up -d
218+
timeout-minutes: 10
219+
220+
- name: Wait for Services Healthy
221+
if: steps.check-image.outputs.exists == 'true'
222+
run: |
223+
set -e
224+
attempts=0
225+
max_attempts=60
226+
echo "Waiting for Camunda ${{ matrix.version }} to be healthy..."
227+
228+
while [ $attempts -lt $max_attempts ]; do
229+
code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:9600/actuator/health/status || true)
230+
if [ "$code" = "200" ]; then
231+
echo "Broker healthy after $((attempts * 5)) seconds"
232+
break
233+
fi
234+
attempts=$((attempts+1))
235+
echo "Attempt $attempts/$max_attempts - Status: $code"
236+
sleep 5
237+
done
238+
239+
if [ $attempts -ge $max_attempts ]; then
240+
echo "Broker not healthy after $((max_attempts * 5)) seconds"
241+
docker compose -f docker/docker-compose-matrix.yaml logs
242+
exit 1
243+
fi
244+
245+
- name: Run Integration Tests against Camunda ${{ matrix.version }}
246+
if: steps.check-image.outputs.exists == 'true'
247+
run: |
248+
npm run ${{ steps.docker-config.outputs.test_command }}
249+
env:
250+
ZEEBE_GRPC_ADDRESS: grpc://localhost:26500
251+
CAMUNDA_AUTH_STRATEGY: NONE
252+
CAMUNDA_TENANT_ID: <default>
253+
254+
- name: Cleanup
255+
if: always() && steps.check-image.outputs.exists == 'true'
256+
run: |
257+
export CAMUNDA_VERSION="${{ matrix.version }}"
258+
docker compose -f docker/docker-compose-matrix.yaml down
259+
docker compose -f docker/docker-compose-matrix.yaml down -v
260+
261+
- name: Upload test results
262+
if: failure()
263+
uses: actions/upload-artifact@v4
264+
with:
265+
name: test-results-${{ matrix.version }}
266+
path: |
267+
docker-compose-logs-*.txt
268+
retention-days: 7
269+
270+
- name: Mark version as tested
271+
if: success() && steps.check-image.outputs.exists == 'true'
272+
run: |
273+
mkdir -p .github
274+
echo "${{ matrix.version }}" >> .github/tested-versions.txt
275+
sort -u .github/tested-versions.txt -o .github/tested-versions.txt
276+
277+
- name: Upload tested version marker
278+
if: success() && steps.check-image.outputs.exists == 'true'
279+
uses: actions/upload-artifact@v4
280+
with:
281+
name: tested-version-${{ matrix.version }}
282+
path: .github/tested-versions.txt
283+
retention-days: 90
284+
285+
- name: Log skipped version
286+
if: steps.check-image.outputs.exists == 'false'
287+
run: |
288+
echo "::warning::Skipped version ${{ matrix.version }} - Docker image not available"
289+
290+
# - name: Notify Slack on failure
291+
# if: failure()
292+
# uses: slackapi/slack-github-action@v1.27.0
293+
# with:
294+
# payload: |
295+
# {
296+
# "text": ":alarm: *NodeSDK Compatibility Tests Failed*"
297+
# }
298+
# env:
299+
# SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
300+
# SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
301+
302+
update-tested-versions:
303+
needs: integration-tests
304+
if: always() && needs.integration-tests.result == 'success'
305+
runs-on: ubuntu-latest
306+
steps:
307+
- name: Checkout repository
308+
uses: actions/checkout@v4
309+
310+
- name: Download all tested version markers
311+
uses: actions/download-artifact@v4
312+
with:
313+
pattern: tested-version-*
314+
path: tested-markers
315+
merge-multiple: true
316+
317+
- name: Merge tested versions
318+
run: |
319+
mkdir -p .github
320+
touch .github/tested-versions.txt
321+
322+
# Merge all tested version files
323+
if [ -d "tested-markers" ]; then
324+
cat tested-markers/*.txt > .github/tested-versions.txt 2>/dev/null || true
325+
fi
326+
327+
# Sort and deduplicate
328+
sort -u .github/tested-versions.txt -o .github/tested-versions.txt
329+
330+
echo "Updated tested versions:"
331+
cat .github/tested-versions.txt
332+
333+
- name: Save tested versions cache
334+
uses: actions/cache/save@v4
335+
with:
336+
path: .github/tested-versions.txt
337+
key: tested-versions-${{ github.run_id }}

docker/docker-compose-matrix.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
services:
2+
camunda:
3+
image: camunda/camunda:${CAMUNDA_VERSION:-8.8.0}
4+
container_name: camunda-engine-matrix
5+
environment:
6+
SPRING_PROFILES_ACTIVE: "broker,consolidated-auth"
7+
ZEEBE_CLOCK_CONTROLLED: "true"
8+
ZEEBE_LOG_APPENDER: "Stackdriver"
9+
CAMUNDA_SECURITY_AUTHENTICATION_UNPROTECTEDAPI: "true"
10+
CAMUNDA_SECURITY_AUTHORIZATIONS_ENABLED: "false"
11+
# H2 / in-memory config (mirrors H2Configuration)
12+
CAMUNDA_DATABASE_URL: "jdbc:h2:mem:cpt;DB_CLOSE_DELAY=-1;MODE=PostgreSQL"
13+
CAMUNDA_DATABASE_TYPE: "rdbms"
14+
CAMUNDA_DATABASE_USERNAME: "sa"
15+
CAMUNDA_DATABASE_PASSWORD: ""
16+
CAMUNDA_DATA_SECONDARY_STORAGE_TYPE: "rdbms"
17+
ZEEBE_BROKER_EXPORTERS_RDBMS_CLASSNAME: "io.camunda.exporter.rdbms.RdbmsExporter"
18+
ZEEBE_BROKER_EXPORTERS_RDBMS_ARGS_FLUSH_INTERVAL: "PT0S"
19+
ZEEBE_BROKER_EXPORTERS_RDBMS_ARGS_DEFAULT_HISTORY_TTL: "PT2S"
20+
ZEEBE_BROKER_EXPORTERS_RDBMS_ARGS_MIN_HISTORY_CLEANUP_INTERVAL: "PT2S"
21+
ZEEBE_BROKER_EXPORTERS_RDBMS_ARGS_MAX_HISTORY_CLEANUP_INTERVAL: "PT5S"
22+
LOGGING_LEVEL_IO_CAMUNDA_DB_RDBMS: "INFO"
23+
LOGGING_LEVEL_ORG_MYBATIS: "INFO"
24+
ports:
25+
- "8080:8080" # REST API (ZEEBE_REST_ADDRESS -> http://localhost:8080)
26+
- "26500:26500" # gRPC Gateway
27+
- "9600:9600" # Monitoring / actuator / test time control
28+
healthcheck:
29+
test:
30+
[
31+
"CMD",
32+
"wget",
33+
"-qO",
34+
"-",
35+
"http://localhost:9600/actuator/health/status",
36+
]
37+
interval: 5s
38+
timeout: 3s
39+
retries: 30
40+
networks:
41+
- camunda-matrix-net
42+
43+
networks:
44+
camunda-matrix-net:
45+
name: camunda-matrix-net

0 commit comments

Comments
 (0)