Skip to content

Improve test matrix comprehensiveness #11

Improve test matrix comprehensiveness

Improve test matrix comprehensiveness #11

Workflow file for this run

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 }}.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