| 1 |
name: test |
| 2 |
|
| 3 |
on: |
| 4 |
pull_request: |
| 5 |
branches: ['*'] |
| 6 |
|
| 7 |
permissions: |
| 8 |
contents: read |
| 9 |
|
| 10 |
jobs: |
| 11 |
test: |
| 12 |
|
| 13 |
name: Run tests |
| 14 |
|
| 15 |
runs-on: ubuntu-latest |
| 16 |
|
| 17 |
strategy: |
| 18 |
matrix: |
| 19 |
go: ["1.19.x", "1.20.x"] |
| 20 |
include: |
| 21 |
- go: 1.20.x |
| 22 |
latest: true |
| 23 |
|
| 24 |
steps: |
| 25 |
- name: Checkout code |
| 26 |
uses: actions/checkout@v3 |
| 27 |
|
| 28 |
- name: Setup Go |
| 29 |
uses: actions/setup-go@v4 |
| 30 |
with: |
| 31 |
go-version: ${{ matrix.go }} |
| 32 |
cache-dependency-path: '**/go.sum' |
| 33 |
|
| 34 |
- name: Download dependencies |
| 35 |
run: go mod download |
| 36 |
|
| 37 |
- name: Lint |
| 38 |
if: matrix.latest |
| 39 |
run: make lint |
| 40 |
|
| 41 |
- name: Test |
| 42 |
run: make test |
| 43 |
|
| 44 |
- name: Make coverage |
| 45 |
if: matrix.latest |
| 46 |
run: make cover |
| 47 |
|
| 48 |
- name: Upload coverage to codecov.io |
| 49 |
if: matrix.latest |
| 50 |
uses: codecov/codecov-action@v3 |
| 51 |
|
| 52 |
# TODO decide whether we want to benchmark on every run. |
| 53 |
# name: Benchmark |
| 54 |
# run: make bench |