Skip to content

ci: roda go build, vet e test nos pull requests para a develop - #209

Merged
gomessguii merged 1 commit into
developfrom
ci/go-build-vet-test
Oct 1, 2026
Merged

gomessguii merged 1 commit into
developfrom
ci/go-build-vet-test

Conversation

@gomessguii

@gomessguii gomessguii commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Descrição

Reabre o #198 a partir de uma branch do repositório da organização, com o mesmo commit (273383c), para que a mudança não dependa de um fork. O conteúdo não mudou: a discussão completa e as medições continuam no #198.

Adiciona .github/workflows/ci.yml, que roda go build ./..., go vet ./... e go test ./... em todo pull request com base develop (e em push na develop).

Hoje nenhum workflow do repositório dispara em pull_request: nenhum pull request é compilado por automação antes da revisão.

Por que go vet, e não só go build. O go build nunca compila arquivos _test.go. Medido na develop @ 706c9a4, com um arquivo de teste importando um caminho que não resolve: go build ./... sai com 0, go vet ./... e go test ./... saem com 1. O vet é o passo que pega o erro mais comum em contribuição externa.

Por que só develop. develop e main não têm ancestral comum neste repositório, então um workflow adicionado na develop nunca existiria na main. Por isso este workflow cobre só os pull requests com base develop.

Card relacionado

CRM-405

Tipo de mudança

  • CI / infraestrutura do repositório. Nenhum código da aplicação muda.

Testes

  • Nas duas direções, localmente: com o _test.go quebrado, vet e test reprovam e build passa; sem ele, os três passam (1 pacote com teste, 50 sem, 0 falhas).
  • Na develop @ 706c9a4 o job nasce verde, sem dívida herdada.
  • Em runner real, pelo ci: run go build, vet and test on pull requests to develop #198: run do CI, event=pull_request, conclusion=success, no commit 273383c. O build com cgo/libwebp funciona no ubuntu-latest sem apt-get, e o setup-go resolve o toolchain pelo go.mod.

Fora de escopo, de propósito

  • gofmt: há 8 arquivos fora do padrão na develop hoje; o check entra depois que eles forem formatados.
  • make check (o alvo fmt reescreve arquivos) e make lint (golangci-lint não está instalado e não há .golangci.yml).
  • Matriz de sistema operacional ou de versão, CGO_ENABLED explícito e actions/cache manual.

Depois do merge

O check go será marcado como obrigatório na develop. Sem isso, um run vermelho não bloqueia nada.

Summary by Sourcery

CI:

  • Add a CI workflow that runs Go build, vet, and test checks for pull requests targeting develop and pushes to develop, with submodule-aware checkout and toolchain setup from go.mod.

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
@sourcery-ai

sourcery-ai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementa CI automatizado para a branch develop, cobrindo build, vet e testes Go; o checkout inclui submódulos e o toolchain é derivado do go.mod, com execução otimizada por cancelamento de runs concorrentes.

Sequence diagram for the develop CI workflow

sequenceDiagram
    participant GitHub
    participant CI as CI Workflow
    participant Runner as Ubuntu Runner
    participant Go as Go Toolchain

    GitHub->>CI: pull_request to develop
    GitHub->>CI: push to develop
    CI->>CI: Cancel previous run for ci-${github.ref}
    CI->>Runner: actions/checkout@v4 with recursive submodules
    Runner->>Go: actions/setup-go@v5 using go.mod
    Go-->>Runner: Configured toolchain
    Runner->>Go: go build ./...
    Runner->>Go: go vet ./...
    Runner->>Go: go test ./...
    Go-->>CI: Job success or failure
Loading

File-Level Changes

Change Details Files
Adiciona um workflow de CI para validar o código Go em pull requests destinados à develop e em pushes na própria branch.
  • Dispara em pull requests para develop e pushes em develop.
  • Executa em ubuntu-latest com cancelamento de execuções concorrentes por referência.
  • Faz checkout recursivo para incluir o submódulo exigido pelo replace do go.mod.
  • Configura o toolchain a partir da versão declarada no go.mod.
  • Executa go build ./..., go vet ./... e go test ./... em sequência.
.github/workflows/ci.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@gomessguii
gomessguii merged commit 7f79240 into develop Oct 1, 2026
3 checks passed
@gomessguii
gomessguii deleted the ci/go-build-vet-test branch October 1, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants