-
Notifications
You must be signed in to change notification settings - Fork 225
197 lines (180 loc) · 4.94 KB
/
test.yml
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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
name: test
# https://github.community/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662/2
on:
workflow_dispatch:
push:
branches:
- 3.x
paths-ignore:
- '**/*.md'
- '**/*.asciidoc'
- 'docs/**'
- 'examples/**'
pull_request:
branches:
- 3.x
paths-ignore:
- '**/*.md'
- '**/*.asciidoc'
- 'docs/**'
- 'examples/**'
## Concurrency only allowed in the main branch.
## So old builds running for old commits within the same Pull Request are cancelled
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install
- run: npm run lint
test-vers:
# These services and their configuration should match test/docker-compose.yml.
services:
redis:
image: redis
ports:
- 6379:6379
memcached:
image: memcached:alpine
ports:
- 11211:11211
cassandra:
image: cassandra
ports:
- 9042:9042
env:
MAX_HEAP_SIZE: '1G'
HEAP_NEWSIZE: '400m'
volumes:
- nodecassandradata:/var/lib/cassandra
postgres:
image: postgres:9.6
ports:
- 5432:5432
volumes:
- nodepgdata:/var/lib/postgresql/data
env:
POSTGRES_USER: 'postgres'
POSTGRES_DB: 'test_elastic_apm'
POSTGRES_HOST_AUTH_METHOD: 'trust'
mongodb:
image: mongo:5
ports:
- 27017:27017
volumes:
- nodemongodata:/data/db
mysql:
image: mysql:5.7
ports:
- 3306:3306
volumes:
- nodemysqldata:/var/lib/mysql
env:
MYSQL_ALLOW_EMPTY_PASSWORD: 1
mssql:
image: mcr.microsoft.com/mssql/server
env:
ACCEPT_EULA: 'Y'
SA_PASSWORD: 'Very(!)Secure'
MSSQL_PID: 'Developer'
ports:
- 1433:1433
volumes:
- nodemssqldata:/var/opt/mssql
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.7.1
env:
ES_JAVA_OPTS: '-Xms512m -Xmx512m'
network.host: '_site_'
transport.host: '127.0.0.1'
http.host: '0.0.0.0'
xpack.security.enabled: 'false'
ports:
- 9200:9200
volumes:
- nodeesdata:/usr/share/elasticsearch/data
localstack:
image: localstack/localstack:2.1.0
env:
DATA_DIR: '/var/lib/localstack'
ports:
- "4566:4566"
volumes:
- nodelocalstackdata:/var/lib/localstack
strategy:
fail-fast: false
matrix:
node:
- '20'
- '18.18.2' # Skip >=18.19.0 until IITM double-import issue is resolved.
- '18.0'
- '16'
- '16.0'
- '14'
- '14.0'
- '12'
- '12.0'
- '10'
- '10.0'
- '8'
- '8.6'
contextManager: [ 'patch', '' ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- run: docker ps # show the services against which we'll be testing
- run: npm install
- run: npm ls --all || true
- name: npm test
run: npm test
env:
ELASTIC_APM_CONTEXT_MANAGER: ${{ matrix.contextManager }}
- uses: inception-health/otel-upload-test-artifact-action@v1
if: always()
continue-on-error: true
with:
jobName: "test-vers (${{ matrix.node }})"
stepName: "npm test"
path: "test_output/*.junit.xml"
type: "junit"
githubToken: ${{ secrets.GITHUB_TOKEN }}
test-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
# What Node.js version to test on Windows is a balance between which
# is the current LTS version (https://github.com/nodejs/release) and
# which version more of our users are using.
node-version: 16
cache: 'npm'
- run: npm install
- run: npm ls --all || true
# Run a subset of tests that we can reasonably get running on Windows CI.
- run: node test/test.js
# single status check that can be set as required in branch protection rules.
# success if all jobs listed in "needs" are successful.
# failure if at least one job listed "needs" is not successful.
test:
if: always()
runs-on: ubuntu-latest
needs:
- lint
- test-vers
- test-windows
steps:
- id: check
uses: elastic/apm-pipeline-library/.github/actions/check-dependent-jobs@current
with:
needs: ${{ toJSON(needs) }}
- run: ${{ steps.check.outputs.isSuccess }}