Skip to content

Commit

Permalink
.github/workflows: adapting last v2 CI changes
Browse files Browse the repository at this point in the history
  • Loading branch information
darccio committed Dec 14, 2023
1 parent eca84e5 commit 562ed50
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
18 changes: 12 additions & 6 deletions .github/workflows/apps/appsec-test-contrib-submodules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@ function gotestsum_runner() {
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 "$@"
# capture the working directory for the test run
WD=$(realpath "$1"); shift
docker run \
--platform="$PLATFORM" \
-v "$PWD":"$PWD" -w "$WD" \
-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"
Expand All @@ -32,16 +40,14 @@ if [[ "$1" == "docker" ]]; then
[[ -z "$PLATFORM" ]] && PLATFORM="linux/arm64"
fi

$runner "$JUNIT_REPORT.xml" ./appsec/... ./internal/appsec/...
$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 -
$runner "$JUNIT_REPORT.$contrib.xml" "./v2/contrib/$SCOPE" "."
else
$runner "$JUNIT_REPORT.$contrib.xml" "./contrib/$SCOPE/..."
$runner "$JUNIT_REPORT.$contrib.xml" "." "./contrib/$SCOPE/..."
fi
done
2 changes: 1 addition & 1 deletion .github/workflows/appsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ jobs:
with:
platforms: arm64
- run: |
env CGO_ENABLED=${{ matrix.cgo_enabled }} DD_APPSEC_ENABLED=${{ matrix.appsec_enabled }} DD_APPSEC_WAF_TIMEOUT=$DD_APPSEC_WAF_TIMEOUT ./.github/workflows/apps/appsec-test-contrib-submodules.sh docker linux/arm64
env V2_BRANCH=$V2_BRANCH CGO_ENABLED=${{ matrix.cgo_enabled }} DD_APPSEC_ENABLED=${{ matrix.appsec_enabled }} DD_APPSEC_WAF_TIMEOUT=$DD_APPSEC_WAF_TIMEOUT ./.github/workflows/apps/appsec-test-contrib-submodules.sh docker linux/arm64
smoke-tests:
uses: DataDog/appsec-go-test-app/.github/workflows/smoke-tests.yml@main
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/parametric-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
uses: actions/checkout@v3
with:
repository: 'DataDog/system-tests'
ref: refs/heads/dario.castane/AIT-3705/dd-trace-go.v2

- name: Checkout dd-trace-go
uses: actions/checkout@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/unit-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ jobs:
PACKAGE_NAMES=$(go list ./contrib/... | grep -v -e grpc.v12 -e google.golang.org/api)
gotestsum --junitfile ${TEST_RESULTS}/gotestsum-report.xml -- $PACKAGE_NAMES -v -race -coverprofile=coverage.txt -covermode=atomic
- name: Test Contrib Submodules
if: always()
- name: Test Contrib Submodules (v2)
if: ${{ env.V2_BRANCH == 'true' }} && always()
run: ./.github/workflows/apps/test-contrib-submodules.sh

- name: Upload the results to Datadog CI App
Expand Down

0 comments on commit 562ed50

Please sign in to comment.