-
Notifications
You must be signed in to change notification settings - Fork 4
118 lines (101 loc) · 4.27 KB
/
Copy pathci.yml
File metadata and controls
118 lines (101 loc) · 4.27 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
jobs:
check:
name: Check, lint, and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
# No `with: toolchain:` — `dtolnay/rust-toolchain` honours the
# rust-toolchain.toml file at the repo root. Pinning lives in
# one place; CI and local devs run the same rustc, which is
# what makes the migration-safety check in the next job
# actually able to compare hashes.
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Check formatting
run: cargo fmt --check
- name: Run clippy
run: cargo clippy --all-targets -- -D warnings
- name: Run tests
run: cargo test
- name: Check contract builds (WASM)
run: ./scripts/build-wasm.sh -p site-contract -p site-delegate
- name: Check UI builds (WASM)
run: cargo check -p delta-ui --target wasm32-unknown-unknown
migration-check:
name: Delegate migration safety
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
# See note in the `check` job: pin lives in rust-toolchain.toml.
uses: dtolnay/rust-toolchain@stable
- name: Install b3sum
run: cargo install b3sum
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Print toolchain (for diagnostics if hashes mismatch)
run: rustc --version --verbose
- name: Verify delegate WASM matches source
run: |
./scripts/build-wasm.sh -p site-delegate
COMMITTED=$(b3sum ui/public/contracts/site_delegate.wasm | cut -d' ' -f1)
BUILT=$(b3sum target/wasm32-unknown-unknown/release/site_delegate.wasm | cut -d' ' -f1)
if [ "$COMMITTED" != "$BUILT" ]; then
echo "::error::Committed delegate WASM does not match what this toolchain produced from source."
echo " committed: $COMMITTED"
echo " built: $BUILT"
echo ""
echo "If you intentionally changed delegate code, run:"
echo " ./scripts/add-migration.sh V_N \"<short description>\""
echo " ./scripts/sync-wasm.sh"
echo ""
echo "If this CI failure surprises you (no delegate change in this PR),"
echo "the toolchain may have drifted from rust-toolchain.toml. The runner"
echo "above prints rustc --version --verbose; compare against:"
echo " $(grep '^channel' rust-toolchain.toml || echo '(rust-toolchain.toml not found)')"
exit 1
fi
- name: Verify contract WASM matches source
run: |
./scripts/build-wasm.sh -p site-contract
COMMITTED=$(b3sum ui/public/contracts/site_contract.wasm | cut -d' ' -f1)
BUILT=$(b3sum target/wasm32-unknown-unknown/release/site_contract.wasm | cut -d' ' -f1)
if [ "$COMMITTED" != "$BUILT" ]; then
echo "::error::Committed contract WASM does not match what this toolchain produced from source."
echo " committed: $COMMITTED"
echo " built: $BUILT"
echo ""
echo "If you intentionally changed contract code or common/, run:"
echo " ./scripts/add-contract-migration.sh C_N \"<short description>\""
echo " ./scripts/sync-wasm.sh"
echo ""
echo "If this CI failure surprises you (no contract / common/ change in"
echo "this PR), the toolchain may have drifted from rust-toolchain.toml."
echo "The runner above prints rustc --version --verbose; compare against:"
echo " $(grep '^channel' rust-toolchain.toml || echo '(rust-toolchain.toml not found)')"
exit 1
fi