62 lines
1.3 KiB
YAML
62 lines
1.3 KiB
YAML
name: Test
|
|
|
|
on:
|
|
push: # Branch pushes only, not tags
|
|
branches:
|
|
- '**'
|
|
pull_request:
|
|
workflow_call: # Allow other workflows to call this one
|
|
|
|
env:
|
|
GO_VERSION: '1.20'
|
|
|
|
jobs:
|
|
|
|
format:
|
|
name: Format (gofmt)
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@main
|
|
- uses: actions/setup-go@main
|
|
with:
|
|
go-version: '${{ env.GO_VERSION }}'
|
|
check-latest: true
|
|
- run: make test-format
|
|
|
|
lint:
|
|
name: Lint (golangci-lint)
|
|
runs-on: ubuntu-latest
|
|
needs: [format]
|
|
steps:
|
|
- uses: actions/checkout@main
|
|
- uses: actions/setup-go@main
|
|
with:
|
|
go-version: '${{ env.GO_VERSION }}'
|
|
check-latest: true
|
|
- run: make test-lint
|
|
|
|
test:
|
|
name: Tests (go test)
|
|
runs-on: ubuntu-latest
|
|
needs: [lint]
|
|
steps:
|
|
- uses: actions/checkout@main
|
|
- uses: actions/setup-go@main
|
|
with:
|
|
go-version: '${{ env.GO_VERSION }}'
|
|
check-latest: true
|
|
- run: make test-unit
|
|
|
|
build-cli:
|
|
name: Build CLI (go build)
|
|
runs-on: ubuntu-latest
|
|
needs: [lint]
|
|
steps:
|
|
- uses: actions/checkout@main
|
|
- uses: actions/setup-go@main
|
|
with:
|
|
go-version: '${{ env.GO_VERSION }}'
|
|
check-latest: true
|
|
- run: |
|
|
make build-cli
|
|
battlesnake --help
|