# Builds every image in images/ and pushes it to the Gitea container registry # as git.faumaray.com/void/ci-images:. Pull requests build without # pushing; a push to main publishes the tags the runner labels use. name: Build CI images on: push: branches: [main] paths: - "images/**" - ".gitea/workflows/build.yml" pull_request: paths: - "images/**" workflow_dispatch: permissions: contents: read packages: write jobs: build: runs-on: ubuntu-latest # The Actions token is not accepted by the container registry, so the push # uses a PAT. REGISTRY_USER / REGISTRY_TOKEN (a repository variable and # secret) override the organization release-bot defaults. env: REGISTRY_USER: ${{ vars.REGISTRY_USER || 'echoion-release-bot' }} REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN || secrets.RELEASE_BOT_TOKEN }} strategy: fail-fast: false matrix: image: - vulkan - windows-gcc - windows-clang steps: - uses: actions/checkout@v4 - name: Resolve the registry and image name id: image shell: bash run: | set -euo pipefail server=${GITHUB_SERVER_URL#http://} server=${server#https://} server=${server%%/*} repo=${GITHUB_REPOSITORY,,} printf 'registry=%s\n' "$server" >>"$GITHUB_OUTPUT" printf 'ref=%s/%s:%s\n' "$server" "$repo" "${{ matrix.image }}" >>"$GITHUB_OUTPUT" - name: Log in to the Gitea container registry if: github.event_name != 'pull_request' && env.REGISTRY_TOKEN != '' shell: bash run: | set -euo pipefail printf '%s' "$REGISTRY_TOKEN" | docker login "${{ steps.image.outputs.registry }}" \ -u "$REGISTRY_USER" --password-stdin - name: Build shell: bash run: | set -euo pipefail docker build --pull \ --tag "${{ steps.image.outputs.ref }}" \ "images/${{ matrix.image }}" - name: Smoke test Vulkan (software driver) if: matrix.image == 'vulkan' shell: bash run: | set -euo pipefail docker run --rm "${{ steps.image.outputs.ref }}" bash -lc ' icd=$(ls /usr/share/vulkan/icd.d/lvp_icd*.json | head -n1) xvfb-run -a env VK_DRIVER_FILES="$icd" vulkaninfo --summary' - name: Push if: github.event_name != 'pull_request' && env.REGISTRY_TOKEN != '' shell: bash run: | set -euo pipefail docker push "${{ steps.image.outputs.ref }}"