forked from open-telemetry/opentelemetry-js-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
159 lines (157 loc) · 4.48 KB
/
test-all-versions.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
name: Test All Versions
on:
schedule:
- cron: "30 4 * * *"
workflow_dispatch:
inputs:
npm-workspace-args:
type: string
workflow_call:
inputs:
npm-workspace-args:
required: true
type: string
jobs:
build-and-cache:
strategy:
fail-fast: false
runs-on: ubuntu-latest
env:
NPM_CONFIG_UNSAFE_PERM: true
NODE_OPTIONS: --max-old-space-size=4096
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# Use the same Node.js version used for `release-please` workflow.
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install
run: npm ci
- name: Build
run: npm run compile
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: tav-build-cache-${{ github.run_number }}
path: node_modules/.cache/nx
retention-days: 1
tav:
name: Run test-all-versions
needs: build-and-cache
strategy:
fail-fast: false
matrix:
node: ["14", "16", "18", "20", "22"]
runs-on: ubuntu-latest
services:
mongo:
image: mongo
ports:
- 27017:27017
mssql:
image: mcr.microsoft.com/mssql/server:2022-latest
env:
MSSQL_SA_PASSWORD: mssql_passw0rd
ACCEPT_EULA: Y
ports:
- 1433:1433
options: >-
--health-cmd "/opt/mssql-tools18/bin/sqlcmd -S localhost -U sa -P $MSSQL_SA_PASSWORD -C -Q 'select 1' -b -o /dev/null"
--health-interval 1s
--health-timeout 30s
--health-start-period 10s
--health-retries 20
mysql:
image: mysql:5.7
env:
MYSQL_USER: otel
MYSQL_PASSWORD: secret
MYSQL_DATABASE: otel_mysql_database
MYSQL_ROOT_PASSWORD: rootpw
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
postgres:
image: postgres:16-alpine
env:
POSTGRES_USER: postgres
POSTGRES_DB: otel_pg_database
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
rabbitmq:
image: rabbitmq:3
ports:
- 22221:5672
env:
RABBITMQ_DEFAULT_USER: username
RABBITMQ_DEFAULT_PASS: password
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
MONGODB_DB: opentelemetry-tests
MONGODB_HOST: 127.0.0.1
MONGODB_PORT: 27017
MSSQL_PASSWORD: mssql_passw0rd
MYSQL_DATABASE: otel_mysql_database
MYSQL_HOST: 127.0.0.1
MYSQL_PASSWORD: secret
MYSQL_ROOT_PASSWORD: rootpw
MYSQL_PORT: 3306
MYSQL_USER: otel
OPENTELEMETRY_REDIS_HOST: localhost
OPENTELEMETRY_REDIS_PORT: 6379
POSTGRES_DB: otel_pg_database
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
RUN_MONGODB_TESTS: 1
RUN_MSSQL_TESTS: 1
RUN_MYSQL_TESTS: 1
RUN_POSTGRES_TESTS: 1
RUN_REDIS_TESTS: 1
NPM_CONFIG_UNSAFE_PERM: true
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- name: Set MySQL variables
run: mysql --user=root --password=${MYSQL_ROOT_PASSWORD} --host=${MYSQL_HOST} --port=${MYSQL_PORT} -e "SET GLOBAL log_output='TABLE'; SET GLOBAL general_log = 1;" mysql
- name: Update npm to a version that supports workspaces (v7 or later)
if: ${{ matrix.node < 16 }}
run: npm install -g npm@9 # npm@9 supports node >=14.17.0
- name: Install
run: npm ci
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
name: tav-build-cache-${{ github.run_number }}
path: node_modules/.cache/nx
- name: Build
run: npm run compile
- name: Run test-all-versions
run: npm run --if-present --workspaces test-all-versions ${{ inputs.npm-workspace-args }}