.github/workflows/go.yml
name: Go
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
# lint all the things
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: '1.20'
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
build:
name: Build
runs-on: ubuntu-latest
needs: [golangci]
steps:
- name: Set up Go 1.x
uses: actions/setup-go@v3
with:
go-version: ^1.20
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Get dependencies
run: go get -v -t -d ./...
- name: Build
run: go build -v .
# Run testing on the code
- name: Run testing
run: go test -coverprofile=c.out ./...
- name: Publish code coverage
uses: paambaati/codeclimate-action@v3.2.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CODE_CLIMATE_TEST_REPORTER_ID }}
with:
# This tool doesn't appear to work with Go modules?
prefix: github.com/jabley/elb-pruner
coverageLocations: |
${{github.workspace}}/*.out:gocov