Test (23/merge) #115
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 | |
| - mode: restrict | |
| proxy_mode: restrict | |
| test_dockerfile: test/Dockerfile.restrict | |
| assert_script: ./test/assert-restrict-mode.sh | |
| name: test (${{ matrix.mode }}) | |
| env: | |
| COMPOSE_FILE: compose.test.yml | |
| TEST_NETWORK: buildcage_test-net | |
| TEST_EXTERNAL_RESOLVER: 10.200.0.53 | |
| TEST_ALLOWED_HTTPS_RULES: "allowed.example.com:443 allowed.example.com:8443 *.wildcard.example.com:443 *.wildcard.example.com:8443" | |
| TEST_ALLOWED_HTTP_RULES: "allowed.example.com:80 allowed.example.com:8080 *.wildcard.example.com:80 *.wildcard.example.com:8080" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Build containers | |
| run: | | |
| docker compose build | |
| docker build -t buildcage:local docker | |
| - name: Start test infrastructure | |
| run: docker compose up -d --wait | |
| - name: Create buildx builder | |
| uses: ./setup | |
| with: | |
| buildcage_image: buildcage | |
| buildcage_version: local | |
| proxy_mode: ${{ matrix.proxy_mode }} | |
| allowed_https_rules: ${{ env.TEST_ALLOWED_HTTPS_RULES }} | |
| allowed_http_rules: ${{ env.TEST_ALLOWED_HTTP_RULES }} | |
| extra_options: >- | |
| --driver-opt network=${{ env.TEST_NETWORK }} | |
| --driver-opt env.EXTERNAL_RESOLVER=${{ env.TEST_EXTERNAL_RESOLVER }} | |
| - name: Build test image | |
| uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0 | |
| 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 | |
| builder: buildcage | |
| - name: Show logs | |
| if: always() | |
| uses: ./report | |
| with: | |
| fail_on_blocked: 'false' | |
| continue-on-error: true | |
| - name: Run assertions | |
| run: ${{ matrix.assert_script }} | |
| - name: Cleanup | |
| if: always() | |
| run: docker compose down -v --rmi all 2>/dev/null || true |