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
32 changes: 8 additions & 24 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 Down Expand Up @@ -58,15 +58,15 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Cargo caching
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
th7nder marked this conversation as resolved.
Show resolved Hide resolved
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('**/Cargo.toml') }}
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: 1.77.0
Expand All @@ -77,26 +77,10 @@ jobs:
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
Loading