-
Notifications
You must be signed in to change notification settings - Fork 1
104 lines (93 loc) ยท 3.22 KB
/
nodejs.yml
File metadata and controls
104 lines (93 loc) ยท 3.22 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
# 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 - Continuous Integration
on:
pull_request:
branches:
- master
- develop
jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontainer
container: node:12
# 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
ports:
# Maps port 6379 on service container to the host
- 6379:6379
mysql:
image: mysql:latest
env:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: test
options: >-
--health-cmd="mysqladmin ping"
--health-interval=5s
--health-timeout=2s
--health-retries=3
ports:
- 3306:3306
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: '12.x'
- name: Install Dependencies
run: |
cd app
npm install --unsafe-perm=true --allow-root
npm run build --if-present
- name: Prisma generate and migrate up
run: |
cd app
ENV=test npm run prisma:generate
ENV=test npm run prisma:up
env:
DB_URL: mysql://root:password@mysql/test
- name: Run Test
run: |
cd app
npm test
env:
PORT: 3001
DB_URL: mysql://root:password@mysql/test
PASSWORD_SECRET: ${{ secrets.PASSWORD_SECRET }}
TEST_USER_OAUTH_KEY: ${{ secrets.TEST_USER_OAUTH_KEY }}
# GOOGLE FCM
TYPE: ${{ secrets.TYPE }}
PROJECT_ID: ${{ secrets.PROJECT_ID }}
PRIVATE_KEY_ID: ${{ secrets.PRIVATE_KEY_ID }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
CLIENT_EMAIL: ${{ secrets.CLIENT_EMAIL }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
AUTH_URI: ${{ secrets.AUTH_URI }}
TOKEN_URI: ${{ secrets.TOKEN_URI }}
AUTH_PROVIDER_X509_CERT_URL: ${{ secrets.AUTH_PROVIDER_X509_CERT_URL }}
CLIENT_X509_CERT_URL: ${{ secrets.CLIENT_X509_CERT_URL }}
# The hostname used to communicate with the Redis service container
REDIS_HOST: redis
# The default Redis port
REDIS_PORT: 6379
- name: Slack Notifying Message
uses: 8398a7/action-slack@v3
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow
author_name: HabitBread
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()