-
Notifications
You must be signed in to change notification settings - Fork 1
130 lines (120 loc) · 4.07 KB
/
Copy pathnodejs.yml
File metadata and controls
130 lines (120 loc) · 4.07 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
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
name: Node CI
on: [push]
jobs:
test_client:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.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: Client, npm install, build, and test
run: |
cd client
npm ci
npm run build:production
npm test
env:
CI: true
VUE_APP_API_URL: http://localhost:3000
VUE_APP_IMAGE_UPLOAD_URL: http://localhost:3001/images
VUE_APP_UNIQUE_EMAIL_ENDPOINT: profiles/email
VUE_APP_LOGIN_PATH: auth/login
VUE_APP_STRIPE_KEY: pk_test_xxxx
VUE_APP_PAYMENTS_URL: http://localhost:3000/payments
VUE_APP_RESET_PASSWORD_PATH: auth/reset-password
VUE_APP_RESET_REQUEST_PATH: auth/reset-request
VUE_APP_SENTRY_ENVIRONMENT: dev
test_server:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:10.8
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
strategy:
matrix:
node-version: [12.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: Server, npm install, build, and test
run: |
cd server
npm ci
npm run build --if-present
npm run test:database:setup
npm test
env:
CI: true
TEST_DATABASE_URL: postgres://postgres:postgres@localhost/postgres
STRIPE_KEY: ${{ secrets.STRIPE_TEST_KEY }}
FROM_EMAIL_ADDRESS: username@domain.org
EMAIL_PASSWORD: email_password
FRONTEND_URL: http://localhost:8080
STUDENT_DISCOUNT_CODES: thing1,thing2,thing3
SENTRY_ENV: ci
deploy_server:
if: endsWith(github.ref, '/production') || endsWith(github.ref, '/staging')
runs-on: ubuntu-latest
needs: [test_server, test_client]
steps:
- uses: actions/checkout@v1
- name: maybe set staging env
if: endsWith(github.ref, '/staging')
run: |
echo "::set-env name=HEROKU_APP_NAME::develop-denver-staging"
- name: maybe set prod env
if: endsWith(github.ref, '/production')
run: |
echo "::set-env name=HEROKU_APP_NAME::develop-denver"
- name: "deploy to heroku"
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
if: env.HEROKU_APP_NAME
run: git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git HEAD:master
deploy_client:
if: endsWith(github.ref, '/production') || endsWith(github.ref, '/staging')
runs-on: ubuntu-latest
needs: [deploy_server]
steps:
- uses: actions/checkout@v1
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: build static files
run: |
cd client
npm ci
npm run build:$(basename $GITHUB_REF)
env:
CI: true
VUE_APP_API_URL: http://localhost:3000
VUE_APP_IMAGE_UPLOAD_URL: http://localhost:3001/images
VUE_APP_UNIQUE_EMAIL_ENDPOINT: profiles/email
VUE_APP_LOGIN_PATH: auth/login
VUE_APP_STRIPE_KEY: pk_test_xxxx
VUE_APP_PAYMENTS_URL: http://localhost:3000/payments
VUE_APP_RESET_PASSWORD_PATH: auth/reset-password
VUE_APP_RESET_REQUEST_PATH: auth/reset-request
VUE_APP_SENTRY_ENVIRONMENT: dev
- name: deploy to firebase
run: |
curl -Lo ./firebase_bin https://firebase.tools/bin/linux/latest
chmod +x ./firebase_bin
./firebase_bin deploy -P $(basename $GITHUB_REF)
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}