Skip to content

Commit 96da9fa

Browse files
authored
Fix CI running out of disk space (#2442)
* Use one cache for all CI runs * Increase partition size * Remove unused toolchain * Use cargo sparse index * Use cargo sparse index * Use cargo sparse index * Cache on failure * Disable incremental builds * Revert me: remove needs * Increase partition size * Enforce sparse * Improve CI
1 parent 4e3e9ff commit 96da9fa

File tree

3 files changed

+55
-22
lines changed

3 files changed

+55
-22
lines changed

.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ RUSTC_BOOTSTRAP = "1"
55

66
[build]
77
rustflags = ["--cfg", "substrate_runtime"]
8+
9+
[registry]
10+
protocol = "sparse"

.github/rust-info/action.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ runs:
1212
ink-node --version
1313
cargo contract --version
1414
git --version
15+
echo -e '[registry]\nprotocol = "sparse"' > /usr/local/cargo/config.toml
1516
shell: bash

.github/workflows/ci.yml

Lines changed: 51 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ on:
2828
env:
2929
# Image can be edited at https://github.com/use-ink/docker-images
3030
IMAGE: useink/ci
31-
CARGO_TARGET_DIR: /ci-cache/${{ github.repository }}/targets/${{ github.ref_name }}/
31+
CARGO_TARGET_DIR: /ci-cache/${{ github.repository }}/targets/
3232
PURELY_STD_CRATES: ink/codegen metadata engine e2e e2e/macro ink/ir
3333
ALSO_RISCV_CRATES: env storage storage/traits allocator prelude primitives ink ink/macro
3434
# TODO `cargo clippy --all-targets --all-features` for this crate
@@ -352,7 +352,7 @@ jobs:
352352
353353
### workspace
354354

355-
build:
355+
build-std:
356356
runs-on: ubuntu-latest
357357
needs: [set-image, check]
358358
defaults:
@@ -362,8 +362,6 @@ jobs:
362362
image: ${{ needs.set-image.outputs.IMAGE }}
363363
strategy:
364364
fail-fast: false
365-
matrix:
366-
type: [STD, RISCV]
367365
steps:
368366
- name: Checkout
369367
uses: actions/checkout@v4
@@ -380,24 +378,47 @@ jobs:
380378
uses: ./.github/rust-info
381379

382380
- name: Build for STD
383-
if: ${{ matrix.type == 'STD' }}
384381
run: |
385382
ALL_CRATES="${PURELY_STD_CRATES} ${ALSO_RISCV_CRATES}"
386383
for crate in ${ALL_CRATES}; do
387384
cargo build --all-features --release --manifest-path ./crates/${crate}/Cargo.toml;
388385
done
389386
390-
- name: Build for RISC-V
391-
if: ${{ matrix.type == 'RISCV' }}
392-
run: |
393-
for crate in ${ALSO_RISCV_CRATES}; do
394-
echo ${crate};
395-
RUSTFLAGS="--cfg substrate_runtime" cargo +nightly build \
396-
--no-default-features --release \
397-
--target $CLIPPY_TARGET \
398-
--manifest-path ./crates/${crate}/Cargo.toml \
399-
-Zbuild-std="core,alloc";
400-
done
387+
build-riscv:
388+
runs-on: ubuntu-latest
389+
needs: [set-image, check]
390+
defaults:
391+
run:
392+
shell: bash
393+
container:
394+
image: ${{ needs.set-image.outputs.IMAGE }}
395+
strategy:
396+
fail-fast: false
397+
steps:
398+
- name: Checkout
399+
uses: actions/checkout@v4
400+
with:
401+
fetch-depth: 1
402+
403+
- name: Cache
404+
uses: Swatinem/rust-cache@v2
405+
with:
406+
cache-directories: ${{ env.CARGO_TARGET_DIR }}
407+
cache-all-crates: true
408+
409+
- name: Rust Info
410+
uses: ./.github/rust-info
411+
412+
- name: Build for RISC-V
413+
run: |
414+
for crate in ${ALSO_RISCV_CRATES}; do
415+
echo ${crate};
416+
RUSTFLAGS="--cfg substrate_runtime" cargo +nightly build \
417+
--no-default-features --release \
418+
--target $CLIPPY_TARGET \
419+
--manifest-path ./crates/${crate}/Cargo.toml \
420+
-Zbuild-std="core,alloc";
421+
done
401422
402423
test:
403424
runs-on: ubuntu-latest
@@ -413,7 +434,7 @@ jobs:
413434
strategy:
414435
fail-fast: false
415436
matrix:
416-
partition: [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]
437+
partition: [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]
417438
steps:
418439
- name: Checkout
419440
uses: actions/checkout@v4
@@ -425,6 +446,7 @@ jobs:
425446
with:
426447
cache-directories: ${{ env.CARGO_TARGET_DIR }}
427448
cache-all-crates: true
449+
cache-on-failure: true
428450

429451
- name: Test
430452
env:
@@ -437,8 +459,9 @@ jobs:
437459
QUICKCHECK_TESTS: 0
438460
run: |
439461
rustup toolchain remove nightly-2025-02-20
462+
rustup toolchain remove 1.85.0
440463
rustup toolchain remove stable
441-
cargo +nightly nextest run --all-features --no-fail-fast --workspace --locked --jobs 1 --partition count:${{ matrix.partition }}/30
464+
cargo +nightly nextest run --all-features --no-fail-fast --workspace --locked --jobs 1 --partition count:${{ matrix.partition }}/35
442465
443466
test-docs:
444467
runs-on: ubuntu-latest
@@ -635,6 +658,7 @@ jobs:
635658
with:
636659
cache-directories: ${{ env.CARGO_TARGET_DIR }}
637660
cache-all-crates: true
661+
cache-on-failure: true
638662

639663
- name: Test Examples
640664
uses: docker://useink/ci
@@ -666,6 +690,7 @@ jobs:
666690
with:
667691
cache-directories: ${{ env.CARGO_TARGET_DIR }}
668692
cache-all-crates: true
693+
cache-on-failure: true
669694

670695
- name: Rust Info
671696
uses: ./.github/rust-info
@@ -703,6 +728,7 @@ jobs:
703728
with:
704729
cache-directories: ${{ env.CARGO_TARGET_DIR }}
705730
cache-all-crates: true
731+
cache-on-failure: true
706732

707733
- name: Rust Info
708734
uses: ./.github/rust-info
@@ -740,7 +766,8 @@ jobs:
740766
741767
examples-contract-build-riscv:
742768
runs-on: ubuntu-latest
743-
needs: [set-image, build]
769+
needs: [set-image]
770+
# needs: [set-image, build-std, build-riscv]
744771
defaults:
745772
run:
746773
shell: bash
@@ -749,7 +776,7 @@ jobs:
749776
strategy:
750777
fail-fast: false
751778
matrix:
752-
partition: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]
779+
partition: [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]
753780
steps:
754781
- name: Checkout
755782
uses: actions/checkout@v4
@@ -761,6 +788,7 @@ jobs:
761788
with:
762789
cache-directories: ${{ env.CARGO_TARGET_DIR }}
763790
cache-all-crates: true
791+
cache-on-failure: true
764792

765793
- name: Rust Info
766794
uses: ./.github/rust-info
@@ -775,9 +803,10 @@ jobs:
775803
RUSTC_BOOTSTRAP: 1
776804
MANIFEST_PATH: ""
777805
CONTRACT_SIZE_FILE: "measurements-${{ steps.extract_branch.outputs.branch }}/contract_size_"
806+
CARGO_INCREMENTAL: 0
778807
run: |
779808
mkdir -p measurements-${{ steps.extract_branch.outputs.branch }}/
780-
scripts/for_all_contracts_exec2.sh --path integration-tests --partition ${{ matrix.partition }}/20 --ignore integration-tests/public/multi-contract-caller -- \
809+
scripts/for_all_contracts_exec2.sh --path integration-tests --partition ${{ matrix.partition }}/30 -- \
781810
scripts/build_and_determine_contract_size.sh {}
782811
783812
#bash -c "scripts/build_and_determine_contract_size.sh {} >> ${CONTRACT_SIZE_FILE} && \
@@ -823,7 +852,7 @@ jobs:
823852

824853
examples-docs:
825854
runs-on: ubuntu-latest
826-
needs: [set-image, build]
855+
needs: [set-image, build-std, build-riscv]
827856
defaults:
828857
run:
829858
shell: bash

0 commit comments

Comments
 (0)