Skip to content

Commit

Permalink
Improve contributing experience for tests (vleue#7)
Browse files Browse the repository at this point in the history
* move aurora tests to examples and run them in CI

* contributing guide
  • Loading branch information
mockersf authored Oct 1, 2022
1 parent 7a58a5d commit 640926f
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 1 deletion.
20 changes: 19 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,22 @@ jobs:

- name: Run tests
run: |
cargo test --release
cargo test
tests-aurora:
name: Tests Aurora Map
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Run tests
run: |
cargo test --release --examples
33 changes: 33 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Welcome to Polyanya contributing guide

Thank you for investing your time in contributing to this project!

## New contributor guide

To get an overview of the project, read the [README](README.md). Here are some resources to help you get started with open source contributions:

- [Set up Git](https://docs.github.com/en/get-started/quickstart/set-up-git)
- [Collaborating with pull requests](https://docs.github.com/en/github/collaborating-with-pull-requests)

## Getting started

### Issues

#### Create a new issue

If you spot a problem with the library, [search if an issue already exists](https://docs.github.com/en/github/searching-for-information-on-github/searching-on-github/searching-issues-and-pull-requests#search-by-the-title-body-or-comments). If a related issue doesn't exist, you can [open a new issue](https://github.com/vleue/polyanya/issues/new/choose).

#### Solve an issue

Scan through our [existing issues](https://github.com/vleue/polyanya/issues) to find one that interests you. If you find an issue to work on, you are welcome to open a PR with a fix.

### Pull Request

GitHub Actions will run a few checks on each PR:
* Formatting, with `cargo fmt --all`
* Clippy lints, with `cargo clippy -- -D warnings`
* Tests, with `cargo tests` and `cargo test --release --examples`

Tests on examples can be quite expensive to compile and run, don't hesitate to not run those locally before creating a PR.

Additionally, benchmarks are available to ensure your PR doesn't introduce regressions. They are not run in actions, you are encouraged to run them locally on the `main` branch then on your branch to check for any improvement.
6 changes: 6 additions & 0 deletions tests/aurora-merged.rs → examples/tests-aurora-merged.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
fn main() {}

#[cfg(test)]
use glam::Vec2;
#[cfg(test)]
use polyanya::Mesh;

#[cfg(test)]
macro_rules! assert_delta {
($x:expr, $y:expr) => {
let val = $x;
Expand All @@ -10,6 +15,7 @@ macro_rules! assert_delta {
};
}

#[cfg(test)]
fn aurora_mesh() -> Mesh {
Mesh::from_file("meshes/aurora-merged.mesh".into())
}
Expand Down
6 changes: 6 additions & 0 deletions tests/aurora.rs → examples/tests-aurora.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
fn main() {}

#[cfg(test)]
use glam::Vec2;
#[cfg(test)]
use polyanya::Mesh;

#[cfg(test)]
macro_rules! assert_delta {
($x:expr, $y:expr) => {
let val = $x;
Expand All @@ -10,6 +15,7 @@ macro_rules! assert_delta {
};
}

#[cfg(test)]
fn aurora_mesh() -> Mesh {
Mesh::from_file("meshes/aurora.mesh".into())
}
Expand Down

0 comments on commit 640926f

Please sign in to comment.