forked from apache/cassandra-nodejs-driver
-
Notifications
You must be signed in to change notification settings - Fork 0
224 lines (198 loc) · 6.69 KB
/
Copy pathtest.yml
File metadata and controls
224 lines (198 loc) · 6.69 KB
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
name: Unit and Integration Tests for Apache Cassandra NodeJS Driver
on:
push:
pull_request:
workflow_dispatch: # allow manual trigger from Actions page
permissions:
contents: read
actions: read
checks: write
jobs:
eslint:
name: Run eslint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- run: npm install -g eslint@4
- run: npm run eslint
typescript:
name: TypeScript generation and compilation tests
runs-on: ubuntu-latest
strategy:
matrix:
NODE_VERSION: ["20", "22", "24"]
TSC_VERSION: ["4.9", "5.9", "6.0"]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.NODE_VERSION }}
cache: "npm"
- run: npm ci
- run: npm install typescript@${{ matrix.TSC_VERSION }} --no-save
- run: |
pushd test/unit/typescript/
npx tsc
node -e "require('./api-generation-test').generate()" > generated.ts
npx tsc --noEmit
unit-integration-tests:
runs-on: ubuntu-latest
strategy:
matrix:
NODE_VERSION: ["20", "22", "24"]
SERVER_VERSION: ["3.11", "4.0", "4.1", "5.0"] # Cassandra minor versions
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
# ---- Python for ccm ----
- name: Set up Python 3.9.16
uses: actions/setup-python@v5
with:
python-version: "3.9.16"
- name: Install ccm
run: |
python -m pip install --upgrade pip
git clone --depth 1 --single-branch -b cassandra-test https://github.com/apache/cassandra-ccm.git
cd cassandra-ccm
pip install -r requirements.txt
./setup.py install
# ---- Install required Zulu JDKs (8/11/17) and capture their homes ----
- name: Install Zulu 11
id: z11
uses: actions/setup-java@v5
with:
distribution: zulu
java-version: "11"
- name: Install Zulu 17
id: z17
uses: actions/setup-java@v5
with:
distribution: zulu
java-version: "17"
- name: Install Zulu 8
id: z8
uses: actions/setup-java@v5
with:
distribution: zulu
java-version: "8"
- name: Export JAVA*_HOME variables
run: |
echo "JAVA8_HOME=${{ steps.z8.outputs.path }}" >> "$GITHUB_ENV"
echo "JAVA11_HOME=${{ steps.z11.outputs.path }}" >> "$GITHUB_ENV"
echo "JAVA17_HOME=${{ steps.z17.outputs.path }}" >> "$GITHUB_ENV"
echo "JAVA_HOME=${{ steps.z8.outputs.path }}" >> "$GITHUB_ENV"
echo "CCM_UPDATE_PID_DEFAULT_TIMEOUT=120" >> "$GITHUB_ENV"
- name: Generate SSL certificates
run: |
mkdir -p /home/runner/workspace/tools/ccm/ssl/
cd /home/runner/workspace/tools/ccm/ssl/
keytool -genkey \
-keyalg RSA \
-alias cassandra \
-keystore keystore.jks \
-storepass cassandra \
-keypass cassandra \
-validity 364635 \
-dname "CN=Jane He, OU=TE, O=ASF, L=Santa Clara, ST=CA, C=TE"
keytool -export \
-alias cassandra \
-file cassandra.crt \
-keystore keystore.jks \
-storepass cassandra
openssl x509 \
-inform der \
-in cassandra.crt \
-out cassandra.pem
keytool -genkeypair \
-keyalg RSA \
-alias client \
-keystore truststore.jks \
-storepass cassandra \
-keypass cassandra \
-validity 364635 \
-dname "CN=Philip Thompson, OU=TE, O=DataStax, L=Santa Clara, ST=CA, C=TE"
keytool -importkeystore \
-srckeystore truststore.jks \
-destkeystore client.p12 \
-srcstorepass cassandra \
-deststorepass cassandra \
-deststoretype PKCS12
openssl pkcs12 \
-in client.p12 \
-passin pass:cassandra \
-nokeys \
-out client_cert.pem -legacy
openssl pkcs12 \
-in client.p12 \
-passin pass:cassandra \
-nodes \
-nocerts \
-out client_key.pem -legacy
- name: Install Simulacron
run: |
wget https://github.com/datastax/simulacron/releases/download/0.12.0/simulacron-standalone-0.12.0.jar -O /home/runner/simulacron.jar
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.NODE_VERSION }}
cache: "npm"
- name: Resolve Cassandra latest patch version
env:
SERVER_VERSION: ${{ matrix.SERVER_VERSION }}
run: |
PATCH_SERVER_VERSION=$(
curl -s https://downloads.apache.org/cassandra/ \
| grep -oP '(?<=href=")[0-9]+\.[0-9]+\.[0-9]+(?=)' \
| sort -rV \
| uniq -w 3 \
| grep "^${SERVER_VERSION}\."
)
echo "Resolved Cassandra ${SERVER_VERSION}.x -> ${PATCH_SERVER_VERSION}"
echo "CCM_VERSION=$PATCH_SERVER_VERSION" >> "$GITHUB_ENV"
- name: Print environment
run: printenv | sort
- name: Pre-download Cassandra distribution
run: |
ccm create predownload -v $CCM_VERSION
ccm remove
- name: Run tests
run: |
npm ci
npm install --no-save mocha-multi-reporters mocha-junit-reporter
echo '{
"reporterEnabled": "spec, mocha-junit-reporter",
"mochaJunitReporterReporterOptions": {
"mochaFile": "test-results/results.xml"
}
}' > config.json
npx mocha test/unit test/integration/short --recursive --exit --reporter mocha-multi-reporters \
--reporter-options configFile=config.json
- name: Upload Test Results
if: (!cancelled())
uses: actions/upload-artifact@v4
with:
name: Test Results (Node.js ${{ matrix.NODE_VERSION }}, Cassandra ${{ matrix.SERVER_VERSION }})
path: test-results/**/*
publish-test-results:
name: "Publish Tests Results"
needs: unit-integration-tests
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
if: (!cancelled())
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: artifacts/**/*.xml