-
Notifications
You must be signed in to change notification settings - Fork 2
88 lines (74 loc) · 2.73 KB
/
node.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
81
82
83
84
85
86
87
88
name: Node.js CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18"
cache: "yarn"
- name: Cache node_modules
uses: actions/cache@v4
id: cached-node_modules
with:
path: |
node_modules
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}-${{ hashFiles('.github/workflows/node.yml') }}
- name: Install
if: steps.cached-node_modules.outputs.cache-hit != 'true'
env:
# This is because package.json contains `minimalcss` which depends
# on `puppeteer`.
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: 1
run: yarn --frozen-lockfile
- name: Lint
run: yarn lint
- name: Prettier
run: yarn pretty
- name: Cache node_modules (functions)
uses: actions/cache@v4
id: cached-node_modules-functions
with:
path: |
functions/node_modules
key: ${{ runner.os }}-${{ hashFiles('functions/yarn.lock') }}-${{ hashFiles('.github/workflows/e2e.yml') }}
- name: Install (functions)
if: steps.cached-node_modules-functions.outputs.cache-hit != 'true'
working-directory: functions
run: yarn --frozen-lockfile
- name: Lint (functions)
working-directory: functions
run: yarn lint
- name: Prettier (functions)
working-directory: functions
run: yarn pretty
- name: Run dev server
env:
# These are NOT secrets. It's public stuff.
PREACT_APP_FIREBASE_APIKEY: AIzaSyBlMzrsBR_KWXDdgntBgnCThjRqr-0I8js
PREACT_APP_FIREBASE_AUTHDOMAIN: groce-dev.firebaseapp.com
PREACT_APP_FIREBASE_DATABASEURL: https://groce-dev.firebaseio.com
PREACT_APP_FIREBASE_PROJECTID: groce-dev
PREACT_APP_FIREBASE_STORAGEBUCKET: groce-dev.appspot.com
PREACT_APP_FIREBASE_MESSAGINGSENDERID: 170241343352
PREACT_APP_FIREBASE_APPID: 1:170241343352:web:5282dd555337af2a62d28d
run: yarn dev > /tmp/stdout.log 2> /tmp/stderr.log &
- name: Wait for dev server
run: |
# Just a slight delay to wait until the dev server is ready.
sleep 5
curl --retry-connrefused --retry 5 http://localhost:8080 > /dev/null
- name: Debug server's stdout and stderr if tests failed
if: failure()
run: |
echo "STDOUT..................................................."
cat /tmp/stdout.log
echo ""
echo "STDERR..................................................."
cat /tmp/stderr.log