Skip to content

Improve test matrix comprehensiveness #2

Improve test matrix comprehensiveness

Improve test matrix comprehensiveness #2

Workflow file for this run

name: Test Coverage
on:
pull_request:
push:
branches:
- main
env:
DD_APPSEC_WAF_TIMEOUT: 5s
jobs:
test:
strategy:
fail-fast: true
matrix:
runs-on: [macos-latest, ubuntu-latest, windows-latest]
cgo-enabled: [0, 1]
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
cache: true
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: go test
shell: base
env:
CGO_ENABLED: ${{ matrix.cgo-enabled }}
run: |-
go run gotest.tools/gotestsum@latest -- \
-v -shuffle=on \
-coverprofile coverage/${{ matrix.runs-on }}-${{ matrix.cgo-enabled }}.gocov \
-covermode atomic \
./...
- uses: actions/upload-artifact@v3
with:
name: coverprofiles
path: coverage/${{ matrix.runs-on }}-${{ matrix.cgo-enabled }}.gocov
report:
needs: test
runs-on: ubuntu-latest
steps:
- name: Install gocovmerge
run: go install go.shabbyrobe.org/gocovmerge/cmd/gocovmerge@latest
- name: Install go-cover-treemap
run: go install github.com/nikolaydubina/go-cover-treemap@latest
- uses: actions/download-artifact@v3
with:
name: coverprofiles
- name: Merge all profiles
run: go run go.shabbyrobe.org/gocovmerge/cmd/gocovmerge@latest coverage-*.gocov > full-coverage.gocov
- name: Generate Tree Map
run: go run github.com/nikolaydubina/go-cover-treemap@latest -coverprofile full-coverage.gocov > coverage.svg
- name: Create report
run: |-
echo "## Coverage Report" >> $GITHUB_STEP_SUMMARY
echo coverage.svg >> $GITHUB_STEP_SUMMARY