Skip to content

Commit ec4726b

Browse files
authored
BUILD: Speed up GoReleaser in PR builds with --single-target --skip=before (#4167)
The main bottleneck in the PR CI/CD pipeline is the `goreleaser build --snapshot` step, which takes \~8m19s out of the total \~10m45s ([run 23057743439](https://github.com/StackExchange/dnscontrol/actions/runs/23057743439)). | **Step** | **Duration** | | --- | --- | | Unit tests | 1m 46s | | Build binaries (not tagged) | 8m 19s | | Rest (setup, cache, etc.) | \~10s | Two things make it slow: 1. **Cross-compilation for all 8 targets** (linux, windows, darwin, freebsd x amd64/arm64). For a PR build, we only need to verify the code compiles. 2. **Before hooks** (`go fmt ./...`, `go mod tidy`, `go generate ./...`) run every time, but are redundant in CI -- formatting/tidy should already be done, and `go generate` is covered by the stringer install step. This PR adds `--single-target` and `--skip=before` to the snapshot build, which should bring the GoReleaser step from \~8 minutes down to \~1 minute. The full release build (on tag) remains unchanged. Fixes #4165
1 parent 92d4efa commit ec4726b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

.github/workflows/pr_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,4 +83,4 @@ jobs:
8383
if: github.ref_type != 'tag'
8484
uses: goreleaser/goreleaser-action@v7
8585
with:
86-
args: build --snapshot
86+
args: build --snapshot --single-target --skip=before

0 commit comments

Comments
 (0)