diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 686985d7..30ec463f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,8 +9,8 @@ on: workflow_dispatch: jobs: - tests: - name: Python ${{ matrix.python-version }}, ${{ matrix.os }} + check_python: + name: Check Python ${{ matrix.python-version }}, ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: @@ -22,14 +22,9 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: actions-rs/toolchain@v1 with: toolchain: stable - - - run: cargo test --no-default-features - working-directory: ./rust - - uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -43,6 +38,21 @@ jobs: - name: Run tox targets for ${{ matrix.python-version }} run: python -m tox + check_rust: + name: Check Rust + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - name: Run tests + run: cargo test --no-default-features + working-directory: ./rust + - name: Run linter (clippy) + run: cargo clippy --all-targets --all-features -- -D warnings + working-directory: ./rust + benchmarks: runs-on: ubuntu-22.04 steps: diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 5ecedfc5..472226dd 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -61,6 +61,16 @@ To set up `grimp` for local development: 6. Submit a pull request through the GitHub website. +Rust code +--------- + +When working with the rust code (in the ``rust/`` directory): + +* Run tests with ``cargo test --no-default-features``. + The ``--no-default-features`` flag is needed to due to `this PYO3 issue `_. +* Run `clippy `_ (a linter for rust) with ``cargo clippy --all-targets --all-features -- -D warnings``. + It's often possible to apply automatic fixes to clippy issues with the ``--fix`` flag e.g. ``cargo clippy --all-targets --all-features --fix --allow-staged``. + Pull Request Guidelines -----------------------