55 lines
1.2 KiB
YAML
55 lines
1.2 KiB
YAML
name: PR checks
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
pull_request:
|
|
|
|
env:
|
|
GO_VERSION: 1.18.x
|
|
|
|
jobs:
|
|
go-mod:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
- name: Check go mod
|
|
run: |
|
|
go mod tidy
|
|
git diff --exit-code go.mod
|
|
golangci-lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ${{ env.GO_VERSION }}
|
|
- name: Run golangci-lint
|
|
uses: golangci/golangci-lint-action@v3
|
|
with:
|
|
version: v1.46
|
|
|
|
tests:
|
|
strategy:
|
|
matrix:
|
|
go: [ 1.18.x ]
|
|
platform: [ ubuntu-latest ]
|
|
runs-on: ${{ matrix.platform }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Install Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ${{ matrix.go }}
|
|
- name: Run go vet
|
|
run: go vet ./...
|
|
- name: Run go build
|
|
run: go build
|
|
- name: Run tests
|
|
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...
|