-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #100 from nyx-space/99-port-test-suite-to-github
Add github workflow with coverage
- Loading branch information
Showing
60 changed files
with
507 additions
and
361 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: cargo | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
time: "11:00" | ||
open-pull-requests-limit: 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,183 @@ | ||
name: Rust testing, coverage, lint | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- "*" | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
env: | ||
RUST_BACKTRACE: 1 | ||
|
||
jobs: | ||
check: | ||
name: Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
|
||
- name: Run cargo check | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
|
||
tests: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
rust: | ||
- { version: "1.64", name: MSRV } | ||
- { version: stable, name: stable } | ||
|
||
runs-on: ${{ matrix.os }} | ||
name: Tests (${{ matrix.os }}, ${{ matrix.rust.name }}) | ||
needs: [check] | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install ${{ matrix.rust.name }} toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: ${{ matrix.rust.version }} | ||
override: true | ||
|
||
- name: Set up cargo cache | ||
uses: actions/cache@v3 | ||
continue-on-error: false | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: ${{ runner.os }}-cargo- | ||
|
||
- name: Unit Test (debug) | ||
run: cargo test --lib | ||
|
||
- name: All integration tests (release) | ||
run: cargo test --release --test "*" | ||
|
||
scenario-check: | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
rust: | ||
- { version: "1.64", name: MSRV } | ||
- { version: stable, name: stable } | ||
|
||
runs-on: ${{ matrix.os }} | ||
name: Scenarios (${{ matrix.os }}, ${{ matrix.rust.name }}) | ||
needs: [tests] | ||
|
||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install ${{ matrix.rust.name }} toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: ${{ matrix.rust.version }} | ||
override: true | ||
|
||
- name: All integration tests (release) | ||
run: | | ||
cargo run --release -- data/simple-scenario.toml --all | ||
# Check that when we do a unit conversion it's correct | ||
# NOTE: We don't do that with km output because the unit conversion leads to some rounding issues | ||
diff ./data/scenario-run-cm.csv ./data/scenario-run-m.csv | ||
cargo run --release -- data/simple-od-scenario.toml | ||
cargo run --release -- "data/od_validation/*" -a | ||
cargo run --release -- data/iss-example.toml -s iss_cond | ||
lints: | ||
name: Lints | ||
runs-on: ubuntu-latest | ||
needs: [tests] | ||
|
||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
components: rustfmt, clippy | ||
|
||
- name: Run cargo fmt | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --all -- --check | ||
|
||
- name: Run cargo clippy | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: clippy | ||
args: -- -D warnings | ||
|
||
audit: | ||
name: Security Audit | ||
runs-on: ubuntu-latest | ||
needs: [lints] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
|
||
- name: Install cargo-audit | ||
run: cargo install cargo-audit | ||
|
||
- name: Audit code | ||
run: cargo audit | ||
|
||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
needs: [check, tests, scenario-check, lints, audit] | ||
|
||
if: github.ref_type == 'tag' | ||
steps: | ||
- name: Checkout sources | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install stable toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
components: rustfmt, clippy | ||
|
||
- name: Publish to crates.io | ||
env: | ||
TOKEN: ${{ secrets.CRATESIO_API_TOKEN }} | ||
run: | | ||
cargo login $TOKEN | ||
cargo publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.