Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Add cargo #6

Merged
merged 51 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
2e85e5a
feat: Add taplo CI
aidan46 May 8, 2024
a89271e
feat: Add taplo config file
aidan46 May 8, 2024
3dd4d06
feat: Add path to taplo CI
aidan46 May 8, 2024
7625986
ci: Update taplo CI
aidan46 May 8, 2024
e8d9823
ci: Move taplo.yaml into ci.yaml
May 8, 2024
4e27a18
ci: Change taplo rules
May 8, 2024
a7c35dc
ci: Add cargo version for debugging
May 8, 2024
0306e16
ci: Add taplo version for debugging
May 8, 2024
af2e853
ci: Add version for debugging
May 8, 2024
0d868f3
ci: Formatting
May 8, 2024
e6fda54
ci: Change workflow name
aidan46 May 9, 2024
c2ec968
ci: Remove path filtering
aidan46 May 10, 2024
878fc5d
ci: Add cargo fmt job
aidan46 May 10, 2024
f7823aa
ci: Add rustfmt for format rules
aidan46 May 10, 2024
73f634c
ci: Add clippy job
aidan46 May 10, 2024
fb95a52
ci: Add build job
aidan46 May 10, 2024
60ea24b
ci: Add test job
aidan46 May 10, 2024
5ba437d
ci: Add failure handling
aidan46 May 10, 2024
4b06884
ci: Add wasm target to relevant jobs
aidan46 May 13, 2024
e826882
ci: Add nightly toolchain to fmt job
aidan46 May 13, 2024
97b7fe5
ci: Add rusfmt component to format job
aidan46 May 13, 2024
a18daba
ci: Add protobuf compiler package to test job
aidan46 May 13, 2024
e255209
ci: Add protobuf compiler to build job
aidan46 May 13, 2024
d0fe799
ci: Add protobuf compiler to format job
aidan46 May 13, 2024
418e60c
ci: Add stable target to relevant jobs
aidan46 May 13, 2024
6c51b1f
ci: Add nightly toolchain
aidan46 May 13, 2024
af59493
ci: Pin rust toolchain to 1.77
aidan46 May 13, 2024
c3a5895
style: Format toml files
aidan46 May 13, 2024
86ba23b
style: Format `.rs` files
aidan46 May 13, 2024
96778e1
ci: Remove job run on PR
aidan46 May 13, 2024
a111251
Merge remote-tracking branch 'origin/feat/1/project-setup' into feat/…
aidan46 May 13, 2024
6fdf0b2
fix: Duplicate dependencies
aidan46 May 13, 2024
c89ff2b
style: Format rust files
aidan46 May 13, 2024
d355a78
ci: Move clippy build and test into 1 job
aidan46 May 13, 2024
5d3b9fb
ci: Add rust-src component
aidan46 May 13, 2024
c53aff2
ci: Single failure handling
aidan46 May 13, 2024
74461e2
fix: Double import after merge
aidan46 May 13, 2024
e312050
ci: Add `-q` flag to not convolute logs
aidan46 May 13, 2024
47107ef
ci: Cancel previous job on push
aidan46 May 13, 2024
9f07575
ci: Make CI run on comment
aidan46 May 13, 2024
fc7c004
ci: Add `--locked` flag to cargo jobs
aidan46 May 13, 2024
a8f4c60
ci: Run CI on label and push to dev/main
aidan46 May 14, 2024
da3474a
ci: Remove run on comment
aidan46 May 14, 2024
6c1a65b
ci: Add caching
aidan46 May 14, 2024
48b28e5
ci: Update cache action version
aidan46 May 14, 2024
5270d52
ci: Change cache job name
aidan46 May 14, 2024
c7b7df4
ci: Add hash of lock file to cache action
aidan46 May 14, 2024
9d604df
ci: Add caching of cargo bin
aidan46 May 14, 2024
edaa744
Merge branch 'develop' into feat/cargo-ci
serg-temchenko May 14, 2024
8d1536e
Merge remote-tracking branch 'origin/develop' into feat/cargo-ci
aidan46 May 15, 2024
cda2f9a
ci: Add no deps flag to clippy
aidan46 May 16, 2024
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
125 changes: 125 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: CI

on: [push, pull_request]

jobs:
toml:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install taplo
run: cargo install taplo-cli --locked
- name: List versions
run: |
cargo --version
taplo --version
- name: Run taplo
run: taplo format --check --diff
- name: Taplo failure info
if: failure()
run: |
echo 'TOML is not formatted correctly'
echo 'Please run `taplo format`'

format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
jmg-duarte marked this conversation as resolved.
Show resolved Hide resolved
with:
toolchain: nightly
components: rustfmt
- name: List version
run: |
cargo --version
cargo fmt --version
- name: Cargo format
run: cargo fmt --all -- --check
- name: Cargo fmt failure info
if: failure()
run: |
echo '.rs files are not formatted correctly'
echo 'Please run `cargo fmt --all`'

clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install protobuf compiler
run: |
sudo apt-get update
sudo apt-get install protobuf-compiler
- uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-unknown-unknown, stable-x86_64-unknown-linux-gnu
components: clippy
- name: List version
run: |
cargo --version
cargo clippy --version
- name: Cargo clippy
run: cargo clippy -- -D warnings
- name: Cargo clippy failure info
if: failure()
run: |
echo '`cargo clippy` failed'
echo 'Please fix the issue generated by clippy'

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install protobuf compiler
run: |
sudo apt-get update
sudo apt-get install protobuf-compiler
- uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-unknown-unknown, stable-x86_64-unknown-linux-gnu
- name: List version
run: cargo --version
- name: Build with try-runtime feature
run: RUSTFLAGS="-D warnings" cargo build --features try-runtime
- name: try-runtime build failure
if: failure()
run: |
echo 'Building with `try-runtime` feature failed'
- name: Build node runtime
run: RUSTFLAGS="-D warnings" cargo build -p polka-storage-runtime
- name: Node runtime build failure
if: failure()
run: |
echo 'Building the node runtime failed'
- name: Build node with runtime-benchmark feature
run: RUSTFLAGS="-D warnings" cargo build -p polka-storage-node --features runtime-benchmarks
- name: runtime-benchmark build failure
if: failure()
run: |
echo 'Failed to build node with runtime-benchmark feature'
- name: Build in release mode
run: RUSTFLAGS="-D warnings" cargo build --release
- name: Release build failed
if: failure()
run: |
echo '`cargo build --release` failed'

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install protobuf compiler
run: |
sudo apt-get update
sudo apt-get install protobuf-compiler
- uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-unknown-unknown, stable-x86_64-unknown-linux-gnu
- name: List version
run: cargo --version
- name: Run tests
run: RUSTFLAGS="-D warnings" cargo test --workspace
- name: Cargo test fail
if: failure()
run: |
echo '`cargo test --workspace` failed'
3 changes: 3 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
edition = "2021"
imports_granularity = "Crate"
group_imports = "StdExternalCrate"
7 changes: 7 additions & 0 deletions .taplo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[[rule]]
include = ["**/*.toml"]

[rule.formatting]
column_width = 150
reorder_arrays = true
reorder_keys = true
Loading