65 lines
1.4 KiB
YAML
65 lines
1.4 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
|
|
steps:
|
|
- uses: actions/checkout@main
|
|
- uses: actions/setup-go@main
|
|
with:
|
|
go-version: '${{ env.GO_VERSION }}'
|
|
check-latest: true
|
|
- run: |
|
|
echo ---
|
|
echo ${GOPATH}
|
|
go env GOPATH
|
|
make nonsense
|
|
echo ---
|
|
make test-lint
|
|
|
|
tests:
|
|
name: Test (go test)
|
|
runs-on: ubuntu-latest
|
|
needs: [format, 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 install)
|
|
runs-on: ubuntu-latest
|
|
needs: [tests]
|
|
steps:
|
|
- uses: actions/checkout@main
|
|
- uses: actions/setup-go@main
|
|
with:
|
|
go-version: '${{ env.GO_VERSION }}'
|
|
check-latest: true
|
|
- run: make install-cli && battlesnake --help
|