Skip to content

Integration CI · workflow tests #6

Integration CI · workflow tests

Integration CI · workflow tests #6

name: Integration CI · workflow tests
on:
workflow_run:
workflows: ["Integration CI · build"]
types: [completed]
permissions:
contents: read
actions: read # needed to download artifacts from the triggering workflow run
issues: write # needed to create canary issues on failure
jobs:
workflow-tests:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.workflow_run.head_sha }}
submodules: recursive
- name: Set up Java 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- name: Set up Node 18
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Cache Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('kitodo-production/**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Download WAR artifact
uses: actions/download-artifact@v4
with:
name: kitodo-war
path: build-resources/
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Download SQL artifact
uses: actions/download-artifact@v4
with:
name: kitodo-sql
path: build-resources/
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Download modules artifact
uses: actions/download-artifact@v4
with:
name: kitodo-modules
path: build-resources/modules/
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Start Docker stack
run: docker compose -f docker/docker-compose.yml up --build -d
- name: Run smoke tests
run: bash docker/smoke-test.sh
- name: Tear down Docker stack
if: always()
run: docker compose -f docker/docker-compose.yml down
- name: Build workflow editor
working-directory: kitodo-workflow-editor
run: |
npm ci
npm run build
- name: Copy editor dist assets into Kitodo.Production
run: |
RESOURCES=kitodo-production/Kitodo/src/main/webapp/WEB-INF/resources
cp kitodo-workflow-editor/dist/js/modeler_min.js "$RESOURCES/js/modeler_min.js"
cp kitodo-workflow-editor/dist/js/modeler_custom.js "$RESOURCES/js/modeler_custom.js"
cp kitodo-workflow-editor/dist/css/modeler.css "$RESOURCES/css/modeler.css"
mkdir -p "$RESOURCES/font"
cp kitodo-workflow-editor/dist/font/* "$RESOURCES/font/"
- name: Build Kitodo.Production (Maven)
working-directory: kitodo-production
run: mvn clean install -P'!development' -DskipTests -B
- name: Run Selenium workflow tests
working-directory: kitodo-production
run: |
mvn verify -pl Kitodo --also-make -P'!development,selenium' -B \
-Dsurefire.skip=true \
-Dit.test='AddingST,EditingST,MigrationST' \
-Dfailsafe.failIfNoSpecifiedTests=false
- name: Run backend workflow tests
if: always()
working-directory: kitodo-production
run: |
mvn verify -P'!development' -B \
-Dtest='*Workflow*' \
-Dit.test='*Workflow*,ConverterIT,ReaderIT,UpdaterIT' \
-Dsurefire.failIfNoSpecifiedTests=false \
-Dfailsafe.failIfNoSpecifiedTests=false
- name: Create canary issue on failure
if: failure()
uses: actions/github-script@v7
with:
script: |
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `CI failure: workflow-tests failed on ${context.sha.slice(0, 7)}`,
body: [
'## Workflow tests failed',
'',
`**Run:** ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`,
`**Commit:** ${context.sha}`,
`**Triggered by build run:** ${{ github.event.workflow_run.id }}`,
].join('\n'),
labels: ['ci-canary'],
})