Skip to content

Commit 0eb2de9

Browse files
authored
Merge pull request #347
Cache PR check worflow
2 parents 8f9235d + 9820fcc commit 0eb2de9

1 file changed

Lines changed: 48 additions & 27 deletions

File tree

.github/workflows/pr-check.yml

Lines changed: 48 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: Pull Request Check
32

43
on:
@@ -8,35 +7,57 @@ on:
87
- synchronize
98
- closed
109

11-
jobs:
12-
check:
13-
runs-on: ubuntu-24.04
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
1413

14+
jobs:
15+
fmt:
16+
runs-on: ubuntu-latest
17+
container:
18+
image: rust:1.87-slim
19+
1520
steps:
16-
- name: "[Setup] Free Disk Space (insightsengineering/disk-space-reclaimer)"
17-
uses: insightsengineering/disk-space-reclaimer@v1.1.0
18-
19-
- name: "[Setup] Linux Tools"
20-
run: sudo apt install -y cmake pkg-config libssl-dev build-essential clang libclang-dev curl protobuf-compiler
21-
22-
- name: "[Setup] Rust"
23-
run: |
24-
TLCHN=nightly-2024-01-21
25-
curl -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain $TLCHN
26-
rustup target add wasm32-unknown-unknown --toolchain $TLCHN
27-
cargo install cargo-expand --locked --version 1.0.71
28-
29-
- name: Checkout Sources (actions/checkout)
21+
- name: Checkout Sources
3022
uses: actions/checkout@v3
31-
32-
- name: "[Ceck] cargo fmt"
23+
with:
24+
fetch-depth: 1
25+
26+
- name: "[Check] cargo fmt"
27+
run: cargo fmt --check
28+
29+
test-and-clippy:
30+
runs-on: ubuntu-latest
31+
container:
32+
image: paritytech/ci-linux:production
33+
34+
steps:
35+
- name: Checkout Sources
36+
uses: actions/checkout@v3
37+
38+
- name: Fix permissions
3339
run: |
34-
cargo fmt --check
35-
36-
- name: "[Check] cargo test"
40+
# Fix permission issues with the rustup directory
41+
mkdir -p ~/.cargo ~/.rustup
42+
chown -R $(whoami):$(whoami) ~/.cargo ~/.rustup
43+
44+
- name: Cache build outputs
45+
uses: actions/cache@v3
46+
with:
47+
path: |
48+
~/.cargo/bin/
49+
~/.cargo/registry/index/
50+
~/.cargo/registry/cache/
51+
~/.cargo/git/db/
52+
target/
53+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
54+
restore-keys: |
55+
${{ runner.os }}-cargo-
56+
57+
- name: Run tests
3758
run: |
38-
cargo test --release --features on-chain-release-build
39-
40-
- name: "[Check] cargo clippy"
59+
RUST_BACKTRACE=1 cargo test --release --features on-chain-release-build -v
60+
61+
- name: Run clippy
4162
run: |
42-
cargo clippy --release --features on-chain-release-build -- -Dwarnings
63+
cargo clippy --release --features on-chain-release-build -- -Dwarnings

0 commit comments

Comments
 (0)