Skip to content

Commit

Permalink
Use debian 11 (#1644)
Browse files Browse the repository at this point in the history
* Use Debian 11 bullseye for compiling Polymesh

* Use Debian 11 for arm docker images too.

* Use higher specs to build rust nightly image.

* Clear task cache.

* Use debian 11 cleanup (#1645)

* Cleanup sccache usage.

* Fix srtool build
  • Loading branch information
Neopallium authored Apr 9, 2024
1 parent 5a9e4f9 commit 540e920
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 80 deletions.
106 changes: 28 additions & 78 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ commands:
/usr/local/cargo/bin/sccache --version
restore-sccache-cache:
steps:
- run:
name: Store rust version in a file for cache key
command: rustc --version > rust.version
- restore_cache:
name: Restore sccache cache
key: sccache-cache-stable-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}
key: sccache-cache-stable-v2-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}
- run:
name: Show cache size
command: /usr/local/cargo/bin/sccache -s
Expand All @@ -29,7 +32,7 @@ commands:
# Of course, restore_cache will not find this exact key,
# but it will fall back to the closest key (aka the most recent).
# See https://discuss.circleci.com/t/add-mechanism-to-update-existing-cache-key/9014/13
key: sccache-cache-stable-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ epoch }}
key: sccache-cache-stable-v2-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ epoch }}
paths:
- "/usr/local/cargo"
- "~/.cache/sccache"
Expand Down Expand Up @@ -69,12 +72,8 @@ jobs:
- RUSTC_WRAPPER: /usr/local/cargo/bin/sccache
steps:
- checkout
- run:
name: Store rust version in an environment var for cache key
command: rustc --version > rust.version
- restore_cache:
keys:
- v7-release-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
- setup-sccache
- restore-sccache-cache
- run:
name: Build release
command: cargo build --locked --release
Expand All @@ -92,11 +91,7 @@ jobs:
root: ./assets
paths:
- .
- save_cache:
key: v7-release-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
paths:
- "/usr/local/cargo"
- "~/.cache/sccache"
- save-sccache-cache
build-ci:
docker:
- image: polymeshassociation/rust:debian-nightly-2023-12-11
Expand Down Expand Up @@ -133,12 +128,8 @@ jobs:
- RUSTC_WRAPPER: /usr/local/cargo/bin/sccache
steps:
- checkout
- run:
name: Store rust version in an environment var for cache key
command: rustc --version > rust.version
- restore_cache:
keys:
- v8-release-arm64-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
- setup-sccache
- restore-sccache-cache
- run:
name: Build release
command: cargo build --locked --release
Expand All @@ -153,11 +144,7 @@ jobs:
root: ./assets
paths:
- .
- save_cache:
key: v8-release-arm64-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
paths:
- "/usr/local/cargo"
- "~/.cache/sccache"
- save-sccache-cache
benchmark-build:
docker:
- image: polymeshassociation/rust:debian-nightly-2023-12-11
Expand All @@ -168,12 +155,8 @@ jobs:
- RUSTC_WRAPPER: /usr/local/cargo/bin/sccache
steps:
- checkout
- run:
name: Store rust version in an environment var for cache key
command: rustc --version > rust.version
- restore_cache:
keys:
- v4-bench-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
- setup-sccache
- restore-sccache-cache
- run:
name: Build binary with runtime-benchmarks
command: cargo build --locked --release --features=runtime-benchmarks,running-ci
Expand All @@ -185,11 +168,7 @@ jobs:
root: ./
paths:
- polymesh-benchmarks
- save_cache:
key: v4-bench-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
paths:
- "/usr/local/cargo"
- "~/.cache/sccache"
- save-sccache-cache
benchmark:
docker:
- image: debian:stable
Expand All @@ -213,20 +192,13 @@ jobs:
- BUILD_DUMMY_WASM_BINARY: "1"
steps:
- checkout
- run:
name: Store rust version in an environment var for cache key
command: rustc --version > rust.version
- restore_cache:
keys:
- v2-migration-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
- setup-sccache
- restore-sccache-cache
- run:
name: Run migration tests
command: cargo test -p migration-tests --lib -- --nocapture
no_output_timeout: 30m
- save_cache:
key: v2-migration-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
paths:
- "/usr/local/cargo"
- save-sccache-cache
test:
docker:
- image: polymeshassociation/rust:debian-nightly-2023-12-11
Expand All @@ -239,12 +211,8 @@ jobs:
- RUST_BACKTRACE: "1"
steps:
- checkout
- run:
name: Store rust version in a file for cache key
command: rustc --version > rust.version
- restore_cache:
keys:
- v12-test-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
- setup-sccache
- restore-sccache-cache
- run:
name: Tests
command: >-
Expand All @@ -261,11 +229,7 @@ jobs:
--package asset-metadata
--features default_identity
no_output_timeout: 30m
- save_cache:
key: v12-test-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
paths:
- "/usr/local/cargo"
- "~/.cache/sccache"
- save-sccache-cache
coverage:
docker:
- image: polymeshassociation/rust:debian-nightly-2023-12-11
Expand All @@ -274,20 +238,13 @@ jobs:
- VERBOSE: "1"
steps:
- checkout
- run:
name: Store rust version in a file for cache key
command: rustc --version | tee rust.version
- restore_cache:
keys:
- v7-coverage-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
- setup-sccache
- restore-sccache-cache
- run:
name: Coverage
command: bash ./scripts/coverage.sh
no_output_timeout: 30m
- save_cache:
key: v7-coverage-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
paths:
- "/usr/local/cargo"
- save-sccache-cache
rust-integration-test:
docker:
- image: polymeshassociation/rust:debian-nightly-2023-12-11
Expand Down Expand Up @@ -361,20 +318,13 @@ jobs:
- SKIP_WASM_BUILD: "1"
steps:
- checkout
- run:
name: Store rust version in a file for cache key
command: rustc --version > rust.version
- restore_cache:
keys:
- v6-clippy-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
- setup-sccache
- restore-sccache-cache
- run:
name: run clippy
command: cargo clippy -- -A clippy::all -W clippy::complexity -W clippy::perf
no_output_timeout: 30m
- save_cache:
key: v6-clippy-cache-{{ checksum "./rust.version" }}-{{ checksum "./Cargo.lock" }}
paths:
- "/usr/local/cargo"
- save-sccache-cache
build-docker-debian:
environment:
IMAGE_NAME: polymeshassociation/polymesh
Expand Down Expand Up @@ -443,7 +393,7 @@ jobs:
IMAGE_NAME: polymeshassociation/rust
docker:
- image: docker:stable-git
resource_class: small
resource_class: large
steps:
- checkout
- setup_remote_docker:
Expand Down Expand Up @@ -618,4 +568,4 @@ workflows:
only:
- mainnet
- testnet
- staging
- staging
2 changes: 1 addition & 1 deletion .docker/arm64/rust/Dockerfile.debian
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG rustbase=1.74.0
FROM arm64v8/rust:${rustbase}
FROM arm64v8/rust:${rustbase}-bullseye

ARG toolchainversion=nightly-2023-12-01
ENV TOOLCHAIN="${toolchainversion}"
Expand Down
2 changes: 1 addition & 1 deletion .docker/rust-nightly/Dockerfile.debian
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG rustbase=1.74.0
FROM rust:${rustbase}
FROM rust:${rustbase}-bullseye

ARG toolchainversion=nightly-2023-12-01
ENV TOOLCHAIN="${toolchainversion}"
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/srtool.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
chain: ["testnet", "mainnet"]
steps:
- uses: actions/checkout@v3
- name: Summary
run: |
echo "Use our rust-toolchain.toml"
cp rust-toolchain.toml pallets/runtime/${{ matrix.chain }}/
- name: Srtool build
id: srtool_build
uses: chevdor/[email protected]
Expand Down

0 comments on commit 540e920

Please sign in to comment.