-
Notifications
You must be signed in to change notification settings - Fork 295
145 lines (136 loc) · 5.92 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# 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