Improve test matrix comprehensiveness #8
Workflow file for this run
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: 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] | |
tags: | |
- '' # Default behavior | |
- 'go1.99' # Distant future, will likely forever be unsupported | |
- 'datadog.no_waf' # Explicit WAF disable | |
runs-on: ${{ matrix.runs-on }} | |
name: Test (${{ matrix.runs-on }}, CGO_ENABLED=${{ matrix.cgo-enabled }}, -tags="${{ matrix.tags }}") | |
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 | |
env: | |
CGO_ENABLED: ${{ matrix.cgo-enabled }} | |
shell: bash # Also on Windows!! | |
run: |- | |
mkdir -p coverage | |
gotestsum -- -tags='${{ matrix.tags }}' \ | |
-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 }}-${{ matrix.tags }}.gocov | |
report: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v4 | |
- 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: gocovmerge *.gocov > full-coverage.gocov | |
- name: Generate Tree Map | |
run: go-cover-treemap -coverprofile full-coverage.gocov > coverage.svg | |
- name: Create report | |
run: |- | |
echo "## Coverage Report" >> $GITHUB_STEP_SUMMARY | |
cat coverage.svg >> $GITHUB_STEP_SUMMARY |