-
Notifications
You must be signed in to change notification settings - Fork 62
143 lines (109 loc) · 4.04 KB
/
main.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: main
on:
push:
branches: [ main ]
pull_request:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUST_BACKTRACE: "1"
RISC0_CRATE_VERSION: "^0.21"
RISC0_TOOLCHAIN_VERSION: v2024-02-08.1
jobs:
test:
runs-on: ubuntu-latest
steps:
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842
- name: checkout dummy commit (submodule bug workaround)
run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :"
- name: clone repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install rust
uses: risc0/risc0/.github/actions/rustup@release-0.21
- name: Install Foundry
uses: risc0/foundry-toolchain@2fe7e70b520f62368a0e3c464f997df07ede420f
- name: Install cargo-install
uses: risc0/cargo-install@v1
with:
crate: cargo-binstall
- name: Cargo binstall cargo-risczero
run: cargo binstall -y --force cargo-risczero@${{ env.RISC0_CRATE_VERSION }}
- name: risczero toolchain install
run: cargo risczero install --version $RISC0_TOOLCHAIN_VERSION
- name: build rust guest
run: cargo build
- name: build solidity contracts
run: forge build
- name: run tests
run: cargo test
- name: run foundry tests in dev mode
env:
RISC0_DEV_MODE: true
run: forge test -vvv
bonsai-integration:
name: test bonsai integration
runs-on: ubuntu-latest
steps:
# This is a workaround from: https://github.com/actions/checkout/issues/590#issuecomment-970586842
- name: checkout dummy commit (submodule bug workaround)
run: "git checkout -f $(git -c user.name=x -c user.email=x@x commit-tree $(git hash-object -t tree /dev/null) < /dev/null) || :"
- name: clone repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install rust
uses: risc0/risc0/.github/actions/rustup@release-0.21
- name: Install Foundry
uses: risc0/foundry-toolchain@2fe7e70b520f62368a0e3c464f997df07ede420f
- name: Install cargo-install
uses: risc0/cargo-install@v1
with:
crate: cargo-binstall
- name: Cargo binstall cargo-risczero
run: cargo binstall -y --force cargo-risczero@${{ env.RISC0_CRATE_VERSION }}
- name: risczero toolchain install
run: cargo risczero install --version $RISC0_TOOLCHAIN_VERSION
- name: build rust guest
run: cargo build
- name: build solidity contracts
run: forge build
- name: run foundry tests with bonsai proving
env:
BONSAI_API_URL: ${{ secrets.BONSAI_API_URL }}
BONSAI_API_KEY: ${{ secrets.BONSAI_API_KEY }}
RISC0_DEV_MODE: false
run: forge test -vvv
lint:
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v3
with:
submodules: recursive
- name: install rust
uses: risc0/risc0/.github/actions/rustup@release-0.21
- name: install cargo-sort
uses: risc0/cargo-install@v1
with:
crate: cargo-sort
version: "=1.0.7"
- name: Install Foundry
uses: risc0/foundry-toolchain@2fe7e70b520f62368a0e3c464f997df07ede420f
- name: lint rust code
run: cargo fmt --all --check
- name: lint guest rust code
working-directory: methods/guest
run: cargo fmt --all --check
- name: lint cargo files
run: cargo sort --workspace --check
- name: lint guest cargo files
working-directory: methods/guest
run: cargo sort --workspace --check
- name: check solidity code formatting
run: forge fmt --check