-
Notifications
You must be signed in to change notification settings - Fork 2
64 lines (52 loc) · 2.11 KB
/
node.js.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
name: nodejs
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
steps:
- uses: actions/checkout@v2
- name: Cache rust and zkutil
id: cache-zkutil
uses: actions/cache@v2
with:
# NOTE: Cache is reset if we cache whole `~/.cargo` instead of `~/.cargo/bin/zkutil`.
# Not sure the reason why this happens.
path: ~/.cargo/bin/zkutil
key: ${{ runner.os }}-zkutil-${{ hashFiles('./scripts/installZkutil.sh') }}
# https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path
- name: Prepend cargo's bin directory to PATH
run: echo "~/.cargo/bin" >> $GITHUB_PATH
- name: Install rust and zkutil
if: steps.cache-zkutil.outputs.cache-hit != 'true'
run: ./scripts/installZkutil.sh
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run lint
- name: Cache circuits
id: cache-circuits
uses: actions/cache@v2
with:
# NOTE: Just roughly cache all compiled circuits. It can be split further.
path: build
# NOTE: Using hash of the following files for the reasons:
# - `package.json`: script possibly changes
# - `package-lock.json`: circom/snarkjs version possibly changes
# - `installZkutil.sh`: zkutil version possibly changes
# FIXME:
# - `proofOfSMP.circom`, proofSuccessfulSMP.circom: circom code possibly change, but
# we should also consider the imported circuits.
key: ${{ runner.os }}-circuits-${{ hashFiles('./package.json', './package-lock.json', './scripts/installZkutil.sh', 'circuits/instance/proofOfSMP.circom', 'circuits/instance/proofSuccessfulSMP.circom') }}
- name: Build circuits if hasn't been built
if: steps.cache-circuits.outputs.cache-hit != 'true'
run: npm run extract_keys
- run: npm test