-
-
Notifications
You must be signed in to change notification settings - Fork 622
157 lines (133 loc) · 5.07 KB
/
ci-linux.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
name: CI - Linux
on:
pull_request:
push:
branches: [ main ]
workflow_dispatch:
env:
MYSQL_PORT: 3306
MYSQL_USER: root
MYSQL_DATABASE: test
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Delete artifacts
uses: jimschubert/delete-artifacts-action@v1
with:
log_level: 'debug'
min_bytes: '0'
pattern: '\.xml'
tests-linux:
needs: [ cleanup ]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [16.x, 18.x, 20.x]
mysql-version: ["mysql:8.0.18", "mysql:8.0.22", "mysql:8.0.33", "mysql:5.7"]
use-compression: [0]
use-tls: [0]
mysql_connection_url_key: [""]
# TODO - add mariadb to the matrix. currently few tests are broken due to mariadb incompatibilities
include:
# 20.x
- node-version: "20.x"
mysql-version: "mysql:8.0.33"
use-compression: 1
use-tls: 0
use-builtin-test-runner: 1
- node-version: "20.x"
mysql-version: "mysql:8.0.33"
use-compression: 0
use-tls: 1
use-builtin-test-runner: 1
# 18.x
# - node-version: "18.x"
# mysql_connection_url_key: "PS_MYSQL_URL"
# filter: "test-select"
# use-compression: 0
# use-tls: 0
# 16.x
- node-version: "16.x"
mysql-version: "mysql:8.0.18"
use-compression: 1
use-tls: 0
- node-version: "16.x"
mysql-version: "mysql:8.0.18"
use-compression: 0
use-tls: 1
- node-version: "16.x"
mysql-version: "mysql:8.0.18"
use-compression: 1
use-tls: 1
# 14.x
- node-version: "14.x"
mysql-version: "mysql:5.7"
use-compression: 0
use-tls: 0
# filter
- filter: "test-select-1" # a number of tests does not work with mysql 5.1 due to old sql syntax, just testing basic connection
node-version: "16.x"
mysql-version: "datagrip/mysql:5.1"
use-compression: 0
use-tls: 0
env:
MYSQL_CONNECTION_URL: ${{ secrets[matrix.mysql_connection_url_key] }}
name: Node.js ${{ matrix.node-version }} - DB ${{ matrix.mysql-version }}${{ matrix.mysql_connection_url_key }} - SSL=${{matrix.use-tls}} Compression=${{matrix.use-compression}}
steps:
- uses: actions/checkout@v3
- name: Set up MySQL
if: ${{ matrix.mysql-version }}
run: docker run -d -e MYSQL_ALLOW_EMPTY_PASSWORD=1 -e MYSQL_DATABASE=${{ env.MYSQL_DATABASE }} -v $PWD/mysqldata:/var/lib/mysql/ -v $PWD/examples/custom-conf:/etc/mysql/conf.d -v $PWD/examples/ssl/certs:/certs -p ${{ env.MYSQL_PORT }}:3306 ${{ matrix.mysql-version }}
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
- name: Install npm dependencies
run: npm ci
- name: Wait mysql server is ready
if: ${{ matrix.mysql-version }}
run: node tools/wait-up.js
- name: Run tests
run: FILTER=${{matrix.filter}} MYSQL_USE_TLS=${{ matrix.use-tls }} MYSQL_USE_COMPRESSION=${{ matrix.use-compression }} npm run coverage-test
- name: Run tests with built-in node test runner
if: ${{ matrix.use-builtin-test-runner }}
run: FILTER=${{matrix.filter}} MYSQL_USE_TLS=${{ matrix.use-tls }} MYSQL_USE_COMPRESSION=${{ matrix.use-compression }} npm run test:builtin-node-runner
- run: echo "coverage-artifact-name=`echo -n "${{github.run_id}}-${{ matrix.node-version }}-${{ matrix.mysql-version }}-{${{ matrix.mysql_connection_url_key }}-${{matrix.use-tls}}-${{matrix.use-compression}}" | shasum | cut -d " " -f 1`" >> $GITHUB_ENV
- uses: actions/upload-artifact@v3
with:
name: coverage-${{env.coverage-artifact-name}}
path: coverage/cobertura-coverage.xml
coverage:
permissions: write-all
needs: [ tests-linux ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Restore coverage
uses: actions/download-artifact@v2
with:
path: coverage
- name: get list of coverage files
run: echo "coverage-files=`find coverage | grep xml | paste -s -d\; -`" >> $GITHUB_ENV
- name: ReportGenerator
uses: danielpalme/ReportGenerator-GitHub-Action@4.8.12
with:
reports: "${{ env.coverage-files }}"
targetdir: '.'
reporttypes: 'Cobertura'
- name: Debug
run: cat Cobertura.xml
- name: Display coverage
uses: ewjoachim/coverage-comment-action@v1
continue-on-error: true
with:
COVERAGE_FILE: "Cobertura.xml"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}