diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index de541e569c..d3f4dbc4bb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,22 +24,18 @@ jobs: uses: styfle/cancel-workflow-action@0.11.0 with: access_token: ${{ github.token }} - build: + fmt-clippy: runs-on: [self-hosted, linux] env: CARGO_INCREMENTAL: 0 - needs: clean-up-actions + needs: cargo-cache steps: - uses: actions/checkout@v3 with: submodules: recursive - - uses: actions/cache@v3 + - uses: actions/cache/restore@v3 with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ + path: ~/.cargo/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install toolchain uses: dtolnay/rust-toolchain@nightly @@ -51,8 +47,6 @@ jobs: uses: jwlawson/actions-setup-cmake@v1.13 - name: Check format run: cargo fmt --all -- --check - - name: Build - run: make build-all - name: Install clippy run: rustup component add clippy - name: Run mandala-runtime clippy @@ -61,25 +55,25 @@ jobs: run: cargo clippy --features with-karura-runtime -- -D warnings - name: Run acala-runtime clippy run: cargo clippy --features with-acala-runtime -- -D warnings - - name: Run build benches - run: make build-benches benchmarking: runs-on: [self-hosted, linux] env: CARGO_INCREMENTAL: 0 - needs: clean-up-actions + needs: build steps: - uses: actions/checkout@v3 with: submodules: recursive - - uses: actions/cache@v3 + - uses: actions/cache/restore@v3 with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ + path: ~/.cargo/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - uses: actions/cache/restore@v3 + with: + path: | + target/ + !target/release/ + key: ${{ runner.os }}-target-${{ hashFiles('**/Cargo.lock') }} - name: Install toolchain uses: dtolnay/rust-toolchain@nightly with: @@ -96,19 +90,21 @@ jobs: runs-on: [self-hosted, linux] env: CARGO_INCREMENTAL: 0 - needs: clean-up-actions + needs: build steps: - uses: actions/checkout@v3 with: submodules: recursive - - uses: actions/cache@v3 + - uses: actions/cache/restore@v3 with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ + path: ~/.cargo/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - uses: actions/cache/restore@v3 + with: + path: | + target/ + !target/release/ + key: ${{ runner.os }}-target-${{ hashFiles('**/Cargo.lock') }} - name: Install toolchain uses: dtolnay/rust-toolchain@nightly with: @@ -133,19 +129,21 @@ jobs: runs-on: [self-hosted, linux] env: CARGO_INCREMENTAL: 0 - needs: clean-up-actions + needs: build steps: - uses: actions/checkout@v3 with: submodules: recursive - - uses: actions/cache@v3 + - uses: actions/cache/restore@v3 with: - path: | - ~/.cargo/bin/ - ~/.cargo/registry/index/ - ~/.cargo/registry/cache/ - ~/.cargo/git/db/ + path: ~/.cargo/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - uses: actions/cache/restore@v3 + with: + path: | + target/ + !target/release/ + key: ${{ runner.os }}-target-${{ hashFiles('**/Cargo.lock') }} - name: Install toolchain uses: dtolnay/rust-toolchain@nightly with: @@ -164,3 +162,56 @@ jobs: run: | npm install -g yarn make test-ts + cargo-cache: + runs-on: [self-hosted, linux] + env: + CARGO_INCREMENTAL: 0 + needs: clean-up-actions + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - uses: actions/cache@v3 + with: + path: ~/.cargo/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Install toolchain + uses: dtolnay/rust-toolchain@nightly + with: + toolchain: nightly-2023-04-15 + components: rustfmt + target: wasm32-unknown-unknown + - name: Fetch dependencies + run: cargo fetch --locked + + build: + runs-on: [self-hosted, linux] + env: + CARGO_INCREMENTAL: 0 + needs: cargo-cache + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + - uses: actions/cache/restore@v3 + with: + path: ~/.cargo/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - uses: actions/cache@v3 + with: + path: | + target/ + !target/release/ + key: ${{ runner.os }}-target-${{ hashFiles('**/Cargo.lock') }} + - name: Install toolchain + uses: dtolnay/rust-toolchain@nightly + with: + toolchain: nightly-2023-04-15 + components: rustfmt + target: wasm32-unknown-unknown + - name: Setup cmake + uses: jwlawson/actions-setup-cmake@v1.13 + - name: Run build + run: make build-all + - name: Run build benches + run: make build-benches