2022-03-15 21:32:05 +01:00
|
|
|
name: Codecov workflow
|
2022-03-15 21:29:26 +01:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2022-03-15 21:30:51 +01:00
|
|
|
- main
|
2022-03-15 21:29:26 +01:00
|
|
|
paths:
|
|
|
|
- '**.go'
|
|
|
|
- 'go.*'
|
|
|
|
- '.github/**'
|
|
|
|
- 'codecov.yml'
|
|
|
|
pull_request:
|
|
|
|
branches:
|
2022-03-15 21:30:51 +01:00
|
|
|
- main
|
2022-03-15 21:29:26 +01:00
|
|
|
paths:
|
|
|
|
- '**.go'
|
|
|
|
- 'go.*'
|
|
|
|
- '.github/**'
|
|
|
|
- 'codecov.yml'
|
|
|
|
jobs:
|
|
|
|
run:
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
2022-03-15 21:57:50 +01:00
|
|
|
go: [1.15, 1.16, 1.17, 1.18]
|
2022-03-15 21:29:26 +01:00
|
|
|
steps:
|
2022-03-15 21:40:04 +01:00
|
|
|
- name: Checkout Code
|
|
|
|
uses: actions/checkout@master
|
|
|
|
|
|
|
|
- name: Run Tests
|
|
|
|
run: |
|
2022-03-15 21:41:24 +01:00
|
|
|
go test -race --coverprofile=coverage.coverprofile --covermode=atomic ./...
|
2022-03-15 21:40:04 +01:00
|
|
|
|
|
|
|
- name: Upload coverage to Codecov
|
2022-03-15 21:58:57 +01:00
|
|
|
if: success() && matrix.go == 1.18 && matrix.os == 'ubuntu-latest'
|
2022-03-15 21:40:04 +01:00
|
|
|
uses: codecov/codecov-action@v2
|
2022-03-15 21:29:26 +01:00
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
|