ci: add Gitea Actions workflow for test, vet, fmt, build, shellcheck, goreleaser check
This commit is contained in:
52
.gitea/workflows/ci.yml
Normal file
52
.gitea/workflows/ci.yml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
name: ci
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: archlinux:latest
|
||||||
|
steps:
|
||||||
|
- name: Install container prereqs
|
||||||
|
run: pacman -Sy --needed --noconfirm base-devel git shellcheck
|
||||||
|
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v5
|
||||||
|
with:
|
||||||
|
go-version-file: go.mod
|
||||||
|
cache: true
|
||||||
|
|
||||||
|
- name: go vet
|
||||||
|
run: go vet ./...
|
||||||
|
|
||||||
|
- name: gofmt check
|
||||||
|
run: |
|
||||||
|
diff=$(gofmt -l .)
|
||||||
|
if [ -n "$diff" ]; then
|
||||||
|
echo "files need gofmt:"
|
||||||
|
echo "$diff"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: go build
|
||||||
|
run: go build ./...
|
||||||
|
|
||||||
|
- name: go test -race
|
||||||
|
run: go test -race ./...
|
||||||
|
|
||||||
|
- name: shellcheck bootstrap.sh
|
||||||
|
run: shellcheck bootstrap.sh
|
||||||
|
|
||||||
|
- name: Install goreleaser
|
||||||
|
run: go install github.com/goreleaser/goreleaser/v2@latest
|
||||||
|
|
||||||
|
- name: goreleaser check
|
||||||
|
run: $(go env GOPATH)/bin/goreleaser check
|
||||||
Reference in New Issue
Block a user