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: run cargo-sort and move formatting related jobs in their configuration #2986

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
21 changes: 0 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,6 @@ jobs:
make deps
make build

run_formatting:
name: Formatting
runs-on: ubuntu-latest
strategy:
matrix:
rust_toolchain_version: ["nightly"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Use shared Rust toolchain setting up steps
uses: ./.github/actions/toolchain-shared
with:
rust_toolchain_version: ${{ matrix.rust_toolchain_version }}

- name: Run cargo fmt
run: |
make format

run_checks:
name: Run checks and tests
# We run only one of the matrix options on the toffee `hetzner-1` self-hosted GitHub runner.
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/fmt.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Global configuration for formatting related jobs

on:
workflow_dispatch:
pull_request:
push:

jobs:
run_rust_formatting:
name: Formatting Rust related code
runs-on: ubuntu-latest
strategy:
matrix:
rust_toolchain_version: ["nightly"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Use shared Rust toolchain setting up steps
uses: ./.github/actions/toolchain-shared
with:
rust_toolchain_version: ${{ matrix.rust_toolchain_version }}

- name: Install cargo-sort
run: cargo install cargo-sort

- name: Check formatting related to Rust code
run: |
make check-format
19 changes: 9 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
members = [
"arrabbiata",
"book",
"turshi",
"curves",
"folding",
"groupmap",
"hasher",
"internal-tracing",
"ivc",
"kimchi",
"msm",
"mvpoly",
"o1vm",
"poly-commitment",
"poseidon",
"poseidon/export_test_vectors",
"poly-commitment",
"saffron"
,
"signer",
"mvpoly",
"tools/kimchi-visu",
"utils",
"internal-tracing",
"ivc",
"folding",
"saffron"
]
"turshi",
"utils"]
resolver = "2"

[workspace.dependencies]
Expand Down Expand Up @@ -81,7 +81,6 @@ thiserror = "1.0.30"
tinytemplate = "1.1"
wasm-bindgen = "=0.2.87"


arrabbiata = { path = "./arrabbiata", version = "0.1.0" }
folding = { path = "./folding", version = "0.1.0" }
groupmap = { path = "./groupmap", version = "0.1.0" }
Expand Down
9 changes: 7 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,13 @@ nextest-all-with-coverage:
$(COVERAGE_ENV) BIN_EXTRA_ARGS="$(BIN_EXTRA_ARGS)" $(MAKE) nextest-all


format: ## Format the code
check-format: ## Check the code formatting
cargo +nightly fmt -- --check
cargo sort --check

format: ## Format the code
cargo +nightly fmt
cargo sort


lint: ## Lint the code
Expand Down Expand Up @@ -201,4 +206,4 @@ ${O1VM_MIPS_BIN_DIR}/%.o: ${O1VM_MIPS_SOURCE_DIR}/%.asm
fclean: clean ## Clean the tooling artefacts in addition to running clean
rm -rf ${RISCV32_TOOLCHAIN_PATH}

.PHONY: all setup install-test-deps clean build release test-doc test-doc-with-coverage test test-with-coverage test-heavy test-heavy-with-coverage test-all test-all-with-coverage nextest nextest-with-coverage nextest-heavy nextest-heavy-with-coverage nextest-all nextest-all-with-coverage format lint generate-test-coverage-report generate-doc setup-riscv32-toolchain help fclean build-riscv32-programs build-mips-programs
.PHONY: all setup install-test-deps clean build release test-doc test-doc-with-coverage test test-with-coverage test-heavy test-heavy-with-coverage test-all test-all-with-coverage nextest nextest-with-coverage nextest-heavy nextest-heavy-with-coverage nextest-all nextest-all-with-coverage format lint generate-test-coverage-report generate-doc setup-riscv32-toolchain help fclean build-riscv32-programs build-mips-programs check-format
Loading