test-integration.yml•2.52 kB
name: "Testing: Integration"
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
integration-tests:
name: "Run Tests"
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
with:
egress-policy: audit
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
with:
install: true
driver-opts: |
network=host
- name: Cache Docker layers
uses: actions/cache@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Run integration tests with automatic cleanup
run: |
# Run integration tests and capture exit code, then cleanup
docker compose -f docker-compose.test.yml up --build --abort-on-container-exit --exit-code-from test-runner
EXIT_CODE=$?
docker compose -f docker-compose.test.yml down -v
exit $EXIT_CODE
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1
if: always()
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: integration
files: ./coverage/integration-cobertura.xml
fail_ci_if_error: false
- name: Upload test results to Codecov
uses: codecov/test-results-action@47f89e9acb64b76debcd5ea40642d25a4adced9f # v1.1.1
if: always()
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: integration
files: ./integration-junit.xml
- name: Upload test artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
if: always()
with:
name: integration-test-results
path: |
coverage/integration-cobertura.xml
integration-junit.xml
retention-days: 7
if-no-files-found: warn