-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tket2-hseries): cli extension dumping (#584)
Closes #556 --------- Co-authored-by: Douglas Wilson <[email protected]>
- Loading branch information
Showing
13 changed files
with
2,053 additions
and
3 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 |
---|---|---|
|
@@ -278,11 +278,34 @@ jobs: | |
flags: python | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
# Ensure that serialized extensions match rust implementation | ||
tket2-extensions: | ||
needs: [changes, tests-rs-stable-all-features] | ||
if: ${{ needs.changes.outputs.rust == 'true' && github.event_name != 'merge_group' }} | ||
name: Check standard extensions | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: mozilla-actions/[email protected] | ||
- name: Install stable toolchain | ||
uses: dtolnay/rust-toolchain@stable | ||
- uses: extractions/setup-just@v2 | ||
- name: Generate the updated definitions | ||
run: just gen-extensions | ||
- name: Check if the declarations are up to date | ||
run: | | ||
git diff --exit-code --name-only tket2-py/tket2/extensions/_json_defs | ||
if [ $? -ne 0 ]; then | ||
echo "The serialized standard extensions are not up to date" | ||
echo "Please run 'just gen-extensions' and commit the changes" | ||
exit 1 | ||
fi | ||
# This is a meta job to mark successful completion of the required checks, | ||
# even if they are skipped due to no changes in the relevant files. | ||
required-checks: | ||
name: Required checks 🦀+🐍 | ||
needs: [changes, check-rs, check-py, tests-rs-stable-no-features, tests-rs-stable-all-features, tests-py] | ||
needs: [changes, check-rs, check-py, tests-rs-stable-no-features, tests-rs-stable-all-features, tests-py, tket2-extensions] | ||
if: ${{ !cancelled() }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//! CLI for tket2-hseries | ||
|
||
use clap::Parser as _; | ||
use hugr::extension::ExtensionRegistry; | ||
use tket2_hseries::cli::CliArgs; | ||
|
||
fn main() { | ||
match CliArgs::parse() { | ||
CliArgs::GenExtensions(args) => { | ||
let reg = ExtensionRegistry::try_new([ | ||
tket2::extension::TKET2_EXTENSION.to_owned(), | ||
tket2::extension::angle::ANGLE_EXTENSION.to_owned(), | ||
tket2_hseries::extension::hseries::EXTENSION.to_owned(), | ||
tket2_hseries::extension::futures::EXTENSION.to_owned(), | ||
tket2_hseries::extension::result::EXTENSION.to_owned(), | ||
]) | ||
.unwrap(); | ||
|
||
args.run_dump(®); | ||
} | ||
_ => { | ||
eprintln!("Unknown command"); | ||
std::process::exit(1); | ||
} | ||
}; | ||
} |
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,14 @@ | ||
//! CLI tools for tket2-hseries. | ||
|
||
use clap::Parser; | ||
|
||
/// CLI arguments. | ||
#[derive(Parser, Debug)] | ||
#[clap(version = "1.0", long_about = None)] | ||
#[clap(about = "tket2-hseries CLI tools.")] | ||
#[group(id = "tket2-hseries")] | ||
#[non_exhaustive] | ||
pub enum CliArgs { | ||
/// Generate serialized extensions. | ||
GenExtensions(hugr_cli::extensions::ExtArgs), | ||
} |
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.