forked from ethereum-optimism/optimism
-
Notifications
You must be signed in to change notification settings - Fork 34
158 lines (130 loc) · 4.5 KB
/
cannon.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
150
151
152
153
154
155
156
157
158
name: Cannon Tests
env:
FOUNDRY_PROFILE: ci
OP_E2E_CANNON_ENABLED: "false"
on:
push:
branches: [celestia-develop]
pull_request:
branches: [celestia-develop]
workflow_dispatch:
jobs:
contracts-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Install just command
- name: Install just
run: |
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to $HOME/.local/bin
echo "$HOME/.local/bin" >> $GITHUB_PATH
# Install Node.js with proper working directory for cache
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
cache: "npm"
cache-dependency-path: packages/contracts-bedrock/package-lock.json
# Install dependencies in the correct directory
- name: Install npm dependencies
working-directory: packages/contracts-bedrock
run: npm install
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: Install contract dependencies
working-directory: packages/contracts-bedrock
run: just install
- name: Pull artifacts
working-directory: packages/contracts-bedrock
run: bash scripts/ops/pull-artifacts.sh
- name: Build contracts
working-directory: packages/contracts-bedrock
run: forge build --deny-warnings
- name: Upload contract artifacts
uses: actions/upload-artifact@v4
with:
name: contract-artifacts
path: |
packages/contracts-bedrock/artifacts
packages/contracts-bedrock/forge-artifacts
packages/contracts-bedrock/cache
cannon-prestate:
needs: [contracts-build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download contract artifacts
uses: actions/download-artifact@v4
with:
name: contract-artifacts
path: packages/contracts-bedrock
- name: Build cannon
run: make cannon
- name: Build op-program
run: make op-program
- name: Cache cannon prestate
id: cache-prestate
uses: actions/cache@v4
with:
path: |
op-program/bin/prestate.bin.gz
op-program/bin/meta.json
op-program/bin/prestate-proof.json
key: cannon-prestate-${{ hashFiles('cannon/bin/cannon') }}-${{ hashFiles('op-program/bin/op-program-client.elf') }}
- name: Sanitize op-program guest
run: make -f cannon/Makefile sanitize-program GUEST_PROGRAM=op-program/bin/op-program-client.elf
- name: Generate cannon prestate
if: steps.cache-prestate.outputs.cache-hit != 'true'
run: make cannon-prestate
- name: Generate cannon-mt prestate
run: make cannon-prestate-mt
- name: Upload prestate artifacts
uses: actions/upload-artifact@v4
with:
name: prestate-artifacts
path: |
op-program/bin/prestate.bin.gz
op-program/bin/meta.json
op-program/bin/prestate-proof.json
cannon-go-test:
needs: [contracts-build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download contract artifacts
uses: actions/download-artifact@v4
with:
name: contract-artifacts
path: packages/contracts-bedrock
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: Build example binaries
working-directory: cannon/testdata/example
run: make elf
- name: Run Go lint
working-directory: cannon
run: make lint
- name: Create test results directory
run: |
mkdir -p tmp/test-results
mkdir -p tmp/testlogs
- name: Run tests
working-directory: cannon
run: |
go install gotest.tools/gotestsum@latest
gotestsum --format=testname --junitfile=../tmp/test-results/cannon.xml --jsonfile=../tmp/testlogs/log.json \
-- -parallel="$(nproc)" -coverpkg=github.com/ethereum-optimism/optimism/cannon/... -coverprofile=coverage.out ./...
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
files: ./cannon/coverage.out
flags: cannon-go-tests
- name: Upload test results
uses: actions/upload-artifact@v4
with:
name: test-results
path: |
tmp/test-results
tmp/testlogs