`matrix-sdk-crypto-nodejs` and `matrix-sdk-crypto-js` are no longer
default members of the Cargo virtual workspace. The Github Actions
workflows for the bindings now live in a `bindings_ci.yml` files
(ideally, it should be in a subdirectory,
`.github/workflows/bindings/ci.yml` but it doesn't work).
> [`cargo-nextest`](https://nexte.st/index.html) is a next-generation
> test runner for Rust projects.
This patch installs and uses `nextest` to run our own tests.
Comparing `cargo test` and `cargo nextest` with hyperfine provides the
following results:
```sh
$ hyperfine 'cargo test --workspace' 'cargo nextest run --workspace && cargo test --doc'
Benchmark 1: cargo test --workspace
Time (mean ± σ): 51.785 s ± 2.066 s [User: 183.471 s, System: 10.563 s]
Range (min … max): 49.151 s … 56.641 s 10 runs
Benchmark 2: cargo nextest run --workspace && cargo test --doc
Time (mean ± σ): 44.556 s ± 0.894 s [User: 192.213 s, System: 11.441 s]
Range (min … max): 43.170 s … 45.762 s 10 runs
```
Benchmark 2 is 1.16 times faster than Benchmark 1.
We now support only “current”, “active” or “maintenance” versions
according to https://nodejs.org/en/about/releases/, which are
compatible with NAPI v6.
There is a segfault with `napi-rs` and Node.js in v12.17. It's an old
version, it may be fair to drop its support for now. Let's see if
people would need it in the future, we may work on `napi-rs` to fix
this bug in case it's really necessary.
- separate Styles from ci.yaml into its own for clarity
- extend pre-commit config with other useful defaults
- move clippy, tests and typos into a push-based pre-commit
Simplifies the cache configuration and could also improve build times by
disabling incremental compilation and potentially caching fewer things
or using a better cache key.
Running CI on every push means running it twice for any PR as well as commit on branches that aren't PRs. This limits the CI run to pull-requests against main and pushes to main directly, removing unnecessary workload for the CI and making PRs CI faster.