1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
name: Go
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
# Test the latest go version
# and upload the test coverage.
test_latest:
name: Go latest stable
runs-on: ubuntu-latest
steps:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: 'stable'
check-latest: true
- name: Checkout code
uses: actions/checkout@v4
- name: Build
run: go build -v .
- name: Test
run: go test ./... -v -race -coverprofile=coverage.txt -covermode=atomic
# - uses: codecov/codecov-action@v4
# with:
# files: ./coverage.txt
# token: ${{ secrets.CODECOV_TOKEN }}
# Test the latest three golang version
# on different operating systems.
test_versions:
strategy:
matrix:
go: ['1.22']
os: [ubuntu-latest, macos-latest, windows-latest]
name: Go ${{ matrix.go }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Checkout code
uses: actions/checkout@v4
- name: Test
run: go test ./... -v -race -cover
|