ci: add larva autorun workflow #502
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Continuous Integration | |
on: | |
pull_request: | |
branches: | |
- main | |
- master | |
jobs: | |
version-next: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
outputs: | |
version-next: ${{ steps.reference.outputs.next-reference }} | |
version-next-strict: ${{ steps.reference.outputs.next-reference }} | |
steps: | |
- uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
disable-sudo: true | |
egress-policy: block | |
allowed-endpoints: > | |
github.com:443 | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #4.2.2 | |
- name: Next Reference | |
id: reference | |
uses: wearefrank/ci-cd-templates/next-reference@5abb5d1df24669c4c4ef75093bb83161c359c66e #1.0.10 | |
ci: | |
uses: wearefrank/ci-cd-templates/.github/workflows/ci-generic.yml@5abb5d1df24669c4c4ef75093bb83161c359c66e #1.0.10 | |
needs: | |
- version-next | |
secrets: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
version: ${{ needs.version-next.outputs.version-next }} | |
docker-image-repo: ${{ vars.DOCKER_IMAGE_REPOSITORY }} | |
docker-image-name: ${{ vars.DOCKER_IMAGE_NAME }} | |
upload-sarif-to-security: false | |
run-frank-till-healthy-enabled: false | |
run-soapui-tests: | |
runs-on: ubuntu-latest | |
needs: | |
- version-next | |
- ci | |
steps: | |
- uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
egress-policy: audit | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #4.2.2 | |
- name: Download Docker tar | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 #4.1.8 | |
with: | |
name: build-docker-image | |
- name: Load Docker tar | |
shell: bash | |
run: | | |
docker load --input image.tar | |
docker image ls -a | |
- name: Run SoapUI Tests | |
run: | | |
export ZAAKBRUG_VERSION="${{ needs.version-next.outputs.version-next }}" | |
docker image inspect ${{ vars.DOCKER_IMAGE_REPOSITORY }}/${{ vars.DOCKER_IMAGE_NAME }}:${ZAAKBRUG_VERSION} | |
docker compose -f ./docker-compose.zaakbrug.dev.yml -f ./docker-compose.zaakbrug.postgres.yml -f ./docker-compose.openzaak.dev.yml --profile soapui up -d | |
docker ps | |
sleep 90 | |
STATUS=$(docker inspect --format='{{json .State.Status}}' soapui-testrunner) | |
until [ "$STATUS" = '"exited"' ] | |
do | |
STATUS=$(docker inspect --format='{{json .State.Status}}' soapui-testrunner) | |
sleep 15 | |
done | |
EXIT_CODE=$(docker inspect --format='{{json .State.ExitCode}}' soapui-testrunner) | |
echo "Exit Code: $EXIT_CODE" | |
docker compose -f ./docker-compose.zaakbrug.dev.yml -f ./docker-compose.zaakbrug.postgres.yml -f ./docker-compose.openzaak.dev.yml down | |
if [ "$EXIT_CODE" -ne 0 ] | |
then | |
echo "Test(s) failed. Failing the job." | |
exit 1 | |
fi | |
timeout-minutes: 15 | |
- name: Check if test reports created | |
run: | | |
if [ -z "$(ls -A e2e/reports)" ] | |
then | |
echo "There is no test report found, tests might not have been run. Failing the job." | |
exit 1 | |
fi | |
- name: Upload SoapUI testreports as artifact | |
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 #4.4.3 | |
if: always() | |
with: | |
name: reports-soapui-testreports | |
path: ./*/reports | |
run-larva-tests: | |
runs-on: ubuntu-latest | |
needs: | |
- version-next | |
- ci | |
steps: | |
- uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1 | |
with: | |
egress-policy: audit | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #4.2.2 | |
- name: Download Docker tar | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 #4.1.8 | |
with: | |
name: build-docker-image | |
- name: Load Docker tar | |
shell: bash | |
run: | | |
docker load --input image.tar | |
docker image ls -a | |
- name: Run Larva Tests | |
run: | | |
export ZAAKBRUG_VERSION="${{ needs.version-next.outputs.version-next }}" | |
docker image inspect ${{ vars.DOCKER_IMAGE_REPOSITORY }}/${{ vars.DOCKER_IMAGE_NAME }}:${ZAAKBRUG_VERSION} | |
docker compose -f ./docker-compose.zaakbrug.dev.yml up -d | |
docker ps | |
sleep 120 | |
docker ps | |
curl -X POST 'http://localhost:8080/iaf/larva/index.jsp' \ | |
--header 'Content-Type: application/x-www-form-urlencoded' \ | |
--data-urlencode 'scenariosrootdirectory=/opt/frank/testtool' \ | |
--data-urlencode 'waitbeforecleanup=100' \ | |
--data-urlencode 'loglevel=WRONG_PIPELINE_MESSAGES_PREPARED_FOR_DIFF' \ | |
--data-urlencode 'execute=/opt/frank/testtool' \ | |
--data-urlencode 'submit=start' > results.html | |
if ! grep -q 'All scenarios passed' results.html; then | |
echo "Not all scenarios passed. Failing the job." | |
cat results.html | |
EXIT_CODE=1 | |
exit 1 | |
fi | |
docker compose -f ./docker-compose.zaakbrug.dev.yml -f ./docker-compose.zaakbrug.postgres.yml -f ./docker-compose.openzaak.dev.yml down | |
timeout-minutes: 15 | |
- name: Check if test reports created | |
run: | | |
if [ -z "$(ls -A e2e/reports)" ] | |
then | |
echo "There is no test report found, tests might not have been run. Failing the job." | |
exit 1 | |
fi |