From c1b679c2d958b3f56a5c052ecff6bb92d31da028 Mon Sep 17 00:00:00 2001 From: GNocent <154062033+gnocent@users.noreply.github.com> Date: Thu, 22 Oct 2026 08:59:51 +0200 Subject: [PATCH] Check formatting, vet and tests on every pull request A GitHub Actions workflow runs go vet and go test on Linux, Windows and macOS, the three platforms the release binaries are built for, on each pull request (merged into main) and each push to main; gofmt is checked on Linux, where files are checked out with LF line endings. Linux runs the tests Windows skips: Unix access rights, tools/testclusters.sh. The integration tests, which need the real clusters, and govulncheck, run before building a release, stay manual. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 48 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a2c7bfb --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,48 @@ +# Checks every pull request, on the result of its merge into main, and every +# push to main: formatting, go vet and the unit tests, on the three platforms +# the release binaries are built for. Linux also runs the tests Windows skips +# (Unix access rights, tools/testclusters.sh). +# +# Not run here: the integration tests (-tags integration), which need the +# real clusters started by tools/testclusters.sh, and govulncheck, which is +# run before building a release. +name: CI + +on: + push: + branches: [main] + pull_request: + +permissions: + contents: read + +jobs: + test: + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} + steps: + # Actions pinned to a commit: a tag can be moved to other code. + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + # Installs the Go of go.mod's toolchain line, the one the release + # binaries are built with. + - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 + with: + go-version-file: go.mod + # On Linux only: Windows checks the files out with CRLF line endings, + # which gofmt would report in every file. + - name: gofmt + if: runner.os == 'Linux' + run: | + unformatted="$(gofmt -l .)" + if [ -n "$unformatted" ]; then + echo "Not formatted with gofmt:" + echo "$unformatted" + exit 1 + fi + - run: go vet ./... + - run: go test ./...