diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml index aa43f56..1f4a1a2 100644 --- a/.github/workflows/deploy-pages.yml +++ b/.github/workflows/deploy-pages.yml @@ -39,8 +39,28 @@ jobs: uses: actions/setup-go@v5 with: go-version: '1.26' + # No go.sum in this repo — the lg-binary cache below replaces the + # inert module cache. + cache: false + + # Ask the tools where they install rather than restating their defaults. + # Both values are what the runner already uses; declaring them means the + # cache path and the install target cannot drift apart, and neither has + # to be re-verified against a run to know it is right. + - name: Resolve cache paths + run: | + echo "GOPATH=$(go env GOPATH)" >> "$GITHUB_ENV" + echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/ms-playwright" >> "$GITHUB_ENV" + + - name: Cache lg binary + id: lgcache + uses: actions/cache@v4 + with: + path: ${{ env.GOPATH }}/bin/let-go + key: lg-bin-${{ runner.os }}-go1.26-${{ steps.letgo.outputs.version }} - name: Install let-go + if: steps.lgcache.outputs.cache-hit != 'true' run: go install github.com/nooga/let-go@${{ steps.letgo.outputs.version }} # The shared build: shell-less + xsofy's own client shell (rune font + @@ -56,6 +76,15 @@ jobs: with: node-version: '20' + # Both test dirs download chromium (~150MB) without this; the cache + # keyed on the two lockfiles makes both `playwright install` calls + # no-op the download when the pinned versions haven't moved. + - name: Cache Playwright browsers + uses: actions/cache@v4 + with: + path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} + key: pw-${{ runner.os }}-${{ hashFiles('tests/browser/package-lock.json', 'tests/e2e/package-lock.json') }} + - name: Install smoke dependencies working-directory: tests/browser run: | @@ -69,7 +98,7 @@ jobs: - name: E2E seeded regression (@playwright/test) working-directory: tests/e2e run: | - npm install --no-audit --no-fund + npm ci --no-audit --no-fund npx playwright install chromium DIST="$GITHUB_WORKSPACE/dist" npx playwright test diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index 81c3841..438775a 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -52,8 +52,30 @@ jobs: uses: actions/setup-go@v5 with: go-version: '1.26' + # No go.sum in this repo — the lg-binary cache below replaces the + # inert module cache. + cache: false + + # Ask the tools where they install rather than restating their defaults. + # Both values are what the runner already uses; declaring them means the + # cache path and the install target cannot drift apart, and neither has + # to be re-verified against a run to know it is right. + - name: Resolve cache paths + run: | + echo "GOPATH=$(go env GOPATH)" >> "$GITHUB_ENV" + echo "PLAYWRIGHT_BROWSERS_PATH=$HOME/.cache/ms-playwright" >> "$GITHUB_ENV" + + # pull_request_target runs may restore default-branch caches but cannot + # save a miss. Trusted deploy/manual runs seed this cache. + - name: Restore lg binary cache + id: lgcache + uses: actions/cache/restore@v4 + with: + path: ${{ env.GOPATH }}/bin/let-go + key: lg-bin-${{ runner.os }}-go1.26-${{ steps.letgo.outputs.version }} - name: Install let-go + if: steps.lgcache.outputs.cache-hit != 'true' run: go install github.com/nooga/let-go@${{ steps.letgo.outputs.version }} - name: Build WASM bundle @@ -67,6 +89,13 @@ jobs: with: node-version: '20' + # Restore-only for the same pull_request_target restriction above. + - name: Restore Playwright browser cache + uses: actions/cache/restore@v4 + with: + path: ${{ env.PLAYWRIGHT_BROWSERS_PATH }} + key: pw-${{ runner.os }}-${{ hashFiles('tests/browser/package-lock.json', 'tests/e2e/package-lock.json') }} + - name: Install smoke dependencies working-directory: tests/browser run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9561a44..7fe7e09 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,24 +29,49 @@ jobs: steps: - uses: actions/checkout@v4 - # The pinned lane reads .let-go-version; the latest lane uses its matrix - # value. One source of truth for the floor, shared with the Pages deploy. + - name: Set up Go + uses: actions/setup-go@v5 + with: + # Match the Pages deploy toolchain (deploy-pages.yml) so the floor + # lane tests with the Go the shipped bundle is actually built with. + go-version: '1.26' + # This repo has no go.sum, so setup-go's module cache is inert; + # the lg-binary cache below is what saves the compile. + cache: false + + # Ask Go where it installs rather than restating the default. `~/go` is + # correct on today's ubuntu-latest runners, but nothing here declares + # that; a runner or a job-level GOPATH that disagreed would leave the + # cache pointing somewhere `go install` never writes, and the only + # symptom would be a permanent silent miss. + - name: Resolve GOPATH + run: echo "GOPATH=$(go env GOPATH)" >> "$GITHUB_ENV" + + # The pinned lane reads .let-go-version; the latest lane resolves the + # moving `latest` to its concrete version so the binary cache below can + # key on it. One source of truth for the floor, shared with the deploy. - name: Resolve let-go version id: letgo run: | if [ "${{ matrix.pin }}" = "true" ]; then v="$(grep -v '^#' .let-go-version | grep . | head -1 | tr -d '[:space:]')" else - v="${{ matrix.letgo }}" + v="$(go list -m -f '{{.Version}}' github.com/nooga/let-go@${{ matrix.letgo }})" fi echo "version=$v" >> "$GITHUB_OUTPUT" - - name: Set up Go - uses: actions/setup-go@v5 + # No go.sum in this repo means no dependency-keyed Go cache, so every + # run was compiling let-go from source (~1-3 min). Cache the built + # binary keyed on the resolved version instead. + - name: Cache lg binary + id: lgcache + uses: actions/cache@v4 with: - go-version: '1.24' + path: ${{ env.GOPATH }}/bin/let-go + key: lg-bin-${{ runner.os }}-go1.26-${{ steps.letgo.outputs.version }} - name: Install let-go ${{ steps.letgo.outputs.version }} + if: steps.lgcache.outputs.cache-hit != 'true' run: go install github.com/nooga/let-go@${{ steps.letgo.outputs.version }} - name: Print let-go info