From 1fbb05339c52c9263848f248fc80d6e83ae0cd7b Mon Sep 17 00:00:00 2001 From: software-maintainer Date: Wed, 28 Oct 2026 07:45:30 +0000 Subject: [PATCH] Upgrade Go toolchain pins and add Gitea Actions CI checks Bump the go directive and mise tool pin to Go 1.27.1, the newest toolchain available in the build environment; module versions already resolve to the newest releases present in the pinned module cache. Add .gitea/workflows/ci.yml, which runs on every pull request and every push to main and invokes scripts/check.sh (gofmt, go mod verify, go vet, go build, go test -cover). Also cover the Gitea client token/slug handling with unit tests and document the CI workflow. Add the mise check task so the CI checks can be run locally. --- .gitea/workflows/ci.yml | 23 ++++++++ docs/workflow.md | 24 ++++++++- go.mod | 2 +- internal/gitea/gitea_test.go | 100 +++++++++++++++++++++++++++++++++++ mise.toml | 6 ++- scripts/check.sh | 29 ++++++++++ 6 files changed, 181 insertions(+), 3 deletions(-) create mode 100644 .gitea/workflows/ci.yml create mode 100644 internal/gitea/gitea_test.go create mode 100755 scripts/check.sh diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..eac1fae --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,23 @@ +name: ci + +on: + pull_request: + push: + branches: [main] + +jobs: + check: + name: build and test + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + cache: false + + - name: Run checks + run: ./scripts/check.sh diff --git a/docs/workflow.md b/docs/workflow.md index 90b4c25..52bc521 100644 --- a/docs/workflow.md +++ b/docs/workflow.md @@ -18,6 +18,28 @@ It works with any project type and supports monorepos. --- +## Continuous Integration + +Every pull request and every push to `main` runs the `ci` workflow in +[`.gitea/workflows/ci.yml`](../.gitea/workflows/ci.yml). Its single `check` job +runs [`scripts/check.sh`](../scripts/check.sh), which: + +1. fails if any Go file is not `gofmt`-formatted, +2. runs `go mod verify` to confirm the dependency modules match `go.sum`, +3. runs `go vet ./...` and `go build ./...`, +4. runs `go test -cover ./...`. + +Run the same checks locally with: + +```sh +./scripts/check.sh +``` + +The job fails when any check fails, so a pull request cannot land with broken +code or tests. + +--- + ## Two Release Workflows ### Direct release @@ -483,4 +505,4 @@ Tag format: `@v` for monorepos (e.g. `my-app@v1.3.0`), or `v gofmt' +unformatted="$(gofmt -l .)" +if [ -n "$unformatted" ]; then + echo 'These files are not gofmt-formatted:' >&2 + printf '%s\n' "$unformatted" >&2 + exit 1 +fi + +echo '==> go mod verify' +go mod verify + +echo '==> go vet' +go vet ./... + +echo '==> go build' +go build ./... + +echo '==> go test' +go test -cover ./...