-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (60 loc) · 1.98 KB
/
ci.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
name: "Continuous Integration"
on: [push]
jobs:
ci:
name: Build and test on Node ${{ matrix.node }} and ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node: ['14.x']
os: [ubuntu-latest] # previously [ubuntu-latest, windows-latest, macOS-latest]
timeout-minutes: 10
steps:
- name: Checkout Repo
uses: actions/checkout@master
# needed for the Firebase emulator
- uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
# Firebase Functions currently run inside Node 14
- uses: actions/setup-node@v2
with:
node-version: '14.x'
# Get location of cache directory
- name: Get npm cache directory
id: npm-cache-dir
run: |
echo "::set-output name=dir::$(npm config get cache)"
echo "::set-output name=firebase_tool::$(npm config get prefix)/lib/node_modules/firebase-tools"
# Cache stuff
- name: Cache install data
uses: actions/cache@v2
with:
path: |
~/.cache/firebase/emulators/
${{ steps.npm-cache-dir.outputs.dir }}
${{ steps.npm-cache-dir.outputs.firebase_tool }}
key: ${{ runner.os }}-${{ hashFiles('functions/package-lock.json') }}
# npm install
- name: Install deps (with cache)
uses: bahmutov/npm-install@v1
with:
working-directory: functions
# Build stuff
- name: Build
run: npm run build
working-directory: functions
# Install Firebase emulator
- name: Install https://firebase.tools
run: npm install -g [email protected]
# Run tests
- name: Run tests inside Firebase Emulator
working-directory: functions
run: npm test
# Save coverage report
#- name: Archive Coverage Report
# uses: actions/upload-artifact@v2
# with:
# name: Coverage Report
# path: functions/coverage