Skip to content

Commit df1b927

Browse files
authored
Merge pull request #1882 from opentensor/sam-make-ci-cachier
make rust cache much cachier
2 parents 7e6e9a1 + 6842594 commit df1b927

File tree

8 files changed

+151
-124
lines changed

8 files changed

+151
-124
lines changed

.github/workflows/cargo-audit.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ jobs:
2727
- name: Utilize Shared Rust Cache
2828
uses: Swatinem/rust-cache@v2
2929
with:
30-
key: "cargo-audit"
30+
key: cargo-audit
31+
cache-on-failure: true
3132

3233
- name: Install cargo-audit
3334
run: cargo install --force cargo-audit

.github/workflows/check-devnet.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ jobs:
2626
- name: Utilize Shared Rust Cache
2727
uses: Swatinem/rust-cache@v2
2828
with:
29-
key: "spec-version"
29+
key: try-runtime
30+
cache-on-failure: true
31+
save-if: true
3032

3133
- name: Install substrate-spec-version
3234
run: cargo install substrate-spec-version

.github/workflows/check-finney.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Utilize Shared Rust Cache
2727
uses: Swatinem/rust-cache@v2
2828
with:
29-
key: "spec-version"
29+
key: try-runtime
3030

3131
- name: Install substrate-spec-version
3232
run: cargo install substrate-spec-version

.github/workflows/check-rust.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ jobs:
4040
4141
- name: Utilize Shared Rust Cache
4242
uses: Swatinem/rust-cache@v2
43+
with:
44+
key: cargo-fmt
45+
cache-on-failure: true
4346

4447
- name: cargo fmt
4548
run: cargo +nightly fmt --check --all
@@ -61,6 +64,9 @@ jobs:
6164
6265
- name: Utilize Shared Rust Cache
6366
uses: Swatinem/rust-cache@v2
67+
with:
68+
key: clippy-default-features
69+
cache-on-failure: true
6470

6571
- name: cargo clippy --workspace --all-targets -- -D warnings
6672
run: cargo clippy --workspace --all-targets -- -D warnings
@@ -83,6 +89,9 @@ jobs:
8389
8490
- name: Utilize Shared Rust Cache
8591
uses: Swatinem/rust-cache@v2
92+
with:
93+
key: lints
94+
cache-on-failure: true
8695

8796
- name: check lints
8897
run: |
@@ -107,6 +116,9 @@ jobs:
107116
108117
- name: Utilize Shared Rust Cache
109118
uses: Swatinem/rust-cache@v2
119+
with:
120+
key: clippy-all-features
121+
cache-on-failure: true
110122

111123
- name: cargo clippy --workspace --all-targets --all-features -- -D warnings
112124
run: cargo clippy --workspace --all-targets --all-features -- -D warnings
@@ -129,6 +141,9 @@ jobs:
129141
130142
- name: Utilize Shared Rust Cache
131143
uses: Swatinem/rust-cache@v2
144+
with:
145+
key: cargo-test
146+
cache-on-failure: true
132147

133148
- name: cargo test --workspace --all-features
134149
run: cargo test --workspace --all-features
@@ -151,6 +166,9 @@ jobs:
151166
152167
- name: Utilize Shared Rust Cache
153168
uses: Swatinem/rust-cache@v2
169+
with:
170+
key: cargo-fix
171+
cache-on-failure: true
154172

155173
- name: cargo fix --workspace
156174
run: |
@@ -177,6 +195,9 @@ jobs:
177195

178196
- name: Utilize Shared Rust Cache
179197
uses: Swatinem/rust-cache@v2
198+
with:
199+
key: zepter
200+
cache-on-failure: true
180201

181202
- name: Install Zepter
182203
run: cargo install --locked -q zepter && zepter --version

.github/workflows/check-testnet.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ jobs:
2626
- name: Utilize Shared Rust Cache
2727
uses: Swatinem/rust-cache@v2
2828
with:
29-
key: "spec-version"
29+
key: try-runtime
30+
cache-on-failure: true
3031

3132
- name: Install substrate-spec-version
3233
run: cargo install substrate-spec-version

.github/workflows/run-benchmarks.yml

Lines changed: 119 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -19,123 +19,124 @@ jobs:
1919
runs-on: Benchmarking
2020

2121
env:
22-
SKIP_BENCHMARKS: '0'
23-
AUTO_COMMIT_WEIGHTS: '1'
22+
SKIP_BENCHMARKS: "0"
23+
AUTO_COMMIT_WEIGHTS: "1"
2424

2525
steps:
26-
# ──────────────────────────────────────────────────────────────────
27-
- name: Check out PR branch
28-
if: ${{ env.SKIP_BENCHMARKS != '1' }}
29-
uses: actions/checkout@v4
30-
with:
31-
repository: ${{ github.event.pull_request.head.repo.full_name }}
32-
ref: ${{ github.event.pull_request.head.ref }}
33-
fetch-depth: 0
34-
35-
- name: Install GitHub CLI
36-
if: ${{ env.SKIP_BENCHMARKS != '1' }}
37-
run: |
38-
sudo apt-get update
39-
sudo apt-get install -y gh
40-
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
41-
42-
# (1) — first skip‑label check
43-
- name: Check skip label
44-
if: ${{ env.SKIP_BENCHMARKS != '1' }}
45-
run: |
46-
labels=$(gh pr view ${{ github.event.pull_request.number }} \
47-
--repo "${{ github.repository }}" \
48-
--json labels --jq '.labels[].name')
49-
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
50-
echo "skip-validate-benchmarks label found — skipping benchmarks."
51-
echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
52-
fi
53-
54-
- name: Install system dependencies
55-
if: ${{ env.SKIP_BENCHMARKS != '1' }}
56-
run: |
57-
sudo apt-get update
58-
sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler
59-
60-
# (2)
61-
- name: Check skip label
62-
if: ${{ env.SKIP_BENCHMARKS != '1' }}
63-
run: |
64-
labels=$(gh pr view ${{ github.event.pull_request.number }} \
65-
--repo "${{ github.repository }}" \
66-
--json labels --jq '.labels[].name')
67-
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
68-
echo "skip-validate-benchmarks label found — skipping benchmarks."
69-
echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
70-
fi
71-
72-
- name: Install Rust toolchain
73-
if: ${{ env.SKIP_BENCHMARKS != '1' }}
74-
uses: actions-rs/toolchain@v1
75-
with:
76-
profile: minimal
77-
toolchain: stable
78-
79-
# (3)
80-
- name: Check skip label
81-
if: ${{ env.SKIP_BENCHMARKS != '1' }}
82-
run: |
83-
labels=$(gh pr view ${{ github.event.pull_request.number }} \
84-
--repo "${{ github.repository }}" \
85-
--json labels --jq '.labels[].name')
86-
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
87-
echo "skip-validate-benchmarks label found — skipping benchmarks."
88-
echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
89-
fi
90-
91-
- name: Cache Rust build
92-
if: ${{ env.SKIP_BENCHMARKS != '1' }}
93-
uses: Swatinem/rust-cache@v2
94-
with:
95-
key: bench-${{ hashFiles('**/Cargo.lock') }}
96-
97-
# (4)
98-
- name: Check skip label
99-
if: ${{ env.SKIP_BENCHMARKS != '1' }}
100-
run: |
101-
labels=$(gh pr view ${{ github.event.pull_request.number }} \
102-
--repo "${{ github.repository }}" \
103-
--json labels --jq '.labels[].name')
104-
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
105-
echo "skip-validate-benchmarks label found — skipping benchmarks."
106-
echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
107-
fi
108-
109-
- name: Build node with benchmarks
110-
if: ${{ env.SKIP_BENCHMARKS != '1' }}
111-
run: |
112-
cargo build --profile production -p node-subtensor --features runtime-benchmarks
113-
114-
# (5)
115-
- name: Check skip label
116-
if: ${{ env.SKIP_BENCHMARKS != '1' }}
117-
run: |
118-
labels=$(gh pr view ${{ github.event.pull_request.number }} \
119-
--repo "${{ github.repository }}" \
120-
--json labels --jq '.labels[].name')
121-
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
122-
echo "skip-validate-benchmarks label found — skipping benchmarks."
123-
echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
124-
fi
125-
126-
- name: Run & validate benchmarks
127-
if: ${{ env.SKIP_BENCHMARKS != '1' }}
128-
run: |
129-
chmod +x scripts/benchmark_action.sh
130-
scripts/benchmark_action.sh
131-
132-
# (6) — final check after run
133-
- name: Check skip label after run
134-
if: ${{ env.SKIP_BENCHMARKS != '1' }}
135-
run: |
136-
labels=$(gh pr view ${{ github.event.pull_request.number }} \
137-
--repo "${{ github.repository }}" \
138-
--json labels --jq '.labels[].name')
139-
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
140-
echo "skip-validate-benchmarks label was found — but benchmarks already ran."
141-
fi
26+
# ──────────────────────────────────────────────────────────────────
27+
- name: Check out PR branch
28+
if: ${{ env.SKIP_BENCHMARKS != '1' }}
29+
uses: actions/checkout@v4
30+
with:
31+
repository: ${{ github.event.pull_request.head.repo.full_name }}
32+
ref: ${{ github.event.pull_request.head.ref }}
33+
fetch-depth: 0
34+
35+
- name: Install GitHub CLI
36+
if: ${{ env.SKIP_BENCHMARKS != '1' }}
37+
run: |
38+
sudo apt-get update
39+
sudo apt-get install -y gh
40+
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token
41+
42+
# (1) — first skip‑label check
43+
- name: Check skip label
44+
if: ${{ env.SKIP_BENCHMARKS != '1' }}
45+
run: |
46+
labels=$(gh pr view ${{ github.event.pull_request.number }} \
47+
--repo "${{ github.repository }}" \
48+
--json labels --jq '.labels[].name')
49+
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
50+
echo "skip-validate-benchmarks label found — skipping benchmarks."
51+
echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
52+
fi
53+
54+
- name: Install system dependencies
55+
if: ${{ env.SKIP_BENCHMARKS != '1' }}
56+
run: |
57+
sudo apt-get update
58+
sudo apt-get install -y clang curl libssl-dev llvm libudev-dev protobuf-compiler
59+
60+
# (2)
61+
- name: Check skip label
62+
if: ${{ env.SKIP_BENCHMARKS != '1' }}
63+
run: |
64+
labels=$(gh pr view ${{ github.event.pull_request.number }} \
65+
--repo "${{ github.repository }}" \
66+
--json labels --jq '.labels[].name')
67+
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
68+
echo "skip-validate-benchmarks label found — skipping benchmarks."
69+
echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
70+
fi
71+
72+
- name: Install Rust toolchain
73+
if: ${{ env.SKIP_BENCHMARKS != '1' }}
74+
uses: actions-rs/toolchain@v1
75+
with:
76+
profile: minimal
77+
toolchain: stable
78+
79+
# (3)
80+
- name: Check skip label
81+
if: ${{ env.SKIP_BENCHMARKS != '1' }}
82+
run: |
83+
labels=$(gh pr view ${{ github.event.pull_request.number }} \
84+
--repo "${{ github.repository }}" \
85+
--json labels --jq '.labels[].name')
86+
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
87+
echo "skip-validate-benchmarks label found — skipping benchmarks."
88+
echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
89+
fi
90+
91+
- name: Cache Rust build
92+
if: ${{ env.SKIP_BENCHMARKS != '1' }}
93+
uses: Swatinem/rust-cache@v2
94+
with:
95+
key: bench-${{ hashFiles('**/Cargo.lock') }}
96+
cache-on-failure: true
97+
98+
# (4)
99+
- name: Check skip label
100+
if: ${{ env.SKIP_BENCHMARKS != '1' }}
101+
run: |
102+
labels=$(gh pr view ${{ github.event.pull_request.number }} \
103+
--repo "${{ github.repository }}" \
104+
--json labels --jq '.labels[].name')
105+
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
106+
echo "skip-validate-benchmarks label found — skipping benchmarks."
107+
echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
108+
fi
109+
110+
- name: Build node with benchmarks
111+
if: ${{ env.SKIP_BENCHMARKS != '1' }}
112+
run: |
113+
cargo build --profile production -p node-subtensor --features runtime-benchmarks
114+
115+
# (5)
116+
- name: Check skip label
117+
if: ${{ env.SKIP_BENCHMARKS != '1' }}
118+
run: |
119+
labels=$(gh pr view ${{ github.event.pull_request.number }} \
120+
--repo "${{ github.repository }}" \
121+
--json labels --jq '.labels[].name')
122+
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
123+
echo "skip-validate-benchmarks label found — skipping benchmarks."
124+
echo "SKIP_BENCHMARKS=1" >> "$GITHUB_ENV"
125+
fi
126+
127+
- name: Run & validate benchmarks
128+
if: ${{ env.SKIP_BENCHMARKS != '1' }}
129+
run: |
130+
chmod +x scripts/benchmark_action.sh
131+
scripts/benchmark_action.sh
132+
133+
# (6) — final check after run
134+
- name: Check skip label after run
135+
if: ${{ env.SKIP_BENCHMARKS != '1' }}
136+
run: |
137+
labels=$(gh pr view ${{ github.event.pull_request.number }} \
138+
--repo "${{ github.repository }}" \
139+
--json labels --jq '.labels[].name')
140+
if echo "$labels" | grep -q "skip-validate-benchmarks"; then
141+
echo "skip-validate-benchmarks label was found — but benchmarks already ran."
142+
fi

.github/workflows/try-runtime.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ jobs:
6060
- name: Utilize Shared Rust Cache
6161
uses: Swatinem/rust-cache@v2
6262
with:
63-
key: "try-runtime"
63+
key: try-runtime
64+
cache-on-failure: true
6465

6566
- name: Run Try Runtime Checks
6667
uses: "paritytech/try-runtime-gha@v0.1.0"

runtime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
218218
// `spec_version`, and `authoring_version` are the same between Wasm and native.
219219
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
220220
// the compatible custom types.
221-
spec_version: 297,
221+
spec_version: 298,
222222
impl_version: 1,
223223
apis: RUNTIME_API_VERSIONS,
224224
transaction_version: 1,

0 commit comments

Comments
 (0)