-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d96c43
commit de42f17
Showing
3 changed files
with
79 additions
and
37 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,51 @@ | ||
name: Generate code coverage and upload to artifact | ||
on: | ||
workflow_dispatch: | ||
jobs: | ||
build: | ||
name: Run analysis | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Run coverage commands | ||
run: | | ||
#!/bin/bash | ||
TRACER_PATH=$(pwd) | ||
echo $TRACER_PATH | ||
mkdir coverage | ||
echo "Starting Couchbase" | ||
docker-compose -f docker-compose-integration.yaml up -d | ||
echo "Starting Postgres" | ||
sudo systemctl start postgresql.service | ||
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'mysecretpassword'" | ||
echo "After starting Postgres" | ||
go test -v -coverpkg=./... -cover -covermode atomic -coverprofile $TRACER_PATH/coverage/coverage.out ./... -json > $TRACER_PATH/coverage/coverage.json | ||
LIB_LIST=$(find ./instrumentation -name go.mod -exec dirname {} \;) | ||
for lib in $LIB_LIST | ||
do echo "Generating test coverage for $lib" && cd "$lib" && go mod tidy && go test -v -coverpkg=./... -cover -covermode atomic -coverprofile $TRACER_PATH/coverage/coverage_$(date +%s%N)_$RANDOM.out ./... -json > $TRACER_PATH/coverage/coverage_$(date +%s%N)_$RANDOM.json && cd -; | ||
done | ||
echo "Generating test coverage for ./instrumentation/instagocb" | ||
cd ./instrumentation/instagocb | ||
go mod tidy | ||
go test -v -tags=integration -coverpkg=./... -cover -covermode atomic -coverprofile $TRACER_PATH/coverage/coverage_$(date +%s%N)_$RANDOM.out ./... -json > $TRACER_PATH/coverage/coverage_$(date +%s%N)_$RANDOM.json && cd - | ||
echo "Generating test coverage for ./instrumentation/instapgx" | ||
cd ./instrumentation/instapgx | ||
go mod tidy | ||
go test -v -tags=integration -coverpkg=./... -cover -covermode atomic -coverprofile $TRACER_PATH/coverage/coverage_$(date +%s%N)_$RANDOM.out ./... -json > $TRACER_PATH/coverage/coverage_$(date +%s%N)_$RANDOM.json && cd - | ||
- name: Upload code coverage | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: go-tracer-code-coverage | ||
path: coverage | ||
|
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