use go mod download rather than installing stuff manually #16
This file contains 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: test and benchmark | |
on: | |
push: | |
branches: [main] | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
branches: [main] | |
paths-ignore: | |
- '**.md' | |
jobs: | |
tests_and_benchmarks: | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest, windows-latest] | |
go: ['1.18', '1.19', '1.20'] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout the code | |
uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Get coverage/benchmark tools | |
run: go mod download | |
- name: Run tests, generate coverage | |
run: make coverage | |
- name: Benchmark | |
run: make benchdata-gen | |
- name: Install goveralls | |
run: go install github.com/mattn/goveralls | |
- name: Send coverage | |
env: | |
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: goveralls -coverprofile=artifacts/c.out -service=github | |
- name: Get short hash | |
id: vars | |
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- name: Upload benchmark artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ format('benchmarks-{0}-{1}-{2}.json', steps.vars.outputs.sha_short, runner.os, matrix.go) }} | |
path: benchmarks.json |