Skip to content

Test (main)

Test (main) #29

Workflow file for this run

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
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