From db8bdb3a6266bdaebd9aa2a6d8415d21fb940467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Untersch=C3=BCtz?= Date: Sun, 22 Nov 2026 12:46:32 +0100 Subject: [PATCH] ci: install Go and sqlc as binaries instead of through actions The runners are ephemeral and clone every action from GitHub, which took several minutes per job. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3 --- .gitea/workflows/ci.yaml | 52 +++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 22 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index f79e984..4a9ff4f 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -19,19 +19,23 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - - uses: actions/setup-go@v7 - with: - go-version-file: go.mod - - uses: actions/setup-node@v6 - with: - node-version: 24 - cache: npm + # The runners are ephemeral and clone every action from GitHub, which + # takes minutes; Go comes as a tarball instead, and the job image + # already has the Node version the frontend build needs. + - name: Install Go + run: | + v="$(awk '/^go /{print $2}' go.mod)" + curl -fsSL "https://go.dev/dl/go${v}.linux-amd64.tar.gz" | tar -C /usr/local -xz + echo /usr/local/go/bin >> "$GITHUB_PATH" + echo "$HOME/go/bin" >> "$GITHUB_PATH" - name: Build frontend run: npm ci --no-audit --no-fund && npm run build - name: Generated code is up to date run: | go tool templ generate - go run github.com/sqlc-dev/sqlc/cmd/sqlc@${SQLC_VERSION} generate + # The release binary avoids compiling sqlc's cgo parser. + curl -fsSL "https://github.com/sqlc-dev/sqlc/releases/download/${SQLC_VERSION}/sqlc_${SQLC_VERSION#v}_linux_amd64.tar.gz" | tar -xz -C /usr/local/bin sqlc + sqlc generate git diff --exit-code -- '*.go' - name: gofmt run: test -z "$(gofmt -l internal cmd)" || { gofmt -l internal cmd; exit 1; } @@ -56,13 +60,15 @@ jobs: UPTIME_TEST_REDIS_URL: redis://redis:6379/15 steps: - uses: actions/checkout@v7 - - uses: actions/setup-go@v7 - with: - go-version-file: go.mod - - uses: actions/setup-node@v6 - with: - node-version: 24 - cache: npm + # The runners are ephemeral and clone every action from GitHub, which + # takes minutes; Go comes as a tarball instead, and the job image + # already has the Node version the frontend build needs. + - name: Install Go + run: | + v="$(awk '/^go /{print $2}' go.mod)" + curl -fsSL "https://go.dev/dl/go${v}.linux-amd64.tar.gz" | tar -C /usr/local -xz + echo /usr/local/go/bin >> "$GITHUB_PATH" + echo "$HOME/go/bin" >> "$GITHUB_PATH" - name: Build frontend run: npm ci --no-audit --no-fund && npm run build - name: Prepare database @@ -78,13 +84,15 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - - uses: actions/setup-go@v7 - with: - go-version-file: go.mod - - uses: actions/setup-node@v6 - with: - node-version: 24 - cache: npm + # The runners are ephemeral and clone every action from GitHub, which + # takes minutes; Go comes as a tarball instead, and the job image + # already has the Node version the frontend build needs. + - name: Install Go + run: | + v="$(awk '/^go /{print $2}' go.mod)" + curl -fsSL "https://go.dev/dl/go${v}.linux-amd64.tar.gz" | tar -C /usr/local -xz + echo /usr/local/go/bin >> "$GITHUB_PATH" + echo "$HOME/go/bin" >> "$GITHUB_PATH" - name: Build frontend run: npm ci --no-audit --no-fund && npm run build - name: Build binaries