Improve test matrix comprehensiveness #14
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, ubuntu, windows] | |
cgo-enabled: [0, 1] | |
tags: | |
- '' # Default behavior | |
- 'go1.22' # Unsupported (too new) Go version | |
- 'datadog.no_waf' # Explicit WAF disable | |
runs-on: ${{ matrix.runs-on }}-latest | |
name: ${{ matrix.runs-on }} CGO=${{ 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 }}-${{ matrix.tags }}.gocov \ | |
-covermode=atomic \ | |
./... | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: coverprofiles | |
path: coverage/*.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-tree-map.svg | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-tree-map.svg | |
path: coverage-tree-map.svg |