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: Run unit & integration tests against Golang RC version | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
name: RC version check | |
runs-on: ubuntu-latest | |
# env: | |
# # COSMOS_CONNECTION_URL: ${{ secrets.COSMOS_CONNECTION_URL }} | |
# # COSMOS_KEY: ${{ secrets.COSMOS_KEY }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Run coverage commands | |
shell: bash | |
run: | | |
#!/bin/bash | |
shopt -s expand_aliases | |
TRACER_PATH=$(pwd) | |
echo $TRACER_PATH | |
echo "Dealing with Golang RC version!" | |
rcToInstall=$(git ls-remote -t https://github.com/golang/go | awk -F/ '{ print $NF }' | sort -V |grep rc | tail -1 | tr -d ' ') | |
echo "RC version : $rcToInstall" | |
url="golang.org/dl/$rcToInstall@latest" | |
echo "RC URL : $url" | |
go install $url | |
ls ~/go | |
ls ~/go/bin | |
# which go1.23rc2 | |
alias gorc="~/go/bin/$rcToInstall" | |
gorc download | |
gorc version | |
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" | |
echo "Running unit test on core." | |
gorc test -v -coverpkg=./... -cover -covermode atomic ./... | |
DEPRECATED_PKGS=".*instaamqp$" | |
LIB_LIST=$(find ./instrumentation -name go.mod -exec dirname {} \; | grep -E -v "$DEPRECATED_PKGS") | |
for lib in $LIB_LIST | |
do echo "Running unit test for $lib" && cd "$lib" && gorc mod tidy && gorc test -v -coverpkg=./... -cover -covermode atomic ./... && cd -; | |
done | |
INTEGRATIONS_TESTS=("instagocb" "instapgx" "instapgx/v2") | |
for str in ${INTEGRATIONS_TESTS[@]}; do | |
dir=./instrumentation/$str | |
echo "Running unit test for $dir" | |
cd $dir | |
gorc mod tidy | |
gorc test -v -tags=integration -coverpkg=./... -cover -covermode atomic ./... && cd - | |
done | |
echo "All done!" | |
echo "GO_RC_VERSION=$rcToInstall" >> $GITHUB_ENV | |
- name: Send result to slack channel | |
uses: slackapi/slack-github-action@v1.24.0 | |
with: | |
channel-id: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }} | |
payload: | | |
{ | |
"text": ":mega: Unit tests run with Golang RC version-${{ env.GO_RC_VERSION }} - sucess:tada:", | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": ":mega: Unit tests run with Golang RC version-${{ env.GO_RC_VERSION }} - sucess:tada:" | |
} | |
} | |
] | |
} | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | |
SLACK_RELEASE_CHANNEL_ID: ${{ secrets.SLACK_RELEASE_CHANNEL_ID }} |