Files
pop/.github/workflows/ci.yml
Michael Freno 3e9edc2ae1
Some checks are pending
CI / build (1.23.x) (push) Waiting to run
CI / security-scan (push) Waiting to run
Fix Go version matrix and coverage calculation portability
P0: Update Go version matrix from [1.21.x, 1.22.x] to [1.23.x] to match go.mod (go 1.23.0)
P0: Update security-scan Go version from 1.21.x to 1.23.x
P1: Replace grep -oP with portable awk for coverage threshold calculation

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-05-14 00:40:43 -04:00

71 lines
1.6 KiB
YAML

name: CI
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: [1.23.x]
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Cache Go modules
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-
- name: Download dependencies
run: go mod download
- name: Build
run: go build -v ./...
- name: Test with coverage and enforce threshold
run: |
go test -v -race -coverprofile=coverage.out -covermode=atomic ./... 2>&1
go test -cover ./... 2>&1 | awk '/^ok/ {split($NF,a,"%"); if (a[1]+0 < 80) {print "Coverage " a[1] "% is below 80% threshold"; exit 1} else print "Coverage " a[1] "% meets 80% threshold"}'
- name: Upload coverage report
uses: codecov/codecov-action@v4
with:
files: ./coverage.out
flags: unittests
name: codecov-pop
- name: Lint
run: |
go vet ./...
test -z $(gofmt -l .)
security-scan:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23.x
- name: Run GoSec
uses: securego/gosec@v2
with:
args: ./...