CI: add coverage, static analysis, cross-builds

This commit is contained in:
lab-code-heavy
2026-02-23 21:10:35 -06:00
committed by shadowmo
parent d4e3b37e91
commit bca500623b

View File

@@ -2,16 +2,21 @@ name: CI
on: on:
push: push:
branches: [ main, work/review ] branches: [ main, work/review ]
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
go: ['1.20']
os: ['ubuntu-latest']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v4 uses: actions/setup-go@v4
with: with:
go-version: '1.20' go-version: ${{ matrix.go }}
- name: Cache Go modules - name: Cache Go modules
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
@@ -28,7 +33,26 @@ jobs:
gofmt_out=$(gofmt -l . | wc -l); if [ "$gofmt_out" -ne "0" ]; then echo "gofmt needs to be run"; gofmt -w .; exit 1; fi gofmt_out=$(gofmt -l . | wc -l); if [ "$gofmt_out" -ne "0" ]; then echo "gofmt needs to be run"; gofmt -w .; exit 1; fi
- name: Vet - name: Vet
run: go vet ./... run: go vet ./...
- name: Build - name: Static analysis (golangci-lint)
uses: golangci/golangci-lint-action@v4
with:
version: 'v1.59.0'
- name: Build (amd64)
run: make build run: make build
- name: Cross build (linux/arm64)
run: |
GOOS=linux GOARCH=arm64 go build -o bin/arm64 ./...
- name: Test - name: Test
run: make test run: make test
- name: Coverage
run: |
go test -coverprofile=coverage.out ./... || true
go tool cover -func=coverage.out | sed -n '1,200p'
release-checks:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
- name: Echo OK
run: echo "build and tests passed"