-
Notifications
You must be signed in to change notification settings - Fork 108
155 lines (132 loc) · 5.65 KB
/
Copy pathverify-impl.yml
File metadata and controls
155 lines (132 loc) · 5.65 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
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
name: Verify (impl)
on:
workflow_call:
permissions:
contents: read
pull-requests: write
env:
MALACHITE_GIT_REF: "13bca14cd209d985c3adf101a02924acde8723a5"
# The default `info` log level is very noisy in CI test output; quiet it to errors only.
RUST_LOG: error
jobs:
test:
timeout-minutes: 20
runs-on:
- runs-on=${{ github.run_id }}
- runner=64cpu-linux-arm64
- volume=80gb
steps:
- name: Install Protoc
uses: taiki-e/install-action@v2
with:
tool: protoc
- uses: actions/checkout@v6
with:
repository: informalsystems/malachite
ref: ${{ env.MALACHITE_GIT_REF }}
path: ./malachite
# Malachite is a path dependency, and cargo fingerprints path deps by source-file mtime.
# actions/checkout stamps every file with the checkout time (always "now"), which is newer than
# the cached build artifacts, so cargo rebuilds all malachite crates on every run despite a cache
# hit. Pin the source mtimes to the checked-out commit's date: stable across runs and older than
# the cached artifacts, so cargo trusts the cached malachite build. Correctness on a ref bump is
# guaranteed by the rust-cache key below, which includes MALACHITE_GIT_REF, so a bump gets a cold
# cache and a full rebuild instead of reusing stale artifacts.
- name: Pin malachite source mtimes for cargo cache reuse
run: |
commit_ts=$(git -C ./malachite show -s --format=%cI HEAD)
find ./malachite -type f -not -path '*/.git/*' -exec touch -d "$commit_ts" {} +
- name: Install Rust 1.95.0
uses: dtolnay/rust-toolchain@1.95.0
with:
components: rustfmt, llvm-tools-preview
- uses: actions/setup-node@v6
with:
node-version: 22
- uses: actions/checkout@v6
with:
path: ./snapchain
fetch-depth: 0
# Cache cargo registry/git and the build target dir to speed up CI. Malachite is a path
# dependency whose artifacts rust-cache keeps, but cargo only reuses them because the mtime
# pinning step above stops the fresh checkout from invalidating them. MALACHITE_GIT_REF is part
# of the cache key so a ref bump lands on a cold cache and rebuilds malachite from scratch,
# rather than reusing artifacts from the previous ref.
- name: Cache cargo artifacts
uses: Swatinem/rust-cache@v2
with:
workspaces: ./snapchain
key: malachite-${{ env.MALACHITE_GIT_REF }}
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@v2
with:
tool: cargo-llvm-cov
- working-directory: ./snapchain
env:
RUSTFLAGS: "-Dwarnings -A mismatched_lifetime_syntaxes"
run: |
cargo llvm-cov --workspace --lcov --output-path lcov.info --ignore-filename-regex 'proto/'
cargo llvm-cov report --html --output-dir coverage --ignore-filename-regex 'proto/'
- name: Set up Python
if: github.event_name == 'pull_request'
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install diff-cover
if: github.event_name == 'pull_request'
run: pip install diff-cover==9.2.0
- name: Generate diff coverage report
if: github.event_name == 'pull_request'
working-directory: ./snapchain
run: |
diff-cover lcov.info \
--compare-branch=origin/${{ github.base_ref }} \
--markdown-report=diff-coverage.md \
--fail-under=0
- name: Post diff coverage comment
if: github.event_name == 'pull_request'
uses: marocchino/sticky-pull-request-comment@v3
with:
header: coverage
path: ./snapchain/diff-coverage.md
- working-directory: ./snapchain
env:
RUSTFLAGS: "-Dwarnings -A mismatched_lifetime_syntaxes"
run: cargo check --bins
- working-directory: ./snapchain
env:
RUSTFLAGS: "-Dwarnings -A mismatched_lifetime_syntaxes"
run: cargo fmt --all --check
# The L0 conformance corpus is checked in and must be reproducible: regenerating it without a
# protocol change must produce no diff. A diff here means encoding/hash/signature/state-root
# output changed and the committed corpus (and the protocol-repo copy) needs regenerating.
- name: Check conformance corpus is up to date
working-directory: ./snapchain
env:
RUSTFLAGS: "-Dwarnings -A mismatched_lifetime_syntaxes"
run: |
cargo test --test conformance_test generate_corpus -- --ignored --nocapture
git diff --exit-code -- tests/conformance/corpus \
|| (echo "::error::Conformance corpus is stale. Run: cargo test --test conformance_test generate_corpus -- --ignored, then sync farcasterxyz/protocol/vectors/" && exit 1)
- working-directory: ./snapchain/tests/client_parity_tests
run: |
npx node-gyp@12.2.0 install
yarn install
- working-directory: ./snapchain/tests/client_parity_tests
run: yarn test
- name: Upload coverage report
uses: actions/upload-artifact@v7
if: always()
with:
name: coverage-report
path: ./snapchain/coverage/
retention-days: 14
# Publish the L0 conformance corpus as a portable artifact an external client can download
# and run against in its own CI.
- name: Upload conformance corpus
uses: actions/upload-artifact@v7
if: always()
with:
name: conformance-corpus
path: ./snapchain/tests/conformance/
retention-days: 14