-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run rustfmt and clippy, add CI checks (#23)
* Run rustfmt * Apply clippy --fix * Add CI workflows * reorder imports with rustfmt nightly * Update tket-json dependency * Disable tkcxx feature for the meantime * Add miri ignores * Drop hugr branch from CI workflows
- Loading branch information
Showing
15 changed files
with
323 additions
and
201 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
name: Continuous integration | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
workflow_dispatch: {} | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
CARGO_INCREMENTAL: 0 | ||
RUSTFLAGS: "--cfg=ci_run" | ||
MIRIFLAGS: '-Zmiri-permissive-provenance' # Required due to warnings in bitvec 1.0.1 | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install stable toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: rustfmt, clippy | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
prefix-key: v0 | ||
- name: Check formatting | ||
run: cargo fmt -- --check | ||
- name: Run clippy | ||
run: cargo clippy --all-targets -- -D warnings | ||
- name: Build docs | ||
run: cargo doc --no-deps --all-features | ||
env: | ||
RUSTDOCFLAGS: "-Dwarnings" | ||
|
||
benches: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install stable toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
prefix-key: v0 | ||
- name: Build benchmarks with no features | ||
run: cargo bench --verbose --no-run --no-default-features | ||
- name: Build benchmarks with all features | ||
run: cargo bench --verbose --no-run --all-features | ||
|
||
tests: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
include: | ||
#- rust: 1.70.0 # Update once MSRV != stable | ||
- rust: stable | ||
cache: true | ||
- rust: beta | ||
cache: true | ||
- rust: nightly | ||
cache: true | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- id: toolchain | ||
uses: dtolnay/rust-toolchain@master | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
- name: Configure default rust toolchain | ||
run: rustup override set ${{steps.toolchain.outputs.name}} | ||
- uses: Swatinem/rust-cache@v2 | ||
if: ${{ matrix.cache }} | ||
with: | ||
prefix-key: v0-rust-${{ matrix.rust }} | ||
- name: Build with no features | ||
run: cargo build --verbose --no-default-features | ||
- name: Build with all features | ||
run: cargo build --verbose --all-features | ||
- name: Tests with no features | ||
run: cargo test --verbose --no-default-features | ||
- name: Tests with all features | ||
run: cargo test --verbose --all-features |
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,33 @@ | ||
name: cleanup caches by a branch | ||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
cleanup: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Cleanup | ||
run: | | ||
gh extension install actions/gh-actions-cache | ||
REPO=${{ github.repository }} | ||
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge" | ||
echo "Fetching list of cache key" | ||
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 ) | ||
## Setting this to not fail the workflow while deleting cache keys. | ||
set +e | ||
echo "Deleting caches..." | ||
for cacheKey in $cacheKeysForPR | ||
do | ||
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm | ||
done | ||
echo "Done" | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,32 @@ | ||
name: Unsoundness checks | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- hugr | ||
workflow_dispatch: {} | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
CARGO_INCREMENTAL: 0 | ||
RUSTFLAGS: "--cfg=ci_run" | ||
MIRIFLAGS: '-Zmiri-permissive-provenance' # Required due to warnings in bitvec 1.0.1 | ||
|
||
jobs: | ||
|
||
miri: | ||
name: "Miri" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Miri | ||
run: | | ||
rustup toolchain install nightly --component miri | ||
rustup override set nightly | ||
cargo miri setup | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
prefix-key: v0-miri | ||
- name: Test with Miri | ||
run: cargo miri test |
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 |
---|---|---|
|
@@ -11,17 +11,12 @@ lazy_static = "1.4.0" | |
cgmath = "0.18.0" | ||
num-rational = "0.4" | ||
num-complex = { version = "0.4", optional = true } | ||
tket-json-rs = { git = "ssh://[email protected]/CQCL/tket-json-rs.git", features = [ | ||
"tket2ops", | ||
] } | ||
# tket-json-rs = {path = "../tket-json-rs", features = [ | ||
# "tket2ops", | ||
# ] } | ||
tket-json-rs = { git = "https://github.com/CQCL/tket-json-rs", features = ["tket2ops"] } | ||
rayon = "1.5" | ||
pyo3 = { version = "0.16.5", optional = true, features = [ | ||
"multiple-pymethods", | ||
] } | ||
tket-rs = { optional = true, git = "ssh://[email protected]/CQCL-DEV/tket-rs.git" } | ||
#tket-rs = { optional = true, git = "ssh://[email protected]/CQCL-DEV/tket-rs.git" } | ||
thiserror = "1.0.28" | ||
serde = { version = "1.0", features = ["derive"] } | ||
serde_json = "1.0" | ||
|
@@ -35,16 +30,16 @@ typetag = "0.2.8" | |
|
||
[features] | ||
pyo3 = ["dep:pyo3", "tket-json-rs/pyo3", "tket-json-rs/tket2ops", "portgraph/pyo3"] | ||
tkcxx = ["dep:tket-rs", "dep:num-complex"] | ||
#tkcxx = ["dep:tket-rs", "dep:num-complex"] | ||
|
||
[dev-dependencies] | ||
rstest = "0.12.0" | ||
criterion = { version = "0.3", features = ["html_reports"] } | ||
|
||
|
||
[[bench]] | ||
name = "tket2_bench" | ||
harness = false | ||
#[[bench]] | ||
#name = "tket2_bench" | ||
#harness = false | ||
|
||
[workspace] | ||
|
||
|
Oops, something went wrong.