-
Notifications
You must be signed in to change notification settings - Fork 9
39 lines (34 loc) · 1.05 KB
/
nodejs.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
name: Node CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
services:
# https://github.saobby.my.eu.orgmunity/t5/GitHub-Actions/github-actions-cannot-connect-to-mysql-service/td-p/30611#
# mysql:latest doesn't work out of the box yet (https://github.com/mysqljs/mysql/issues/2046)
mysql:
image: mysql:5.7
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: leoric
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install, build, and test
run: |
npm install
npm run build --if-present
npm test
env:
CI: true
MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }}
MYSQL_ROOT_PASSWORD: password