Skip to content

Commit 2e207fc

Browse files
committed
ci: generate test fixtures from pinned leanSpec commit
1 parent 2df5815 commit 2e207fc

File tree

1 file changed

+59
-6
lines changed

1 file changed

+59
-6
lines changed

.github/workflows/ci.yml

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,66 @@ jobs:
4747
steps:
4848
- uses: actions/checkout@v6
4949

50-
# NOTE: we download the latest fixtures since generating them in CI fails
51-
- name: Download test fixtures
52-
env:
53-
GH_TOKEN: ${{ github.token }}
50+
# Read the pinned leanSpec commit from the Makefile (single source of truth)
51+
- name: Get leanSpec pinned commit
52+
id: lean-spec
53+
run: echo "commit=$(grep 'LEAN_SPEC_COMMIT_HASH' Makefile | sed 's/.*:=//')" >> $GITHUB_OUTPUT
54+
55+
- name: Cache test fixtures
56+
id: cache-fixtures
57+
uses: actions/cache@v4
58+
with:
59+
path: leanSpec/fixtures
60+
key: leanspec-fixtures-${{ steps.lean-spec.outputs.commit }}
61+
62+
# All fixture generation steps are skipped when the cache hits
63+
- name: Checkout leanSpec at pinned commit
64+
if: steps.cache-fixtures.outputs.cache-hit != 'true'
65+
uses: actions/checkout@v6
66+
with:
67+
repository: leanEthereum/leanSpec
68+
ref: ${{ steps.lean-spec.outputs.commit }}
69+
path: leanSpec
70+
71+
- name: Install uv and Python 3.14
72+
if: steps.cache-fixtures.outputs.cache-hit != 'true'
73+
uses: astral-sh/setup-uv@v4
74+
with:
75+
enable-cache: true
76+
cache-dependency-glob: "leanSpec/pyproject.toml"
77+
python-version: "3.14"
78+
79+
- name: Sync leanSpec dependencies
80+
if: steps.cache-fixtures.outputs.cache-hit != 'true'
81+
working-directory: leanSpec
82+
run: uv sync --no-progress
83+
84+
- name: Get production keys URL hash
85+
if: steps.cache-fixtures.outputs.cache-hit != 'true'
86+
id: prod-keys-url
87+
working-directory: leanSpec
5488
run: |
55-
mkdir -p leanSpec/fixtures
56-
gh run download --repo leanEthereum/leanSpec --name fixtures-prod-scheme --dir leanSpec/fixtures
89+
URL=$(uv run python -c "from consensus_testing.keys import KEY_DOWNLOAD_URLS; print(KEY_DOWNLOAD_URLS['prod'])")
90+
HASH=$(echo -n "$URL" | sha256sum | awk '{print $1}')
91+
echo "hash=$HASH" >> $GITHUB_OUTPUT
92+
93+
- name: Cache production keys
94+
if: steps.cache-fixtures.outputs.cache-hit != 'true'
95+
id: cache-prod-keys
96+
uses: actions/cache@v4
97+
with:
98+
path: leanSpec/packages/testing/src/consensus_testing/test_keys/prod_scheme
99+
key: prod-keys-${{ steps.prod-keys-url.outputs.hash }}
100+
101+
- name: Download production keys
102+
if: steps.cache-fixtures.outputs.cache-hit != 'true' && steps.cache-prod-keys.outputs.cache-hit != 'true'
103+
working-directory: leanSpec
104+
run: uv run python -m consensus_testing.keys --download --scheme prod
105+
106+
- name: Generate test fixtures
107+
if: steps.cache-fixtures.outputs.cache-hit != 'true'
108+
working-directory: leanSpec
109+
run: uv run fill --fork=Devnet --scheme prod -o fixtures -n 2
57110

58111
- name: Setup Rust
59112
uses: dtolnay/rust-toolchain@master

0 commit comments

Comments
 (0)