cleanup and more test coverage #58
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 | |
on: [push, pull_request] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go: ["1.19", "1.23"] | |
name: Test on Go ${{ matrix.go }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: ${{ matrix.go }} | |
- run: go version | |
- name: Setup Chrome | |
uses: browser-actions/setup-chrome@latest | |
- run: chrome --version | |
- name: Run tests | |
run: | | |
chrome --headless --disable-gpu --remote-debugging-port=9222 --disable-setuid-sandbox --no-sandbox about:blank & | |
chrome_pid=$! | |
go list -f '{{if len .TestGoFiles}}-coverprofile={{.Name}}_coverage.out {{.ImportPath}}{{end}}' ./... | xargs -L1 go test -race -covermode=atomic | |
go test ./session -browser -race -covermode=atomic -coverprofile=session_coverage.out | |
go test . -browser | |
kill -9 $chrome_pid | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
verbose: true |