Dev #87
This file contains hidden or 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
name: CI | |
on: | |
push: | |
branches: [ main, master, develop ] | |
pull_request: | |
branches: [ main, master, develop ] | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go-version: ['1.19', '1.20', '1.21'] | |
steps: | |
- name: Set up Go ${{ matrix.go-version }} | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Cache Go modules | |
uses: actions/cache@v3 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go-${{ matrix.go-version }}- | |
- name: Download dependencies | |
run: go mod download | |
- name: Verify dependencies | |
run: go mod verify | |
- name: Build | |
run: go build -v ./... | |
- name: Run tests | |
run: go test -v -race -timeout 300s ./... | |
- name: Run tests with coverage | |
if: matrix.go-version == '1.21' | |
run: go test -v -race -coverprofile="codecov.report" -covermode=atomic -timeout 300s ./... | |
- name: Upload coverage reports to Codecov | |
if: matrix.go-version == '1.21' | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |