Sync upstream - v26/v30 (2026-02-13) #4
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: chromium-headless-image | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| workflow_call: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| docker: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - arch: amd64 | |
| runner: ubuntu-latest | |
| - arch: arm64 | |
| runner: ubuntu-24.04-arm64 | |
| runs-on: ${{ matrix.runner }} | |
| permissions: | |
| contents: read | |
| env: | |
| UKC_TOKEN: dummy | |
| UKC_METRO: ci | |
| NAME: ci-chromium-headless | |
| DETACH: "true" | |
| SERVICE_EXCEPTIONS: pulseaudio | |
| CACHE_DIR: .buildx-cache-headless-${{ matrix.runner }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Restore Docker layer cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.CACHE_DIR }} | |
| key: buildx-${{ runner.os }}-${{ matrix.runner }}-headless-${{ hashFiles('images/chromium-headless/image/Dockerfile', 'images/chromium-headless/image/wrapper.sh', 'server/go.mod', 'server/go.sum') }} | |
| restore-keys: | | |
| buildx-${{ runner.os }}-${{ matrix.runner }}-headless- | |
| - name: Build image | |
| shell: bash | |
| run: | | |
| bash images/chromium-headless/build-docker.sh | |
| - name: Run container | |
| shell: bash | |
| run: | | |
| bash images/chromium-headless/run-docker.sh | |
| - name: Wait for supervisor services (allow pulseaudio non-RUNNING) | |
| shell: bash | |
| run: | | |
| trap "docker stop ci-chromium-headless >/dev/null 2>&1 || true" EXIT | |
| attempts=30 | |
| sleep_seconds=1 | |
| for i in $(seq 1 "$attempts"); do | |
| out=$(docker exec ci-chromium-headless supervisorctl status || true) | |
| echo "$out" | |
| total=$(echo "$out" | grep -v '^$' | wc -l | tr -d ' ') | |
| exceptions="${SERVICE_EXCEPTIONS:-}" | |
| pattern=$(printf '%s' "$exceptions" | tr ', ' '\n' | sed '/^$/d' | paste -sd '|' -) | |
| ok=$(echo "$out" | awk -v pat="$pattern" 'BEGIN{IGNORECASE=1} { if (pat != "" && $0 ~ pat) print; else if ($0 ~ /RUNNING/) print }' | wc -l | tr -d ' ') | |
| if [ "$total" -gt 0 ] && [ "$ok" -eq "$total" ]; then | |
| echo "All required services are RUNNING" | |
| exit 0 | |
| fi | |
| sleep "$sleep_seconds" | |
| done | |
| echo "Supervisor services not ready in time" | |
| docker logs --tail=200 ci-chromium-headless || true | |
| exit 1 | |