use test matrix to test different go versions #82
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
name: test and build | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.x | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: v1.52.2 | |
- name: Run linters | |
run: | | |
export PATH=$PATH:$(go env GOPATH)/bin | |
./pre-commit | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
goversion: [1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.21] | |
steps: | |
- name: Install Go | |
if: success() | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.goversion }} | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Run tests | |
run: | | |
go version | |
make test | |
inttest: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
buildversion: [1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.21] | |
testversion: [1.15, 1.16, 1.17, 1.18, 1.19, 1.20, 1.21] | |
steps: | |
- name: Install Go | |
if: success() | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.buildversion }} | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Build binary for inttest | |
run: | | |
go version | |
GO111MODULE=on make build-linux | |
- name: Install Go | |
if: success() | |
uses: actions/setup-go@v1 | |
with: | |
go-version: ${{ matrix.testversion }} | |
- name: Integration test | |
run: | | |
go version | |
make inttest | |
build: | |
runs-on: ubuntu-latest | |
needs: [lint, test, inttest] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.21 | |
- name: build | |
run: | | |
go version | |
make build-linux | |
make build-windows | |
make build-darwin | |
- name: upload artifacts | |
uses: actions/upload-artifact@master | |
with: | |
name: bin | |
path: bin/ |