Skip to content

Commit

Permalink
Optimize CI (#1204)
Browse files Browse the repository at this point in the history
  • Loading branch information
AurevoirXavier authored Jul 20, 2023
1 parent 93d2e8a commit 8099490
Show file tree
Hide file tree
Showing 6 changed files with 247 additions and 182 deletions.
44 changes: 17 additions & 27 deletions .github/shrink-cache.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
#!/bin/sh

cargo clean --release -p darwinia 2> /dev/null || true

cargo clean --release -p crab-runtime 2> /dev/null || true
cargo clean --release -p darwinia-runtime 2> /dev/null || true
cargo clean --release -p pangolin-runtime 2> /dev/null || true
cargo clean --release -p pangoro-runtime 2> /dev/null || true

cargo clean --release -p kusama-runtime 2> /dev/null || true
cargo clean --release -p polkadot-runtime 2> /dev/null || true
cargo clean --release -p rococo-runtime 2> /dev/null || true
cargo clean --release -p westend-runtime 2> /dev/null || true

rm -rf target/release/wbuild 2> /dev/null || true

cargo clean -p darwinia 2> /dev/null || true

cargo clean -p crab-runtime 2> /dev/null || true
cargo clean -p darwinia-runtime 2> /dev/null || true
cargo clean -p pangolin-runtime 2> /dev/null || true
cargo clean -p pangoro-runtime 2> /dev/null || true

cargo clean -p kusama-runtime 2> /dev/null || true
cargo clean -p polkadot-runtime 2> /dev/null || true
cargo clean -p rococo-runtime 2> /dev/null || true
cargo clean -p westend-runtime 2> /dev/null || true

rm -rf target/debug/wbuild 2> /dev/null || true
for p in darwinia
# for p in darwinia polkadot-cli librocksdb-sys wasm-opt-sys
do
cargo clean -p ${p} --profile ci-dev 2> /dev/null || true
done

# ---

for r in darwinia crab pangoro pangolin
do
rm -rf target/ci-dev/wbuild/${r}-runtime 2> /dev/null || true
done

for r in polkadot kusama westend rococo
do
rm -rf target/ci-dev/wbuild/${r}-runtime/target/release 2> /dev/null || true
done
43 changes: 26 additions & 17 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ on:
- "**.yml"

env:
CARGO_INCREMENTAL: 1
CARGO_TERM_COLOR: always
CACHE_VERSION: 0

GITHUB_CACHE_VERSION: 2
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
CARGO_TERM_COLOR: always

RUST_BACKTRACE: full

Expand All @@ -39,36 +39,45 @@ jobs:
matrix:
action: [build, test]
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: true
swap-storage: false
- name: Set swap space
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 8
- name: Setup build environment
run: sudo apt install -y protobuf-compiler
run: |
sudo apt install -y clang llvm protobuf-compiler
rustup show
- name: Fetch latest code
uses: actions/checkout@v3
- name: Cache cargo
uses: actions/cache@v2
uses: Swatinem/rust-cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ matrix.action }}-${{ env.GITHUB_CACHE_VERSION }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: cargo-${{ matrix.action }}-${{ env.GITHUB_CACHE_VERSION }}-
prefix-key: ${{ env.CACHE_VERSION }}
- name: Action ${{ matrix.action }}
if: matrix.action != 'test'
run: cargo ${{ matrix.action }} --release --locked -p darwinia --all-features
run: cargo ${{ matrix.action }} --locked -p darwinia --features evm-tracing,all-natives --profile ci-dev
- name: Action ${{ matrix.action }}
if: matrix.action == 'test'
run: SKIP_WASM_BUILD=1 cargo ${{ matrix.action }} --release --locked --features all-natives
run: SKIP_WASM_BUILD=1 cargo ${{ matrix.action }} --locked --features all-natives --profile ci-dev
- name: Change path
if: matrix.action != 'test'
run: mv target/release/darwinia .
run: mv target/ci-dev/darwinia .
- name: Upload
if: matrix.action != 'test'
uses: actions/upload-artifact@v2
with:
name: darwinia
path: darwinia
- name: Shrink cache
run: .github/shrink-cache.sh

format-checks:
name: Task check format
Expand Down Expand Up @@ -149,7 +158,7 @@ jobs:
chmod u+x darwinia
sudo mv darwinia /usr/bin
- name: Launch darwinia
run: darwinia --chain pangolin-dev --tmp --alice --tracing-api debug,trace &
run: darwinia --chain pangolin-dev --tmp --alice --tracing-api debug,trace --frontier-backend-type sql &
- name: Install Node 19
uses: actions/setup-node@v2
with:
Expand Down
Loading

0 comments on commit 8099490

Please sign in to comment.