From 37b535b2b226d129faa75cfd8e3e3cf6d5f39aaf Mon Sep 17 00:00:00 2001 From: Florian Lemaitre Date: Mon, 4 Nov 2024 20:57:22 +0100 Subject: [PATCH] Add rust format workflow --- .github/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++++++++ .vscode/settings.json | 2 +- eslint.config.mjs | 1 + 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 89c98a0d7..6782ac89d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -184,6 +184,43 @@ jobs: - name: Check Diff run: docker run --rm --volume "$(pwd)/Protos/V1:/workspace" --workdir /workspace bufbuild/buf:1.8.0 format -d --exit-code + format-rust: + name: Format and check Rust + strategy: + fail-fast: false + matrix: + toolchain: + - stable + - nightly + runs-on: ubuntu-latest + defaults: + run: + working-directory: packages/rust/armonik + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 + with: + fetch-depth: 0 + - uses: taiki-e/install-action@v2 + with: + tool: protoc,sccache + - name: Install toolchain + if: ${{ !contains(matrix.toolchain, 'nightly') }} + uses: dtolnay/rust-toolchain@stable + with: + components: rust-src,rust-docs,rustfmt,clippy + - name: Build + run: | + cargo build --all --locked + - name: Format + run: | + cargo fmt --all --check + - name: Doc + run: | + RUSTDOCFLAGS="-Dwarnings" cargo doc + - name: Clippy + run: | + cargo clippy --all --no-deps -- -Dwarnings -Dunused-crate-dependencies + lint-js: name: Lint JS runs-on: ubuntu-latest diff --git a/.vscode/settings.json b/.vscode/settings.json index 15624f711..15c632896 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -17,4 +17,4 @@ "rust-analyzer.linkedProjects": [ "./packages/rust/armonik/Cargo.toml" ] -} \ No newline at end of file +} diff --git a/eslint.config.mjs b/eslint.config.mjs index 49c5b2cbb..001c52edb 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -7,6 +7,7 @@ export default antfu({ '.docs', 'packages/csharp', 'packages/cpp', + 'packages/rust', ], }).overrideRules({ 'antfu/consistent-list-newline': 'off',