Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Binary serialisation format for hugr-model based on capnproto. #1557

Merged
merged 7 commits into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions .github/workflows/ci-py.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ jobs:
outputs:
python: ${{ github.ref_name == github.event.repository.default_branch || steps.filter.outputs.python }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: .github/change-filters.yml
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: .github/change-filters.yml

check:
needs: changes
Expand All @@ -44,7 +44,7 @@ jobs:

strategy:
matrix:
python-version: ['3.10', '3.12']
python-version: ["3.10", "3.12"]

steps:
- uses: actions/checkout@v4
Expand All @@ -58,7 +58,7 @@ jobs:
enable-cache: true
- name: Install Python
run: uv python install ${{ matrix.python-version }}

- name: Setup dependencies. Fail if the lockfile is outdated.
run: uv sync --locked

Expand Down Expand Up @@ -86,6 +86,8 @@ jobs:
- uses: mozilla-actions/sccache-action@v0.0.6
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install CapnProto
run: sudo apt-get install -y capnproto
- name: Build HUGR binary
run: cargo build -p hugr-cli
- name: Upload the binary to the artifacts
Expand All @@ -102,11 +104,11 @@ jobs:
strategy:
matrix:
python-version:
- { py: '3.10', coverage: false }
- { py: '3.12', coverage: true }
- { py: "3.10", coverage: false }
- { py: "3.12", coverage: true }
steps:
- uses: actions/checkout@v4

- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
Expand Down Expand Up @@ -183,7 +185,6 @@ jobs:
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:
Expand Down
47 changes: 33 additions & 14 deletions .github/workflows/ci-rs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ 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
MIRIFLAGS: "-Zmiri-permissive-provenance" # Required due to warnings in bitvec 1.0.1
CI: true # insta snapshots behave differently on ci
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
Expand All @@ -34,11 +34,11 @@ jobs:
outputs:
rust: ${{ github.ref_name == github.event.repository.default_branch || steps.filter.outputs.rust }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: .github/change-filters.yml
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: .github/change-filters.yml

check:
needs: changes
Expand All @@ -51,6 +51,8 @@ jobs:
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Install CapnProto
run: sudo apt-get install -y capnproto
- name: Check formatting
run: cargo fmt -- --check
- name: Run clippy
Expand All @@ -70,6 +72,8 @@ jobs:
- uses: mozilla-actions/sccache-action@v0.0.6
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install CapnProto
run: sudo apt-get install -y capnproto
- name: Build benchmarks with no features
run: cargo bench --verbose --no-run --workspace --no-default-features
- name: Build benchmarks with all features
Expand All @@ -87,9 +91,11 @@ jobs:
- id: toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: 'stable'
toolchain: "stable"
- name: Configure default rust toolchain
run: rustup override set ${{steps.toolchain.outputs.name}}
- name: Install CapnProto
run: sudo apt-get install -y capnproto
- name: Build with no features
run: cargo test --verbose --workspace --no-default-features --no-run
- name: Tests with no features
Expand All @@ -107,9 +113,11 @@ jobs:
- id: toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: 'stable'
toolchain: "stable"
- name: Configure default rust toolchain
run: rustup override set ${{steps.toolchain.outputs.name}}
- name: Install CapnProto
run: sudo apt-get install -y capnproto
- name: Build with all features
run: cargo test --verbose --workspace --all-features --no-run
- name: Tests with all features
Expand All @@ -132,7 +140,7 @@ jobs:
matrix:
# Stable is covered by `tests-stable-no-features` and `tests-stable-all-features`
# Nightly is covered by `tests-nightly-coverage`
rust: ['1.75', beta]
rust: ["1.75", beta]
name: tests (Rust ${{ matrix.rust }})
steps:
- uses: actions/checkout@v4
Expand All @@ -143,6 +151,8 @@ jobs:
toolchain: ${{ matrix.rust }}
- name: Configure default rust toolchain
run: rustup override set ${{steps.toolchain.outputs.name}}
- name: Install CapnProto
run: sudo apt-get install -y capnproto
- name: Build with no features
run: cargo test --verbose --workspace --no-default-features --no-run
- name: Tests with no features
Expand Down Expand Up @@ -190,15 +200,17 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
# Nightly is required to count doctests coverage
toolchain: 'nightly'
toolchain: "nightly"
components: llvm-tools-preview
- name: Install CapnProto
run: sudo apt-get install -y capnproto
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Run tests with coverage instrumentation
run: |
cargo llvm-cov clean --workspace
cargo llvm-cov --no-report --workspace --no-default-features --doctests
cargo llvm-cov --no-report --workspace --all-features --doctests
cargo llvm-cov clean --workspace
cargo llvm-cov --no-report --workspace --no-default-features --doctests
cargo llvm-cov --no-report --workspace --all-features --doctests
- name: Generate coverage report
run: cargo llvm-cov --all-features report --codecov --output-path coverage.json
- name: Upload coverage to codecov.io
Expand All @@ -213,7 +225,14 @@ jobs:
# even if they are skipped due to no changes in the relevant files.
required-checks:
name: Required checks 🦀
needs: [changes, check, tests-stable-no-features, tests-stable-all-features, std-extensions]
needs:
[
changes,
check,
tests-stable-no-features,
tests-stable-all-features,
std-extensions,
]
if: ${{ !cancelled() }}
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions devenv.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ in
pkgs-stable.cargo-llvm-cov
pkgs.graphviz
pkgs.cargo-insta
pkgs.capnproto
] ++ lib.optionals
pkgs.stdenv.isDarwin
(with pkgs.darwin.apple_sdk; [
Expand Down
1 change: 1 addition & 0 deletions hugr-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ workspace = true
extension_inference = []
declarative = ["serde_yaml"]
model_unstable = ["hugr-model"]
default = ["model_unstable"]
ss2165 marked this conversation as resolved.
Show resolved Hide resolved

[[test]]
name = "model"
Expand Down
Loading
Loading