test: one definition of the config a fixture corpus is recorded under #16
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: "Build" | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ["v*"] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| REGISTRY: ghcr.io | |
| jobs: | |
| gradle: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-java@v5 | |
| with: | |
| distribution: liberica | |
| java-version: "25" | |
| - name: "Build" | |
| run: ./gradlew --no-daemon build | |
| e2e: | |
| needs: gradle | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 45 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-java@v5 | |
| with: | |
| distribution: liberica | |
| java-version: "25" | |
| # The half of the DockerClient contract that a real daemon has to answer. It cannot run against | |
| # the suite's dind (DockerApi speaks only to a unix socket, dind is reachable over TCP), so it | |
| # runs against the runner's own daemon — safe here because the runner is disposable and the | |
| # contract only ever touches containers it named `kodkod-contract-*`. First because it is cheap | |
| # and because "the fake invented this" is the most useful thing a failing e2e run can tell you. | |
| - name: "Run the DockerClient contract against the runner's daemon" | |
| run: ./gradlew --no-daemon e2eTest -Pkodkod.e2e.useCurrentDocker=true --tests '*DockerApiContractTest*' | |
| - name: "Run E2E tests" | |
| run: ./gradlew --no-daemon e2eTest | |
| docker: | |
| needs: [gradle, e2e] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: "Set lowercase image name" | |
| run: echo "IMAGE_NAME=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
| - uses: docker/setup-qemu-action@v4 | |
| - uses: docker/setup-buildx-action@v4 | |
| - name: "Log in to GHCR" | |
| if: github.event_name != 'pull_request' | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: "Docker meta" | |
| id: meta | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=semver,pattern={{version}} | |
| type=sha | |
| - name: "Build and push" | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| # Multi-arch only when actually pushing. The docker daemon can't `--load` a | |
| # manifest list, so on PRs we build a single arch and load it for the smoke test. | |
| platforms: ${{ github.event_name == 'pull_request' && 'linux/amd64' || 'linux/amd64,linux/arm64' }} | |
| push: ${{ github.event_name != 'pull_request' }} | |
| load: ${{ github.event_name == 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| - name: "Smoke test (no socket needed)" | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| set -euo pipefail | |
| image="${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}" | |
| # With both jobs disabled the daemon logs config, finds nothing to do, and exits 0. | |
| out=$(docker run --rm -e KODKOD_AUTOHEAL_ENABLED=false -e KODKOD_UPDATE_ENABLED=false "$image") | |
| echo "$out" | |
| echo "$out" | grep -q "nothing to do" |