This repository has been archived by the owner on Sep 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
110 lines (105 loc) · 3.06 KB
/
rust.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: Rust
on:
push:
branches: [ '*' ]
tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ]
pull_request:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo target
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Cargo build
uses: actions-rs/cargo@v1
with:
command: build
- name: Cargo test
uses: actions-rs/cargo@v1
with:
command: test
- name: Clippy check
uses: actions-rs/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifact `zkutil`
uses: actions/[email protected]
with:
name: zkutil
path: target/debug/zkutil
test-json:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download artifact `zkutil`
uses: actions/download-artifact@v1
with:
name: zkutil
- run: chmod +x ./zkutil/zkutil
- name: Test
run: |
npm init -y
npm install [email protected] [email protected]
npx circom
./zkutil/zkutil setup
./zkutil/zkutil export-keys
./zkutil/zkutil generate-verifier
npx snarkjs calculatewitness
./zkutil/zkutil prove
./zkutil/zkutil verify
npx snarkjs verify
test-r1cs:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download artifact `zkutil`
uses: actions/download-artifact@v1
with:
name: zkutil
- run: chmod +x ./zkutil/zkutil
- name: Test
run: |
npm init -y
npm install circom snarkjs
npx circom -rw
./zkutil/zkutil setup
./zkutil/zkutil export-keys
./zkutil/zkutil generate-verifier
npx snarkjs wc
./zkutil/zkutil prove
./zkutil/zkutil verify
npx snarkjs g16v
publish:
runs-on: ubuntu-latest
needs: [test-json, test-r1cs]
if: startsWith(github.ref, 'refs/tags')
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Check Cargo.toml version vs tag
run: |
[ ${GITHUB_REF#refs/tags/v} = $(grep "^version" Cargo.toml | grep -o "[0-9.]*") ] || (echo "Git tag doesn't match version in Cargo.toml" && false)
- name: Publish to crates.io
uses: actions-rs/cargo@v1
with:
command: publish
args: --no-verify --token ${{ secrets.CRATES_IO_TOKEN }}