-
Notifications
You must be signed in to change notification settings - Fork 441
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.github/workflows: cherrypick changes from v2-dev for v2 nightly CI (#…
…2382) Co-authored-by: Ahmed Mezghani <[email protected]>
- Loading branch information
Showing
8 changed files
with
91 additions
and
26 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# This script is used to test the contrib submodules in the apps directory. | ||
# It is run by the GitHub Actions CI workflow defined in | ||
# .github/workflows/appsec.yml. | ||
|
||
echo "Running appsec tests for:" | ||
echo " V2_BRANCH=$V2_BRANCH" | ||
echo " GODEBUG=$GODEBUG" | ||
echo " GOEXPERIMENT=$GOEXPERIMENT" | ||
echo " CGO_ENABLED=$CGO_ENABLED" | ||
echo " DD_APPSEC_ENABLED=$DD_APPSEC_ENABLED" | ||
echo " DD_APPSEC_WAF_TIMEOUT=$DD_APPSEC_WAF_TIMEOUT" | ||
|
||
function gotestsum_runner() { | ||
report=$1; shift | ||
gotestsum --junitfile "$report" -- -v "$@" | ||
} | ||
|
||
function docker_runner() { | ||
# ignore the first argument, which is the JUnit report | ||
shift | ||
docker run --platform=$PLATFORM -v $PWD:$PWD -w $PWD -eCGO_ENABLED=$CGO_ENABLED -eDD_APPSEC_ENABLED=$DD_APPSEC_ENABLED -eDD_APPSEC_WAF_TIMEOUT=$DD_APPSEC_WAF_TIMEOUT golang go test -v "$@" | ||
} | ||
|
||
runner="gotestsum_runner" | ||
if [[ "$1" == "docker" ]]; then | ||
runner="docker_runner"; shift | ||
PLATFORM=$1 | ||
[[ -z "$PLATFORM" ]] && PLATFORM="linux/arm64" | ||
fi | ||
|
||
$runner "$JUNIT_REPORT.xml" ./appsec/... ./internal/appsec/... | ||
|
||
SCOPES=("gin-gonic/gin" "google.golang.org/grpc" "net/http" "gorilla/mux" "go-chi/chi" "go-chi/chi.v5" "labstack/echo.v4") | ||
for SCOPE in "${SCOPES[@]}"; do | ||
contrib=$(basename "$SCOPE") | ||
if [[ "$V2_BRANCH" == "true" ]]; then | ||
cd "./v2/contrib/$SCOPE" | ||
$runner "$JUNIT_REPORT.$contrib.xml" . | ||
cd - | ||
else | ||
$runner "$JUNIT_REPORT.$contrib.xml" "./contrib/$SCOPE/..." | ||
fi | ||
done |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# This script is used to test the contrib submodules in the apps directory. | ||
# It is run by the GitHub Actions CI workflow defined in | ||
# .github/workflows/unit-integration-tests.yml. | ||
|
||
[[ -d ./v2/contrib ]] || exit 0 | ||
|
||
CONTRIBS=$(find ./v2/contrib -mindepth 2 -type f -name go.mod -exec dirname {} \;) | ||
|
||
for contrib in $CONTRIBS; do | ||
echo "Testing contrib module: $contrib" | ||
contrib_id=$(echo $contrib | sed 's/^\.\///g;s/[\/\.]/_/g') | ||
cd $contrib | ||
gotestsum --junitfile ${TEST_RESULTS}/gotestsum-report-$contrib_id.xml -- ./... -v -race -coverprofile=coverage-$contrib_id.txt -covermode=atomic | ||
cd - | ||
done |
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
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
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
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
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
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