Skip to content

Commit f7f6c8a

Browse files
committed
build: use GitHub Actions instead of Travis CI
1 parent 3430c51 commit f7f6c8a

File tree

7 files changed

+276
-98
lines changed

7 files changed

+276
-98
lines changed

.github/workflows/ci.yml

Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
name: ci
2+
3+
on:
4+
- pull_request
5+
- push
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-18.04
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
name:
14+
- Node.js 0.6
15+
- Node.js 0.8
16+
- Node.js 0.10
17+
- Node.js 0.12
18+
- io.js 1.x
19+
- io.js 2.x
20+
- io.js 3.x
21+
- Node.js 4.2 # test timers regression
22+
- Node.js 4.x
23+
- Node.js 5.x
24+
- Node.js 6.x
25+
- Node.js 7.x
26+
- Node.js 8.x
27+
- Node.js 9.x
28+
- Node.js 10.x
29+
- Node.js 11.x
30+
- Node.js 12.x
31+
- Node.js 13.x
32+
- Node.js 14.x
33+
- MySql 5.5
34+
- MySql 5.6
35+
- MySql 5.7
36+
- MariaDB 5.5
37+
- MariaDB 10.0
38+
- MariaDB 10.1
39+
- MariaDB 10.2
40+
- MariaDB 10.3
41+
42+
include:
43+
- name: Node.js 0.6
44+
node-version: "0.6"
45+
docker-mysql-type: mysql
46+
docker-mysql-version: "5.7"
47+
48+
- name: Node.js 0.8
49+
node-version: "0.8"
50+
docker-mysql-type: mysql
51+
docker-mysql-version: "5.7"
52+
53+
- name: Node.js 0.10
54+
node-version: "0.10"
55+
docker-mysql-type: mysql
56+
docker-mysql-version: "5.7"
57+
58+
- name: Node.js 0.12
59+
node-version: "0.12"
60+
docker-mysql-type: mysql
61+
docker-mysql-version: "5.7"
62+
63+
- name: io.js 1.x
64+
node-version: "1.8"
65+
docker-mysql-type: mysql
66+
docker-mysql-version: "5.7"
67+
68+
- name: io.js 2.x
69+
node-version: "2.5"
70+
docker-mysql-type: mysql
71+
docker-mysql-version: "5.7"
72+
73+
- name: io.js 3.x
74+
node-version: "3.3"
75+
docker-mysql-type: mysql
76+
docker-mysql-version: "5.7"
77+
78+
- name: Node.js 4.2
79+
node-version: "4.2.0"
80+
docker-mysql-type: mysql
81+
docker-mysql-version: "5.7"
82+
83+
- name: Node.js 4.x
84+
node-version: "4.9"
85+
docker-mysql-type: mysql
86+
docker-mysql-version: "5.7"
87+
88+
- name: Node.js 5.x
89+
node-version: "5.12"
90+
docker-mysql-type: mysql
91+
docker-mysql-version: "5.7"
92+
93+
- name: Node.js 6.x
94+
node-version: "6.17"
95+
docker-mysql-type: mysql
96+
docker-mysql-version: "5.7"
97+
98+
- name: Node.js 7.x
99+
node-version: "7.10"
100+
docker-mysql-type: mysql
101+
docker-mysql-version: "5.7"
102+
103+
- name: Node.js 8.x
104+
node-version: "8.17"
105+
docker-mysql-type: mysql
106+
docker-mysql-version: "5.7"
107+
108+
- name: Node.js 9.x
109+
node-version: "9.11"
110+
docker-mysql-type: mysql
111+
docker-mysql-version: "5.7"
112+
113+
- name: Node.js 10.x
114+
node-version: "10.21"
115+
docker-mysql-type: mysql
116+
docker-mysql-version: "5.7"
117+
118+
- name: Node.js 11.x
119+
node-version: "11.15"
120+
docker-mysql-type: mysql
121+
docker-mysql-version: "5.7"
122+
123+
- name: Node.js 12.x
124+
node-version: "12.18"
125+
docker-mysql-type: mysql
126+
docker-mysql-version: "5.7"
127+
128+
- name: Node.js 13.x
129+
node-version: "13.13"
130+
docker-mysql-type: mysql
131+
docker-mysql-version: "5.7"
132+
133+
- name: Node.js 14.x
134+
node-version: "14.2"
135+
docker-mysql-type: mysql
136+
docker-mysql-version: "5.7"
137+
138+
- name: MySql 5.5
139+
node-version: "12.18"
140+
docker-mysql-type: mysql
141+
docker-mysql-version: "5.5"
142+
143+
- name: MySql 5.6
144+
node-version: "12.18"
145+
docker-mysql-type: mysql
146+
docker-mysql-version: "5.6"
147+
148+
- name: MySql 5.7
149+
node-version: "12.18"
150+
docker-mysql-type: mysql
151+
docker-mysql-version: "5.7"
152+
153+
- name: MariaDB 5.5
154+
node-version: "12.18"
155+
docker-mysql-type: mariadb
156+
docker-mysql-version: "5.5"
157+
158+
- name: MariaDB 10.0
159+
node-version: "12.18"
160+
docker-mysql-type: mariadb
161+
docker-mysql-version: "10.0"
162+
163+
- name: MariaDB 10.1
164+
node-version: "12.18"
165+
docker-mysql-type: mariadb
166+
docker-mysql-version: "10.1"
167+
168+
- name: MariaDB 10.2
169+
node-version: "12.18"
170+
docker-mysql-type: mariadb
171+
docker-mysql-version: "10.2"
172+
173+
- name: MariaDB 10.3
174+
node-version: "12.18"
175+
docker-mysql-type: mariadb
176+
docker-mysql-version: "10.3"
177+
178+
steps:
179+
- uses: actions/checkout@v2
180+
181+
- name: Install Node.js ${{ matrix.node-version }}
182+
shell: bash -eo pipefail -l {0}
183+
run: |
184+
if [[ "${{ matrix.node-version }}" == 0.6* ]]; then
185+
sudo apt-get install g++-4.8 gcc-4.8 libssl1.0-dev
186+
export CC=/usr/bin/gcc-4.8
187+
export CXX=/usr/bin/g++-4.8
188+
fi
189+
nvm install --default ${{ matrix.node-version }}
190+
if [[ "${{ matrix.node-version }}" == 0.* && "$(cut -d. -f2 <<< "${{ matrix.node-version }}")" -lt 10 ]]; then
191+
nvm install --alias=npm 0.10
192+
nvm use ${{ matrix.node-version }}
193+
if [[ "$(npm -v)" == 1.1.* ]]; then
194+
nvm exec npm npm install -g npm@1.1
195+
ln -fs "$(which npm)" "$(dirname "$(nvm which npm)")/npm"
196+
else
197+
sed -i '1s;^.*$;'"$(printf '#!%q' "$(nvm which npm)")"';' "$(readlink -f "$(which npm)")"
198+
fi
199+
npm config set strict-ssl false
200+
fi
201+
dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
202+
203+
- name: Configure npm
204+
run: npm config set shrinkwrap false
205+
206+
- name: Remove non-test npm modules
207+
run: npm rm --silent --save-dev benchmark beautify-benchmark
208+
209+
- name: Setup Node.js version-specific dependencies
210+
shell: bash
211+
run: |
212+
node tool/install-nyc.js --nyc-optional
213+
test $(echo "${{ matrix.node-version }}" | cut -d. -f1) -ge 10 || npm rm --save-dev eslint
214+
215+
- name: Setup environment
216+
shell: bash
217+
run: |
218+
echo "MYSQL_DATABASE=node_mysql" >> "$GITHUB_ENV"
219+
echo "MYSQL_HOST=localhost" >> "$GITHUB_ENV"
220+
echo "MYSQL_PORT=$(node tool/free-port.js)" >> "$GITHUB_ENV"
221+
echo "MYSQL_USER=root" >> "$GITHUB_ENV"
222+
223+
- name: Install MySQL
224+
run: docker run -d --name mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -e MYSQL_DATABASE=$MYSQL_DATABASE -p $MYSQL_PORT:3306 $DOCKER_MYSQL_TYPE:$DOCKER_MYSQL_VERSION
225+
env:
226+
DOCKER_MYSQL_TYPE: ${{ matrix.docker-mysql-type }}
227+
DOCKER_MYSQL_VERSION: ${{ matrix.docker-mysql-version }}
228+
229+
- name: Install Node.js dependencies
230+
run: npm install
231+
232+
- name: Wait for MySQL running
233+
run: node tool/wait-mysql.js $MYSQL_PORT $MYSQL_HOST
234+
235+
- name: List environment
236+
id: list_env
237+
shell: bash
238+
run: |
239+
docker --version
240+
echo "mysql-server@$(node tool/mysql-version.js)"
241+
echo "node@$(node -v)"
242+
echo "npm@$(npm -v)"
243+
npm -s ls ||:
244+
(npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print "::set-output name=" $2 "::" $3 }'
245+
246+
- name: Run tests
247+
run: npm run test-ci
248+
249+
- name: Lint code
250+
if: steps.list_env.outputs.eslint != ''
251+
run: npm run lint
252+
253+
- name: Collect code coverage
254+
uses: coverallsapp/github-action@master
255+
if: steps.list_env.outputs.nyc != ''
256+
with:
257+
github-token: ${{ secrets.GITHUB_TOKEN }}
258+
flag-name: run-${{ matrix.test_number }}
259+
parallel: true
260+
261+
coverage:
262+
needs: test
263+
runs-on: ubuntu-latest
264+
steps:
265+
- name: Upload code coverage
266+
uses: coverallsapp/github-action@master
267+
with:
268+
github-token: ${{ secrets.GITHUB_TOKEN }}
269+
parallel-finished: true

.travis.yml

Lines changed: 0 additions & 90 deletions
This file was deleted.

Readme.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![NPM Version][npm-version-image]][npm-url]
44
[![NPM Downloads][npm-downloads-image]][npm-url]
55
[![Node.js Version][node-image]][node-url]
6-
[![Linux Build][travis-image]][travis-url]
6+
[![Linux Build][github-actions-ci-image]][github-actions-ci-url]
77
[![Windows Build][appveyor-image]][appveyor-url]
88
[![Test Coverage][coveralls-image]][coveralls-url]
99

@@ -1539,10 +1539,10 @@ $ MYSQL_HOST=localhost MYSQL_PORT=3306 MYSQL_DATABASE=node_mysql_test MYSQL_USER
15391539
[appveyor-url]: https://ci.appveyor.com/project/dougwilson/node-mysql
15401540
[coveralls-image]: https://badgen.net/coveralls/c/github/mysqljs/mysql/master
15411541
[coveralls-url]: https://coveralls.io/r/mysqljs/mysql?branch=master
1542+
[github-actions-ci-image]: https://badgen.net/github/checks/mysqljs/mysql/master?label=linux
1543+
[github-actions-ci-url]: https://github.com/mysqljs/mysql/actions/workflows/ci.yml
15421544
[node-image]: https://badgen.net/npm/node/mysql
15431545
[node-url]: https://nodejs.org/en/download
15441546
[npm-downloads-image]: https://badgen.net/npm/dm/mysql
15451547
[npm-url]: https://npmjs.org/package/mysql
15461548
[npm-version-image]: https://badgen.net/npm/v/mysql
1547-
[travis-image]: https://badgen.net/travis/mysqljs/mysql/master
1548-
[travis-url]: https://travis-ci.org/mysqljs/mysql

appveyor.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ environment:
77
MYSQL_PORT: 3306
88

99
matrix:
10-
- nodejs_version: "0.8"
1110
- nodejs_version: "0.10"
1211
- nodejs_version: "0.12"
1312
- nodejs_version: "1.8"
@@ -36,7 +35,7 @@ install:
3635
try { Install-Product node $env:nodejs_version -ErrorAction Stop }
3736
catch { Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) }
3837
- npm config set shrinkwrap false
39-
- if "%nodejs_version%" equ "0.8" npm config set strict-ssl false
38+
- if "%nodejs_version%" equ "0.10" npm config set strict-ssl false
4039
- npm rm --silent --save-dev eslint
4140
- if exist node_modules npm prune
4241
- if exist node_modules npm rebuild

0 commit comments

Comments
 (0)