Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI optimization #50

Merged
merged 11 commits into from
May 28, 2024
68 changes: 11 additions & 57 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
pull_request:
types: [labeled]
types: [ labeled ]
push:
branches: [develop, main]
branches: [ develop, main ]

concurrency:
group: ${{ github.ref }}
Expand All @@ -15,88 +15,42 @@ jobs:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install taplo
run: cargo install taplo-cli --locked
- name: List versions
run: |
cargo --version
taplo --version
- name: Run taplo
run: taplo format --check --diff
- name: Taplo failure info
if: failure()
run: |
echo 'TOML is not formatted correctly'
echo 'Please run taplo format'
taplo lint
taplo fmt --check

format:
runs-on: self-hosted
needs: toml
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
components: rustfmt
- name: List version
run: |
cargo --version
cargo fmt --version
cargo +nightly --version
cargo +nightly fmt --version
- name: Cargo format
run: cargo fmt --all -- --check
- name: Cargo fmt failure info
if: failure()
run: |
echo '.rs files are not formatted correctly'
echo 'Please run cargo fmt --all'
run: cargo +nightly fmt --all -- --check

clippy_build_and_test:
runs-on: self-hosted
needs:
- format
steps:
- uses: actions/checkout@v4
- name: Cargo caching
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('**/Cargo.toml') }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.77.0
target: wasm32-unknown-unknown
components: clippy rust-src
- name: List version
run: |
rustup show
cargo --version
cargo clippy --version
- name: Build with try-runtime feature
run: RUSTFLAGS="-D warnings" cargo build --locked -q --features try-runtime
- name: Build node runtime
run: RUSTFLAGS="-D warnings" cargo build --locked -q -p polka-storage-runtime
- name: Build node with runtime-benchmark feature
run: RUSTFLAGS="-D warnings" cargo build --locked -q -p polka-storage-node --features runtime-benchmarks
- name: Build in dev mode
run: RUSTFLAGS="-D warnings" cargo build --locked -q
run: RUSTFLAGS="-D warnings" cargo build --profile ci --locked
- name: Cargo clippy
run: cargo clippy --locked -q --no-deps -- -D warnings
run: RUSTFLAGS="-D warnings" cargo clippy --profile ci --locked
- name: Run tests
run: RUSTFLAGS="-D warnings" cargo test --locked -q --workspace
- name: Build in release mode
# Run only on merge to the protected branches
if: |
contains(github.ref, 'develop') ||
contains(github.ref, 'main')
run: RUSTFLAGS="-D warnings" cargo build --locked -q --release
- name: Failure handling
if: failure()
run: |
echo 'Job clippy_build_and_test failed.'
echo 'Please check the logs for more details'
run: RUSTFLAGS="-D warnings" cargo test --profile ci --locked --workspace
# FIXME(#35,@serhii,27/5/2024): Revert the commit from the issue to restore the full set of CI steps.
10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ resolver = "2"
[patch.'https://github.com/paritytech/litep2p']
litep2p = "0.3.0"

[profile.ci]
codegen-units = 256 # Increase parallel code generation units
debug = false # No debug information
incremental = false # Disable incremental compilation for consistent CI performance
inherits = "dev"
lto = false # Disable Link Time Optimization
opt-level = 0 # No optimization
overflow-checks = false # Disable overflow checks
panic = 'abort' # Use abort on panic to reduce binary size

[workspace.dependencies]
# Build dependencies
substrate-build-script-utils = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-v1.11.0" }
Expand Down
9 changes: 4 additions & 5 deletions runtime/src/configs/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ use frame_support::{
};
use frame_system::EnsureRoot;
use pallet_xcm::XcmPassthrough;
use parachains_common::xcm_config::{
AllSiblingSystemParachains, ConcreteAssetFromSystem, ParentRelayOrSiblingParachains,
RelayOrOtherSystemParachains,
};
use polkadot_parachain_primitives::primitives::Sibling;
use polkadot_runtime_common::impls::ToAuthor;
use xcm::latest::prelude::*;
Expand All @@ -24,11 +28,6 @@ use crate::{
Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue,
};

use parachains_common::xcm_config::{
AllSiblingSystemParachains, ConcreteAssetFromSystem, ParentRelayOrSiblingParachains,
RelayOrOtherSystemParachains,
};

parameter_types! {
pub const RelayLocation: Location = Location::parent();
pub const RelayNetwork: Option<NetworkId> = None;
Expand Down