Skip to content

Commit 4a3e731

Browse files
committed
ci: replace the integration workflow with the flake checks and a legacy pipeline
CI runs nix build .#checks.<system>.integration-* instead of the bespoke docker matrix — the generated checks are the matrix. The tests the hermetic VM can't run (real-internet DERP, docker cable-pull) run via cmd/hi in a slim legacy workflow, which also keeps cmd/hi and the integration Dockerfiles exercised. check-tests guards the pinned versions against capver drift.
1 parent d96780a commit 4a3e731

4 files changed

Lines changed: 129 additions & 527 deletions

File tree

.github/workflows/check-tests.yaml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,23 @@ jobs:
3737
if: steps.changed-files.outputs.files == 'true'
3838
run: |
3939
(cd .github/workflows && go generate)
40-
git diff --exit-code .github/workflows/test-integration.yaml
40+
git diff --exit-code integration/tests.nix integration/postgres-tests.nix integration/excluded-tests.json
4141
4242
- name: Show missing tests
4343
if: failure()
4444
run: |
45-
git diff .github/workflows/test-integration.yaml
45+
git diff integration/tests.nix integration/postgres-tests.nix integration/excluded-tests.json
46+
47+
# The pinned tailscale images must match the versions the suite requests
48+
# (MustTestVersions); a capver bump that isn't mirrored here makes the
49+
# offline integration checks fail at runtime.
50+
- name: Check tailscale version pins match capver
51+
if: steps.changed-files.outputs.files == 'true'
52+
run: |
53+
want=$(nix develop --command go run ./cmd/hi list-versions --set=must --exclude=head | tr ' ' '\n' | sort)
54+
have=$(jq -r '.images | keys[]' integration/tailscale-versions.json | sort)
55+
if [ "$want" != "$have" ]; then
56+
echo "::error::integration/tailscale-versions.json is stale vs capver; run 'update-integration-images' in the dev shell"
57+
diff <(echo "$want") <(echo "$have") || true
58+
exit 1
59+
fi

.github/workflows/integration-test-template.yml

Lines changed: 0 additions & 139 deletions
This file was deleted.
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: integration-legacy
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: read
14+
15+
# A small number of integration tests cannot run as hermetic NixOS-VM checks
16+
# because they need Tailscale's public DERP relays (real internet) — see
17+
# excludedFromNixChecks in gh-action-integration-generator.go. They run here the
18+
# legacy way, via cmd/hi against Dockerfile-built images, which also keeps the
19+
# cmd/hi path and the integration Dockerfiles exercised in CI. The matrix is the
20+
# generated integration/excluded-tests.json so this list has a single source.
21+
jobs:
22+
list:
23+
runs-on: ubuntu-latest
24+
outputs:
25+
tests: ${{ steps.list.outputs.tests }}
26+
steps:
27+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
28+
- id: list
29+
run: echo "tests=$(jq -c . integration/excluded-tests.json)" >> "$GITHUB_OUTPUT"
30+
31+
test:
32+
needs: list
33+
runs-on: ubuntu-latest
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
test: ${{ fromJSON(needs.list.outputs.tests) }}
38+
steps:
39+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
40+
- uses: NixOS/nix-installer-action@6b8548fe06acfb0155a50ab5d561accb215764cc # main
41+
- uses: Mic92/hestia/action@ff07bb902a9968ac0c3d0e51d90a606662a375d8 # main
42+
43+
# Docker 29's default containerd snapshotter regresses these images; the
44+
# classic overlay2 graph driver is the known-good path (mirrors the VM checks).
45+
- name: Force overlay2 storage driver
46+
run: |
47+
sudo mkdir -p /etc/docker
48+
echo '{"storage-driver":"overlay2"}' | sudo tee /etc/docker/daemon.json
49+
sudo systemctl restart docker
50+
51+
- name: Login to Docker Hub
52+
env:
53+
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_CI_USERNAME }}
54+
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_CI_TOKEN }}
55+
if: env.DOCKERHUB_USERNAME != ''
56+
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
57+
with:
58+
username: ${{ env.DOCKERHUB_USERNAME }}
59+
password: ${{ env.DOCKERHUB_TOKEN }}
60+
61+
# cmd/hi requires prebuilt head images in CI (util.IsCI); released versions
62+
# pull from the registry and tailscale-rs is built inline by tsric.
63+
# Dockerfile.integration-ci COPYs a prebuilt headscale binary from the
64+
# build context, so build it first (tailscale-HEAD builds from source).
65+
- name: Build headscale + tailscale-HEAD images
66+
run: |
67+
nix develop --command bash -c 'CGO_ENABLED=0 GOOS=linux go build -o headscale ./cmd/headscale'
68+
docker build --file Dockerfile.integration-ci --tag headscale:ci .
69+
docker build --file Dockerfile.tailscale-HEAD --tag tailscale-head:ci .
70+
71+
- name: Run ${{ matrix.test }}
72+
env:
73+
HEADSCALE_INTEGRATION_HEADSCALE_IMAGE: headscale:ci
74+
HEADSCALE_INTEGRATION_TAILSCALE_IMAGE: tailscale-head:ci
75+
run: nix develop --command go run ./cmd/hi run "^${{ matrix.test }}$" --timeout=900s

0 commit comments

Comments
 (0)