mirror of
https://github.com/luxfi/utxo.git
synced 2026-07-27 03:39:23 +00:00
79 lines
1.7 KiB
YAML
79 lines
1.7 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, dev]
|
|
pull_request:
|
|
branches: [main, dev]
|
|
|
|
env:
|
|
GO_VERSION: '1.26.3'
|
|
CGO_ENABLED: '0'
|
|
|
|
jobs:
|
|
test:
|
|
name: Test
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest]
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Cache Go modules
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ~/go/pkg/mod
|
|
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-go-
|
|
|
|
- name: Verify go.mod is tidy
|
|
run: |
|
|
go mod tidy
|
|
if [ -n "$(git status --porcelain go.mod go.sum)" ]; then
|
|
echo "go.mod / go.sum not tidy"
|
|
git diff go.mod go.sum
|
|
exit 1
|
|
fi
|
|
|
|
- name: go vet
|
|
run: go vet ./...
|
|
|
|
- name: go test
|
|
run: go test -race -count=1 -timeout 5m ./...
|
|
|
|
- name: go test (coverage)
|
|
run: go test -count=1 -timeout 5m -cover -coverprofile=coverage.out ./...
|
|
|
|
- name: Upload coverage
|
|
if: matrix.os == 'ubuntu-latest'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: utxo-coverage
|
|
path: coverage.out
|
|
retention-days: 30
|
|
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
- name: Run golangci-lint
|
|
uses: golangci/golangci-lint-action@v8
|
|
with:
|
|
version: v2.1.6
|
|
install-mode: goinstall
|
|
args: --timeout=10m
|