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.
30 lines
636 B
Bash
Executable File
30 lines
636 B
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# check.sh runs every verification step required before a change can land.
|
|
# `.gitea/workflows/ci.yml` invokes it on every pull request and every push to
|
|
# main, so this script is the single source of truth for what "CI passed" means.
|
|
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "${BASH_SOURCE[0]}")/.."
|
|
|
|
echo '==> 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 ./...
|