Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 48 additions & 27 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: Pull Request Check

on:
Expand All @@ -8,35 +7,57 @@ on:
- synchronize
- closed

jobs:
check:
runs-on: ubuntu-24.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
fmt:
runs-on: ubuntu-latest
container:
image: rust:1.87-slim

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that mean if we change the rusttoolchain file, we also need to change here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Normally no this is just for format check that's why i used the latest and slim version of the container.


steps:
- name: "[Setup] Free Disk Space (insightsengineering/disk-space-reclaimer)"
uses: insightsengineering/disk-space-reclaimer@v1.1.0

- name: "[Setup] Linux Tools"
run: sudo apt install -y cmake pkg-config libssl-dev build-essential clang libclang-dev curl protobuf-compiler

- name: "[Setup] Rust"
run: |
TLCHN=nightly-2024-01-21
curl -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain $TLCHN
rustup target add wasm32-unknown-unknown --toolchain $TLCHN
cargo install cargo-expand --locked --version 1.0.71

- name: Checkout Sources (actions/checkout)
- name: Checkout Sources
uses: actions/checkout@v3

- name: "[Ceck] cargo fmt"
with:
fetch-depth: 1

- name: "[Check] cargo fmt"
run: cargo fmt --check

test-and-clippy:
runs-on: ubuntu-latest
container:
image: paritytech/ci-linux:production
Comment thread
neutrinoks marked this conversation as resolved.

steps:
- name: Checkout Sources
uses: actions/checkout@v3

- name: Fix permissions
run: |
cargo fmt --check

- name: "[Check] cargo test"
# Fix permission issues with the rustup directory
mkdir -p ~/.cargo ~/.rustup
chown -R $(whoami):$(whoami) ~/.cargo ~/.rustup

- name: Cache build outputs
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-

- name: Run tests
run: |
cargo test --release --features on-chain-release-build

- name: "[Check] cargo clippy"
RUST_BACKTRACE=1 cargo test --release --features on-chain-release-build -v
Comment thread
DocteurPing marked this conversation as resolved.
- name: Run clippy
Comment thread
neutrinoks marked this conversation as resolved.
run: |
cargo clippy --release --features on-chain-release-build -- -Dwarnings
cargo clippy --release --features on-chain-release-build -- -Dwarnings