Test (main) #13
This file contains hidden or 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: Test | |
| run-name: Test (${{ github.ref_name }}) | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - mode: audit | |
| proxy_mode: audit | |
| test_dockerfile: test/Dockerfile.audit | |
| assert_script: ./test/assert-audit-mode.sh | |
| endpoint_port: 1234 | |
| - mode: restrict | |
| proxy_mode: restrict | |
| test_dockerfile: test/Dockerfile.restrict | |
| assert_script: ./test/assert-restrict-mode.sh | |
| endpoint_port: 1235 | |
| name: test (${{ matrix.mode }}) | |
| env: | |
| COMPOSE_FILE: compose.yml:compose.test.yml | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Build containers | |
| run: docker compose build | |
| - name: Start containers | |
| env: | |
| PROXY_MODE: ${{ matrix.proxy_mode }} | |
| PORT: ${{ matrix.endpoint_port }} | |
| run: docker compose up -d --wait | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| driver: remote | |
| endpoint: tcp://localhost:${{ matrix.endpoint_port }} | |
| - name: Build test image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: test | |
| file: ${{ matrix.test_dockerfile }} | |
| push: false | |
| no-cache: true | |
| load: true | |
| tags: buildcage-test | |
| - name: Show logs | |
| if: always() | |
| run: ./report/report.sh || true | |
| - name: Run assertions | |
| run: ${{ matrix.assert_script }} | |
| - name: Cleanup | |
| if: always() | |
| run: docker compose down -v --rmi all 2>/dev/null || true |