Skip to content

Commit

Permalink
segregate PR CI and dev environment descriptions of nox etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
MusicalNinjaDad committed Apr 24, 2024
1 parent bca86c7 commit b46aa62
Showing 1 changed file with 29 additions and 30 deletions.
59 changes: 29 additions & 30 deletions Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ The following sections also contain specific ideas on where to start contributin
## Setting up a development environment

To work and develop PyO3, you need Python & Rust installed on your system.

* We encourage the use of [rustup](https://rustup.rs/) to be able to select and choose specific toolchains based on the project.
* [Pyenv](https://github.com/pyenv/pyenv) is also highly recommended for being able to choose a specific Python version.
* [virtualenv](https://virtualenv.pypa.io/en/latest/) can also be used with or without Pyenv to use specific installed Python versions.
Expand All @@ -42,9 +43,21 @@ The main nox commands we have implemented are:
* `nox -s codspeed` will run our suite of rust and python performance tests
* `nox -s coverage` will analyse test coverage and output `coverage.json` (alternatively: `nox -s coverage lcov` outputs `lcov.info`)

Use `nox -l` to list the full set of subcommands you can run.

#### UI Tests

PyO3 uses [`trybuild`][trybuild] to develop UI tests to capture error messages from the Rust compiler for some of the macro functionality.

Because there are several feature combinations for these UI tests, when updating them all (e.g. for a new Rust compiler version) it may be helpful to use the `update-ui-tests` nox session:

```bash
nox -s update-ui-tests
```

### Github workflow

In addition to the larger CI workflow which runs on each Pull Request, we provide a short CI workflow which runs on every push to github. This workflow runs the nox sessions: `fustfmt`, `ruff`, `clippy` and `test-rust -- skip-full` and is designed to run in under 200s to provide feedback within a reasonable timeframe and not use all your github actions minutes.
In addition to the larger CI workflow which runs on each Pull Request, we provide a short CI workflow which runs on every push to github. This workflow runs the nox sessions: `rustfmt`, `ruff`, `clippy` and `test-rust -- skip-full` and is designed to run in under 200s to provide feedback within a reasonable timeframe and not use all your github actions minutes.

## Ways to help

Expand Down Expand Up @@ -119,36 +132,21 @@ Tests run with all supported Python versions with the latest stable Rust compile

If you are adding a new feature, you should add it to the `full` feature in our *Cargo.toml** so that it is tested in CI.

You can run these tests yourself with
`nox`. Use `nox -l` to list the full set of subcommands you can run.

#### Linting Python code
`nox -s ruff`
You can run these tests yourself with `nox`. The full set of actions run in CI is:

#### Linting Rust code
`nox -s rustfmt`
1. `nox -s rustfmt` - everything will abort if fmt has not been run on the code before pushing
1. `cargo semver-checks check-release` (checks no semver violations based on currently released version of Pyo3)
1. `nox -s set-minimal-package-versions` & `nox -s check-all`
1. `nox -s clippy-all` on a matrix of different OS, python and rust architectures
1. build and test against a matrix of different OS, python and rust architectures
1. test under valgrind to identify memory leakages
1. `nox -s coverage` for latest windows, macos and ubuntu
1. `nox -s test` with a debug build of python
1. `nox -s test-version-limits`
1. `nox -s check-feature-powerset` to check conditional compilation
1. cross-compilation tests

#### Semver checks
`cargo semver-checks check-release`

#### Clippy
`nox -s clippy-all`

#### Tests
`cargo test --features full`

#### Check all conditional compilation
`nox -s check-feature-powerset`

#### UI Tests

PyO3 uses [`trybuild`][trybuild] to develop UI tests to capture error messages from the Rust compiler for some of the macro functionality.

Because there are several feature combinations for these UI tests, when updating them all (e.g. for a new Rust compiler version) it may be helpful to use the `update-ui-tests` nox session:

```bash
nox -s update-ui-tests
```
If you wish to validate your code against this suite before raising a PR, then you can manually trigger the CI in github actions.

### Documenting changes

Expand Down Expand Up @@ -263,4 +261,5 @@ In the meanwhile, some of our maintainers have personal GitHub sponsorship pages
[mdbook]: https://rust-lang.github.io/mdBook/cli/index.html
[lychee]: https://github.com/lycheeverse/lychee
[nox]: https://github.com/theacodes/nox
[pipx]: https://pipx.pypa.io/stable/
[pipx]: https://pipx.pypa.io/stable/
[trybuild]: https://github.com/dtolnay/trybuild

0 comments on commit b46aa62

Please sign in to comment.