Skip to content

Update test workflow #69

Update test workflow

Update test workflow #69

Workflow file for this run

name: test
on: [push, pull_request]
env:
GOPATH: ${{ github.workspace }}
WORKSPACE: ${{ github.workspace }}/src/github.com/${{ github.repository }}
jobs:
test:
defaults:
run:
working-directory: ${{ env.WORKSPACE }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
go: ['1.19', '1.20', '1.21']
name: ${{ matrix.os }} @ Go ${{ matrix.go }}
runs-on: ${{ matrix.os }}
steps:
- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}
- name: Cache
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Checkout
uses: actions/checkout@v3
with:
path: ${{ env.WORKSPACE }}
- name: Build
run: go build -v ./...
- name: Test
run: sh testdata/test.sh
- name: Upload coverage to Codecov
if: success() && matrix.go == '1.21' && matrix.os == 'windows-latest'
uses: codecov/codecov-action@v1
with:
token:
fail_ci_if_error: false
working-directory: ${{ env.WORKSPACE }}
lint:
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: ${{ env.WORKSPACE }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v2
with:
version: latest
working-directory: ${{ env.WORKSPACE }}