Repository navigation
104 lines (86 loc) · 3.2 KB
/
Copy pathtest.yml
File metadata and controls
104 lines (86 loc) · 3.2 KB
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
name: CI
permissions:
contents: read
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
env:
FOUNDRY_PROFILE: ci
GIWA_SEPOLIA_RPC_URL: https://sepolia-rpc.giwa.io
# Ethereum Sepolia, for the portability suite that calls MetaMask's own deployed manager.
# A public endpoint rather than a secret: the property under test is their bytecode, which
# is the same whoever reads it.
ETH_SEPOLIA_RPC_URL: https://ethereum-sepolia-rpc.publicnode.com
jobs:
contracts:
name: Contracts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- uses: foundry-rs/foundry-toolchain@v1
- name: Format
run: forge fmt --check
- name: Build
run: forge build --sizes
- name: Unit and integration tests (fuzz 5000, invariants 1000x256)
run: forge test --no-match-path 'test/fork/*'
fork:
name: Fork tests against live Dojang
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- uses: foundry-rs/foundry-toolchain@v1
# Pinned at block 31909542 against GIWA Sepolia's public RPC. The endpoint load-balances
# across backends that sometimes fail under load, so this job is retried once.
# FORK_TESTS opts in; without it these suites skip, which is what keeps a bare `forge test`
# from depending on a shared public endpoint. Here we want them to actually run, so the step
# afterwards fails the job if they did not - a green check over zero executed tests would be
# worse than a red one.
- name: Fork tests
uses: nick-fields/retry@v3
env:
FORK_TESTS: true
with:
timeout_minutes: 10
max_attempts: 2
command: forge test --match-path 'test/fork/*' | tee fork.log
- name: Assert the fork suites actually ran
run: |
grep -qE '15 tests passed' fork.log || {
echo "::error::fork suites did not run all 15 tests - see fork.log"; exit 1; }
grep -qE '0 skipped' fork.log || {
echo "::error::fork suites skipped; FORK_TESTS or the endpoint is wrong"; exit 1; }
byte-parity:
name: Cross-language byte parity
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with:
submodules: recursive
- uses: foundry-rs/foundry-toolchain@v1
- uses: pnpm/action-setup@v4
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- name: Install
run: pnpm install --frozen-lockfile
- name: Regenerate Solidity fixtures and assert the SDK reproduces them
run: |
forge script script/GenFixtures.s.sol
pnpm tsx sdk/test/encoding.test.ts
# The sentence a person reads before signing is generated from the same structure as the
# bytes they sign. If encode and decode ever stop being inverses, a user can be shown a
# permission that is not the one they granted.
- name: Assert the policy codec is a pair of inverses
run: pnpm tsx sdk/test/policy.test.ts
- name: Typecheck
run: pnpm tsc --noEmit