support for nil and invalid value in the encoding tree #614
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: Test | |
on: | |
workflow_dispatch: # manually | |
schedule: # nightly | |
- cron: "0 0 * * *" | |
pull_request: # on pull requests touching appsec files | |
push: # on push to the main branch | |
branches: | |
- main | |
env: | |
DD_APPSEC_WAF_TIMEOUT: 5s | |
jobs: | |
native: | |
strategy: | |
fail-fast: false | |
matrix: | |
runs-on: [ macos-13, macos-12, macos-11, ubuntu-22.04, ubuntu-20.04, windows-latest ] | |
go-version: [ "1.21", "1.20", "1.19" ] | |
cgo_enabled: [ "0", "1" ] # test it compiles with and without cgo | |
include: | |
- env: | |
GODEBUG=cgocheck=2 | |
- go-version: "1.21" | |
env: | |
GOEXPERIMENT=cgocheck2 | |
runs-on: ${{ matrix.runs-on }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ matrix.go-version }} | |
cache: true | |
- name: go test | |
shell: bash | |
run: | | |
# Install gotestsum | |
env GOBIN=$PWD go install gotest.tools/gotestsum@latest | |
# Run the tests with gotestsum | |
env ${{ matrix.env }} CGO_ENABLED=${{ matrix.cgo_enabled }} ./gotestsum -- -v -count=10 -shuffle=on ./... | |
# Same tests but on the official golang container for linux | |
golang-linux-container: | |
runs-on: ubuntu-latest | |
container: | |
image: golang:${{ matrix.go-version }}-${{ matrix.distribution }} | |
strategy: | |
fail-fast: false | |
matrix: | |
go-version: [ "1.21", "1.20", "1.19" ] | |
distribution: [ bookworm, bullseye, buster, alpine ] | |
cgo_enabled: [ "0", "1" ] # test it compiles with and without cgo | |
exclude: | |
- go-version: 1.18 | |
distribution: bookworm | |
- go-version: 1.21 | |
distribution: buster | |
steps: | |
- uses: actions/checkout@v3 | |
# Install gcc and the libc headers on alpine images | |
- if: ${{ matrix.distribution == 'alpine' }} | |
run: apk add gcc musl-dev libc6-compat | |
- name: Go modules cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/go/pkg/mod | |
key: go-pkg-mod-${{ hashFiles('**/go.sum') }} | |
restore-keys: go-pkg-mod- | |
- name: go test | |
run: | | |
# Install gotestsum | |
env GOBIN=$PWD go install gotest.tools/gotestsum@latest | |
# Run the tests with gotestsum | |
env CGO_ENABLED=${{ matrix.cgo_enabled }} ./gotestsum -- -v -count=10 -shuffle=on ./... | |
linux-other: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
arch: ["arm64"] | |
cgo_enabled: [ "0", "1" ] # test it compiles with and without the cgo | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Go modules cache | |
uses: actions/cache@v3 | |
with: | |
path: ~/go/pkg/mod | |
key: go-pkg-mod-${{ matrix.arch }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: go-pkg-mod-${{ matrix.arch }} go-pkg-mod- | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: ${{ matrix.arch }} | |
- run: docker run --platform=linux/${{ matrix.arch }} -v${HOME}/go/pkg/mod:/root/go/pkg/mod -v $PWD:$PWD -w $PWD -eCGO_ENABLED=${{ matrix.cgo_enabled }} -eDD_APPSEC_WAF_TIMEOUT=$DD_APPSEC_WAF_TIMEOUT golang go test -v -count=10 -shuffle=on ./... | |
# A simple join target to simplify setting up branch protection settings in GH. | |
done: | |
name: Done | |
runs-on: ubuntu-latest | |
needs: | |
- native | |
- golang-linux-container | |
- linux-other | |
steps: | |
- name: Done | |
run: echo "Done!" |