From f176ec1cb25093c371638369c23030b318ce47fe Mon Sep 17 00:00:00 2001 From: Shreevatsa N Date: Thu, 26 Sep 2024 16:30:06 +0530 Subject: [PATCH] Github CI: Test CI to reduce build time with concurrency Signed-off-by: Shreevatsa N --- .../ci-on-pr-rustfmt-test-clippy-build.yml | 85 ++++++++++++------- 1 file changed, 56 insertions(+), 29 deletions(-) diff --git a/.github/workflows/ci-on-pr-rustfmt-test-clippy-build.yml b/.github/workflows/ci-on-pr-rustfmt-test-clippy-build.yml index 7faceb8c..fed105f6 100644 --- a/.github/workflows/ci-on-pr-rustfmt-test-clippy-build.yml +++ b/.github/workflows/ci-on-pr-rustfmt-test-clippy-build.yml @@ -1,11 +1,9 @@ -name: ci +name: CI on: pull_request: paths-ignore: - "**.md" - "doc/**" - - # Allows to run this workflow manually from the Actions tab workflow_dispatch: defaults: @@ -28,7 +26,7 @@ jobs: - name: install rust nightly run: rustup toolchain install nightly - + - name: show active toolchain run: rustup show active-toolchain @@ -50,6 +48,52 @@ jobs: test: runs-on: ubuntu-latest needs: rustfmt + strategy: + matrix: + package: + - "cord-node-cli" + - "cord-braid-runtime" + - "authority-membership" + - "pallet-network-membership" + - "network-membership" + - "pallet-offences" + - "cord-braid-runtime-constants" + - "cord-primitives" + - "cord-runtime-common" + - "cord-identifier" + - "cord-utilities" + - "pallet-assets-runtime-api" + - "pallet-chain-space" + - "pallet-config" + - "pallet-did" + - "pallet-did-name" + - "pallet-did-runtime-api" + - "pallet-entries" + - "pallet-registries" + - "pallet-identity" + - "pallet-network-score" + - "pallet-node-authorization" + - "pallet-runtime-upgrade" + - "pallet-schema" + - "pallet-session-benchmarking" + - "pallet-statement" + - "pallet-transaction-weight-runtime-api" + - "cord-loom-runtime" + - "cord-loom-runtime-constants" + - "pallet-membership" + - "cord-node-inspect" + - "cord-node-rpc" + - "cord-weave-runtime" + - "cord-weave-runtime-constants" + - "cord-cli-test-utils" + - "cord-node-testing" + - "cord-test-client" + - "cord-service-test" + - "cord-test-runtime" + - "cord-test-runtime-client" + - "pallet-asset" + - "cord-test-utils" + - "cord-test-runtime-transaction-pool" steps: - name: checkout repository uses: actions/checkout@v4.1.1 @@ -57,7 +101,7 @@ jobs: - name: install dependencies run: sudo apt-get update && sudo apt-get install -y protobuf-compiler libssl-dev - - name: cache + - name: cache rust toolchain and dependencies uses: actions/cache@v4 with: path: | @@ -67,7 +111,9 @@ jobs: restore-keys: ${{ runner.os }}-rust- - name: cargo test - run: rustup component add rust-src && cargo test --release --all --all-targets --features=runtime-benchmarks --no-fail-fast --verbose --color always + run: | + rustup component add rust-src + cargo test -p ${{ matrix.package }} --release --features=runtime-benchmarks --no-fail-fast --verbose --color always clippy: runs-on: ubuntu-latest @@ -79,7 +125,7 @@ jobs: - name: install dependencies run: sudo apt-get update && sudo apt-get install -y protobuf-compiler libssl-dev - - name: cache + - name: cache rust toolchain and dependencies uses: actions/cache@v4 with: path: | @@ -89,25 +135,6 @@ jobs: restore-keys: ${{ runner.os }}-rust- - name: cargo clippy - run: rustup component add rust-src && cargo clippy --all --no-deps --all-targets --features=runtime-benchmarks -- -D warnings - - # build: - # runs-on: ubuntu-latest - # needs: rustfmt - # steps: - # - name: checkout repository - # uses: actions/checkout@v4.1.1 - # - name: install dependencies - # run: sudo apt-get update && sudo apt-get install -y protobuf-compiler libssl-dev - - # - name: cache - # uses: actions/cache@v4 - # with: - # path: | - # ~/.cargo/ - # target/ - # key: ${{ runner.os }}-rust-${{ hashFiles('**/Cargo.lock') }} - # restore-keys: ${{ runner.os }}-rust- - # - name: cargo build - # run: rustup component add rust-src && cargo build --locked - + run: | + rustup component add rust-src + cargo clippy -p ${{ matrix.package }} --all-targets --features=runtime-benchmarks -- -D warnings