Test (16/merge) #102
Workflow file for this run
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: | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| unit_test: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| name: test (unit) | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Run unit tests | |
| run: make test_unit | |
| 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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - 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@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0 | |
| with: | |
| driver: remote | |
| endpoint: tcp://localhost:${{ matrix.endpoint_port }} | |
| - name: Build test image | |
| uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2 | |
| env: | |
| DOCKER_BUILD_CHECKS_ANNOTATIONS: false | |
| DOCKER_BUILD_SUMMARY: false | |
| DOCKER_BUILD_RECORD_UPLOAD: false | |
| with: | |
| context: test | |
| file: ${{ matrix.test_dockerfile }} | |
| push: false | |
| no-cache: true | |
| load: true | |
| tags: buildcage-test | |
| - name: Show logs | |
| if: always() | |
| run: node report/main.mjs ./compose.yml || true | |
| - name: Run assertions | |
| run: ${{ matrix.assert_script }} | |
| - name: Cleanup | |
| if: always() | |
| run: docker compose down -v --rmi all 2>/dev/null || true |