mirror of
https://github.com/boolean-maybe/tiki
synced 2026-04-21 13:37:20 +00:00
94 lines
1.9 KiB
YAML
94 lines
1.9 KiB
YAML
name: Go
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
pull_request:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
test:
|
|
name: Test
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
go-version: ['1.25.x']
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: ${{ matrix.go-version }}
|
|
cache: true
|
|
|
|
- name: Download dependencies
|
|
run: go mod download
|
|
|
|
- name: Verify dependencies
|
|
run: go mod verify
|
|
|
|
- name: Run tests with race detection
|
|
shell: bash
|
|
run: go test -v -race ./...
|
|
|
|
- name: Run tests with coverage
|
|
if: matrix.os == 'ubuntu-latest'
|
|
shell: bash
|
|
run: |
|
|
pkgs=$(go list -f '{{if .TestGoFiles}}{{.ImportPath}}{{end}}' ./...)
|
|
go test -coverprofile=coverage.out -covermode=atomic $pkgs
|
|
|
|
- name: Upload coverage to Codecov
|
|
if: matrix.os == 'ubuntu-latest' && matrix.go-version == '1.25.x'
|
|
uses: codecov/codecov-action@v5
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
files: ./coverage.out
|
|
flags: unittests
|
|
fail_ci_if_error: false
|
|
|
|
lint:
|
|
name: Lint
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.25.x'
|
|
cache: true
|
|
|
|
- name: Run golangci-lint
|
|
uses: golangci/golangci-lint-action@v7
|
|
with:
|
|
version: v2.11.3
|
|
args: --timeout=5m
|
|
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.25.x'
|
|
cache: true
|
|
|
|
- name: Build
|
|
run: go build -v .
|
|
|
|
- name: Check go mod tidiness
|
|
run: |
|
|
go mod tidy
|
|
git diff --exit-code go.mod go.sum
|