-
Notifications
You must be signed in to change notification settings - Fork 301
136 lines (128 loc) · 4.98 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
name: Go Agent CI
on: pull_request
env:
# Specifies which go version to run integration tests on
INTEGRATION_TESTS_GO_VERSION: 1.21.5
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.19.0
dirs: v3/newrelic,v3/internal,v3/examples
- go-version: 1.20.0
dirs: v3/newrelic,v3/internal,v3/examples
- go-version: 1.21.0
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/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
goproxy: direct
- 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
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
path: "go-agent"
- name: Set up Codecov environment variables
run: ci_env=`bash <(curl -s https://codecov.io/env)`
- 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
if [[ "$dir" == *"nrnats"* ]]; then
docker run $ci_env -e CI=true -e GOPROXY=direct go-agent-tests-amd64 ./go-agent/run-tests.sh "$dir"
else
docker run $ci_env -e CI=true go-agent-tests-amd64 ./go-agent/run-tests.sh "$dir"
fi
else
echo "Directory /app/$dir does not exist."
fi
done
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
# 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.19.0
dirs: v3/newrelic,v3/internal,v3/examples
- go-version: 1.20.0
dirs: v3/newrelic,v3/internal,v3/examples
- go-version: 1.21.0
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
docker run go-agent-tests-arm64 ./go-agent/run-tests.sh "$dir"
else
echo "Directory /app/$dir does not exist."
fi
done
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3