ci: run go build, vet and test on pull requests to develop - #198
Open
pastoriniMatheus wants to merge 1 commit into
Open
pastoriniMatheus wants to merge 1 commit into
pastoriniMatheus wants to merge 1 commit into
Conversation
No workflow in this repository is triggered by pull_request, so no PR is compiled by automation before review. The only Go check in the pipeline is `go build ./cmd/evolution-go/` inside sync-releases.yml, which runs after the fact, on the generated output, and does not cover pkg/telemetry, tools/build-dist or tools/encode-url. `go build` is not a sufficient gate: it never compiles _test.go files. Measured on develop with a test file importing a module path that does not resolve, `go build ./...` exits 0 while `go vet ./...` and `go test ./...` exit 1. vet is the step that catches the most common class of error in outside contributions. Pinned to develop only: develop and main have no common ancestor, so a workflow added here would never exist on main and pull_request would not fire for it there. setup-go reads go-version-file: go.mod rather than a literal version, so the toolchain cannot drift from what the module declares. Baseline on develop @706c9a4 with the submodule at its pinned SHA: build, vet and test all exit 0 (1 package with tests, 50 without, 0 failures), so this starts green. Deliberately out of scope: gofmt (8 files are currently unformatted, one of them pkg/whatsmeow/service/whatsmeow.go), make check (its fmt target rewrites files), make lint (golangci-lint is not installed and no .golangci.yml exists) and golangci-lint itself. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017ijukEy5wKHnKg7NemEPk9
Reviewer's GuideIntroduces a single Ubuntu-based CI job for pull requests and pushes to develop, using the module-declared Go version and required submodules before running build, vet, and test across the repository. The workflow is intended to provide automated signal for develop-based contributions; branch protection and required-status-check configuration remain outside the PR. Sequence diagram for the Go CI workflowsequenceDiagram
participant GitHub
participant Runner as UbuntuRunner
participant Checkout as actions/checkout
participant SetupGo as actions/setup-go
participant Go as GoToolchain
GitHub->>Runner: Trigger pull_request or push to develop
Runner->>Checkout: checkout with submodules: recursive
Checkout-->>Runner: Repository and whatsmeow-lib available
Runner->>SetupGo: Read go.mod
SetupGo-->>Runner: Install declared Go toolchain
Runner->>Go: go build ./...
Go-->>Runner: Build result
Runner->>Go: go vet ./...
Go-->>Runner: Vet result including test-file compilation
Runner->>Go: go test ./...
Go-->>Runner: Test result
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds
.github/workflows/ci.yml, which runsgo build ./...,go vet ./...andgo test ./...on every pull request targetingdevelop.Today no workflow in this repository is triggered by
pull_request. The only Go check that exists anywhere in the pipeline isgo build ./cmd/evolution-go/, insidesync-releases.yml— it runs after the merge, against the generated output, and in the last 6 pushes it did not execute at all (the job dies at "Clone target repo" and "Verify build" shows asskipped).go buildalone would not be a real gate: it never compiles_test.gofiles. Measured ondevelop@706c9a4, with a test file importing a module path that does not resolve:go build ./...go vet ./...no required module provides package …go test ./...Remove the probe and all three return to 0.
go vetis the step that earns this workflow: it is the one that compiles test files, which is the most common way an outside contribution breaks.Two smaller points, both deliberate:
go-version-file: go.modinstead of a literal version, so the toolchain cannot drift from what the module declares. (For reference,sync-releases.ymlcurrently pinsgo-version: '1.24'whilego.moddeclaresgo 1.25.0;GOTOOLCHAIN=autosilently downloads 1.25.0 to cover the gap. That is a separate one-line change and is not included here.)submodules: recursiveis required, not optional:go.modhasreplace go.mau.fi/whatsmeow => ./whatsmeow-lib, so without the submodule the build cannot resolve the module. The submodule is public, so no token and nofetch-depth: 0are needed.Why
developonly, and notmaindevelopandmainhave no common ancestor in this repository (git merge-base origin/main origin/developreturns nothing; 481 files differ). A workflow added ondeveloptherefore never exists onmain, andpull_requestevaluates the workflow from the merge ref — so listingmainin the triggers would be a dead line, not extra coverage.That also means this workflow covers 17 of the 54 currently open PRs (the ones based on
develop). The other 37 targetmain, which is a generated distribution branch — that is a separate problem and needs a contribution-docs change, not a CI change.Related Issue
No single issue; this comes out of a triage pass over the open PR queue. The concrete case that motivated it is #117 (Postgres connection pool leak), which sat open without any automated Go signal at all.
Type of Change
Testing
_test.goimporting an unresolvable path,go vetandgo testexit 1 whilego buildexits 0 (table above). GREEN: with the probe removed,build/vet/testall exit 0 — 1 package with tests (pkg/utils), 50 without, 0 failures.develop@706c9a4, submodule at its pinned SHA0923702. Nothing in this repository is currently failing, so the job starts green rather than importing pre-existing debt.origin/main@9337afc— the branch that carries the obfuscatedpkg/core/c0.go— and all three exit 0 with 4 test packages. Obfuscation is not an obstacle to CI.go), 5 steps, triggerspull_request+pushon[develop].event=pull_request,conclusion=success,headSha=273383c2(the commit in this PR), all six steps green in 1m37s. That settles the three items that were open when this PR was written: the cgo/libwebp build works onubuntu-latestwith noapt-get,setup-goresolved the toolchain fromgo.modwithout incident, and this fork PR ran without needing "Approve and run workflows". Cache behaviour across runs is still a single-data-point unknown — if repeat runs stay around four minutes, a manualactions/cacheis the follow-up.Screenshots (if applicable)
n/a
Checklist
Additional Notes
This is signal, not a gate, until someone enables it as one.
developcurrently reportsprotected: false,/protectionreturns 404 andrulesetsis empty. Without thegocheck marked as a required status check, a red run blocks nothing. That matters here because the repository already carries ignored red:sync-releases.ymlhas failed its last 7 runs since 2026-05-06, andmanager-v2.yml/voip-integration.ymlran 12 times onpull_requestwith 100% failure ("workflow file issue"). Thegocontext now exists and has reported success on this PR, so it can be selected as a required check right away. Doing so needs repository admin, which I do not have — I would ask a maintainer to turn it on when this merges, otherwise this becomes the fourth red nobody looks at.Out of scope, on purpose:
gofmt— 8 files ondevelopare currently unformatted (measured against the LF blobs in git, not a CRLF checkout). One of them ispkg/whatsmeow/service/whatsmeow.go, the exact file PR fix(whatsmeow): reuse a single capped sqlstore container (fixes Postgres connection leak) #117 modifies, so adding a formatting gate now would fail the PR this work is trying to unblock. The right order is: merge fix(whatsmeow): reuse a single capped sqlstore container (fixes Postgres connection leak) #117, thengofmt -wthe 8, then add the check.make check/make lint—checkrunsfmt, which rewrites files rather than verifying them, andlintinvokesgolangci-lint, which is not installed and has no.golangci.ymlin the repo (the target exits 1 by design). Either would fail every PR for tool reasons.golangci-lint, an OS/version matrix, an explicitCGO_ENABLED, a manualactions/cache— each is either already covered by defaults or needs a decision that should not ride along in this PR.🤖 Generated with Claude Code
https://claude.ai/code/session_017ijukEy5wKHnKg7NemEPk9