Files
bc-netts-energy/.github/workflows/ci.yaml
2025-11-03 19:26:48 +08:00

44 lines
898 B
YAML

name: CI
on:
push:
branches: [ main, master ]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.24"
- name: Go module cache
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Check formatting
run: |
gofmt -l . | tee /tmp/gofmt.txt
if [ -s /tmp/gofmt.txt ]; then
echo "The following files need gofmt:"
cat /tmp/gofmt.txt
exit 1
fi
- name: Go vet
run: go vet ./...
- name: Run tests
run: go test ./...