ci: Show test report in github actions #22
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: Build+Test | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go-version: [ '1.21.6' ] | |
steps: | |
- name: Setup Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
- name: install go-junit-report | |
run: go install github.com/jstemmer/go-junit-report/v2@latest | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: go get . | |
- name: Test with Go | |
run: | | |
pushd . | |
cd sqlite | |
./setup.sh | |
file="`pwd`/db/test.db" # relative path hack with pwd, otherwise not resolved. | |
popd | |
go clean -testcache | |
go test -json sse_test.go \ | |
--driver=sqlite \ | |
--display-name=testing-flags \ | |
--live=true \ | |
--listen-on-port=9999 \ | |
--sqlite-file="$file" \ | |
2>&1 | go-junit-report -parser gojson -iocopy -out results-sqlite-flags-${{ matrix.go-version }}.xml | |
- name: Upload Go test results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Go-results-${{ matrix.go-version }} | |
path: TestResults-${{ matrix.go-version }}.json | |
- name: Test Report | |
uses: dorny/test-reporter@v1 | |
if: success() || failure() # run this step even if previous step failed | |
with: | |
name: Tests # Name of the check run which will be created | |
path: results-*.xml # Path to test results | |
reporter: jest-junit # Format of test results |