-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (71 loc) · 2.23 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
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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ${{ matrix.os }}
# Docker Hub image that `container-job` executes in
container: node:10.18-jessie
# Service containers to run with `container-job`
services:
# Label used to access the service container
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
mysql:
image: mysql:5.7
options: >-
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: shop
# volumes:
# - /__w/service/service:/shared
strategy:
matrix:
node-version: [12.x, 14.x]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Verify MySQL connection from container and init data
run: |
apt-get update
apt-get install -y mysql-client
mysql --host mysql -uroot -ppassword -e "SHOW DATABASES"
mysql --host mysql -uroot -ppassword shop < ./src/database/init.sql
- run: npm i -g npminstall && npminstall
- run: npm run ci
env:
CI: true
# mysql
MYSQL_HOST: mysql
MYSQL_PORT: 3306
MYSQL_USER: root
MYSQL_PASSWORD: password
MYSQL_DATABASE: shop
# redis
REDIS_HOST: redis
REDIS_PORT: 6379
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
# with:
# token: ${{secrets.CODECOV_TOKEN}}
# file: ./coverage/coverage-final.json