Skip to content

added mutex guards around appRun for code level metrics #1335

added mutex guards around appRun for code level metrics

added mutex guards around appRun for code level metrics #1335

Workflow file for this run

# Copyright 2023 New Relic Corporation. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
name: Go Agent CI
on: pull_request
env:
# Specifies which go version to run integration tests on
INTEGRATION_TESTS_GO_VERSION: latest
jobs:
go-agent-v3:
runs-on: ubuntu-latest
strategy:
# if one test fails, do not abort the rest
fail-fast: false
matrix:
include:
# Core Tests on 3 most recent major Go versions
- go-version: 1.20.14
dirs: v3/newrelic,v3/internal,v3/examples
- go-version: 1.21
dirs: v3/newrelic,v3/internal,v3/examples
- go-version: latest
dirs: v3/newrelic,v3/internal,v3/examples
- go-version: 1.23rc2
dirs: v3/newrelic,v3/internal,v3/examples
# Integration Tests on highest Supported Go Version
- dirs: v3/integrations/nramqp
- dirs: v3/integrations/nrfasthttp
- dirs: v3/integrations/nrsarama
- dirs: v3/integrations/logcontext/nrlogrusplugin
- dirs: v3/integrations/logcontext-v2/nrlogrus
- dirs: v3/integrations/logcontext-v2/nrzerolog
- dirs: v3/integrations/logcontext-v2/nrzap
- dirs: v3/integrations/logcontext-v2/nrslog
- dirs: v3/integrations/logcontext-v2/nrwriter
- dirs: v3/integrations/logcontext-v2/zerologWriter
- dirs: v3/integrations/logcontext-v2/logWriter
- dirs: v3/integrations/nrawssdk-v1
- dirs: v3/integrations/nrawssdk-v2
- dirs: v3/integrations/nrecho-v3
- dirs: v3/integrations/nrecho-v4
- dirs: v3/integrations/nrelasticsearch-v7
- dirs: v3/integrations/nrgin
- dirs: v3/integrations/nrgorilla
- dirs: v3/integrations/nrgraphgophers
- dirs: v3/integrations/nrlogrus
- dirs: v3/integrations/nrlogxi
- dirs: v3/integrations/nrpkgerrors
- dirs: v3/integrations/nrlambda
- dirs: v3/integrations/nrmysql
- dirs: v3/integrations/nrpq
- dirs: v3/integrations/nrpgx5
- dirs: v3/integrations/nrpq/example/sqlx
- dirs: v3/integrations/nrredis-v7
- dirs: v3/integrations/nrredis-v9
- dirs: v3/integrations/nrsqlite3
- dirs: v3/integrations/nrsnowflake
- dirs: v3/integrations/nrgrpc
- dirs: v3/integrations/nrmicro
- dirs: v3/integrations/nrnats
- dirs: v3/integrations/nrstan
- dirs: v3/integrations/nrstan/test
- dirs: v3/integrations/nrstan/examples
- dirs: v3/integrations/logcontext
- dirs: v3/integrations/nrzap
- dirs: v3/integrations/nrhttprouter
- dirs: v3/integrations/nrb3
- dirs: v3/integrations/nrmongo
- dirs: v3/integrations/nrgraphqlgo,v3/integrations/nrgraphqlgo/example
- dirs: v3/integrations/nrmssql
- dirs: v3/integrations/nropenai
- dirs: v3/integrations/nrslog
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
path: "go-agent"
- name: Build Docker Image
run: docker build -f ${{ github.workspace }}/go-agent/Dockerfile ${{ github.workspace }} --build-arg GO_VERSION=${{ matrix.go-version || env.INTEGRATION_TESTS_GO_VERSION }} -t go-agent-tests-amd64
- name: Set up Docker container and run tests
run: |
IFS=',' read -ra DIRS <<< "${{ matrix.dirs }}"
for dir in "${DIRS[@]}"; do
if [ -d "go-agent/$dir" ]; then
# Create Coverage Report Directory for CodeCov
coverage_dir="${{ github.workspace }}/coverage-reports"
mkdir -p "$coverage_dir"
# Special case for nrnats, which requires direct module proxying
if [[ "$dir" == *"nrnats"* ]]; then
docker run -e GOPROXY=direct -e CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} -e GITHUB_HEAD_REF=${GITHUB_HEAD_REF} -v "$coverage_dir:/coverage" go-agent-tests-amd64 ./go-agent/run-tests.sh "$dir" "/coverage"
else
docker run -e CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} -e GITHUB_HEAD_REF=${GITHUB_HEAD_REF} -v "$coverage_dir:/coverage" go-agent-tests-amd64 ./go-agent/run-tests.sh "$dir" "/coverage"
fi
else
echo "Directory /app/$dir does not exist."
fi
done
# Arm64 tests
go-agent-v3-arm64:
runs-on: ubuntu-latest
strategy:
# if one test fails, do not abort the rest
fail-fast: false
matrix:
include:
# Core Tests on 3 most recent major Go versions
- go-version: 1.20.14
dirs: v3/newrelic,v3/internal,v3/examples
- go-version: 1.21
dirs: v3/newrelic,v3/internal,v3/examples
- go-version: latest
dirs: v3/newrelic,v3/internal,v3/examples
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
path: "go-agent"
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build Docker Image
run: |
docker buildx create --use
docker buildx build --platform linux/arm64 -f ${{ github.workspace }}/go-agent/Dockerfile ${{ github.workspace }} --build-arg GO_VERSION=${{ matrix.go-version || env.INTEGRATION_TESTS_GO_VERSION }} -t go-agent-tests-arm64 --load
- name: Run Tests in Docker
run: |
IFS=',' read -ra DIRS <<< "${{ matrix.dirs }}"
for dir in "${DIRS[@]}"; do
if [ -d "go-agent/$dir" ]; then
coverage_dir="${{ github.workspace }}/coverage-reports"
mkdir -p "$coverage_dir"
docker run -e CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} -e GITHUB_HEAD_REF=${GITHUB_HEAD_REF} -v "$coverage_dir:/coverage" go-agent-tests-arm64 ./go-agent/run-tests.sh "$dir" "/coverage"
else
echo "Directory /app/$dir does not exist."
fi
done