-
Notifications
You must be signed in to change notification settings - Fork 1
149 lines (128 loc) · 4.35 KB
/
prover.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
144
145
146
147
148
149
name: prover tests
on:
push:
paths:
- '**/Cargo.toml'
- '**/*.rs'
- 'prover/**'
- .github/workflows/prover.yml
- .rustfmt.toml
concurrency:
cancel-in-progress: true
group: ${{github.workflow}}-${{github.ref}}
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings -A unknown-lints
RUST_BACKTRACE: full
jobs:
start-runner:
name: Start EC2 runner
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.AWS_GITHUB_TOKEN }}
ec2-image-id: ${{ vars.EC2_IMAGE_ID }}
ec2-instance-type: c7a.4xlarge
subnet-id: ${{ vars.SUBNET_ID }}
security-group-id: ${{ vars.SECURITY_GROUP_ID }}
prover-tests:
needs: start-runner # required to start the main job when the runner is ready
runs-on: ${{ needs.start-runner.outputs.label }}
defaults:
run:
working-directory: prover
strategy:
fail-fast: true
matrix:
node-version: [20]
steps:
- name: Checkout
uses: actions/checkout@v3
# For EC2 runner
- name: Set HOME env variable
run: |
echo "HOME=/root" >> ${GITHUB_ENV}
# For EC2 runner
- name: Add pre-installed cargo and rustc executables to github path.
run: |
echo "$HOME/.cargo/bin" >> ${GITHUB_PATH}
# For EC2 runner
- name: Add pre-installed yarn executable to github path.
run: |
echo "$HOME/.nvm/versions/node/v20.11.0/bin" >> ${GITHUB_PATH}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
# Based on https://github.com/actions/cache/blob/main/examples.md#node---yarn-2
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
.yarn
node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Cargo cache
uses: Swatinem/rust-cache@v2
- name: Run rustfmt
run: |
cargo fmt --check
- name: Cargo sort
run: |
cargo +stable install cargo-sort
cargo +stable sort --workspace --check
- name: Run clippy
run: |
cargo clippy --no-deps
- name: Run integration_test
run: |
./scripts/integration_test
- name: Run test_prover (dry run)
run: |
DRY_RUN=1 ./scripts/test_prover
- name: Run test_prover (dry run, compute submission id)
run: |
DRY_RUN=1 OUTPUT_SUBMISSION_ID=1 ./scripts/test_prover
- name: Run aggregation benchmark
run: |
DRY_RUN=1 ./scripts/aggregation_benchmark
stop-runner:
name: Stop EC2 runner
needs:
- start-runner
- prover-tests
runs-on: ubuntu-latest
if: ${{ always() }} # required to stop the runner even if an error happened in the previous jobs
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.AWS_GITHUB_TOKEN }}
label: ${{ needs.start-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}