diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9cf6761 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,74 @@ +name: CI + +on: + pull_request: + push: + branches: + - main + +jobs: + test: + name: Run tests + runs-on: ubuntu-latest + strategy: + matrix: + BUILD_TARGET: + - release + - dev + + steps: + - uses: actions/checkout@v4 + - name: Cache cargo crates + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-${{ matrix.BUILD_TARGET }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Run tests for `core` + run: cargo test --profile ${{ matrix.BUILD_TARGET }} --all-features -p haloumi-core + + doc-links: + if: github.event.pull_request.draft == false + name: Intra-doc links + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: 'Install rust-toolchain.toml' + run: rustup toolchain install + - name: cargo fetch + run: cargo fetch + + # Ensure intra-documentation links all resolve correctly + # Requires #![deny(intra_doc_link_resolution_failure)] in crates. + - name: Check intra-doc links + run: cargo doc --workspace --document-private-items --no-deps + + fmt: + if: github.event.pull_request.draft == false + name: Rustfmt + timeout-minutes: 30 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + - run: rustup component add rustfmt --toolchain nightly + - run: cargo +nightly fmt --all -- --check + + clippy: + if: github.event.pull_request.draft == false + name: Clippy + timeout-minutes: 30 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: 'Install rust-toolchain.toml' + run: rustup toolchain install + + - name: Run Clippy on `core` + if: always() + run: cargo clippy -p haloumi-core --all-targets --all-features -- -Dwarnings + diff --git a/core/src/expressions.rs b/core/src/expressions.rs index 00f2cfc..56afef4 100644 --- a/core/src/expressions.rs +++ b/core/src/expressions.rs @@ -77,33 +77,33 @@ where /// Output of the evaluation. type Output; - /// Evaluate the [`Expression::Constant`] case. + /// Evaluate the Expression::Constant case. fn constant(&self, f: &F) -> Self::Output; - /// Evaluate the [`Expression::Selector`] case. + /// Evaluate the Expression::Selector case. fn selector(&self, selector: &E::Selector) -> Self::Output; - /// Evaluate the [`Expression::Fixed`] case. + /// Evaluate the Expression::Fixed case. fn fixed(&self, fixed_query: &E::FixedQuery) -> Self::Output; - /// Evaluate the [`Expression::Advice`] case. + /// Evaluate the Expression::Advice case. fn advice(&self, advice_query: &E::AdviceQuery) -> Self::Output; - /// Evaluate the [`Expression::Instance`] case. + /// Evaluate the Expression::Instance case. fn instance(&self, instance_query: &E::InstanceQuery) -> Self::Output; - /// Evaluate the [`Expression::Challenge`] case. + /// Evaluate the Expression::Challenge case. fn challenge(&self, challenge: &E::Challenge) -> Self::Output; - /// Evaluate the [`Expression::Negated`] case. + /// Evaluate the Expression::Negated case. fn negated(&self, expr: Self::Output) -> Self::Output; - /// Evaluate the [`Expression::Sum`] case. + /// Evaluate the Expression::Sum case. fn sum(&self, lhs: Self::Output, rhs: Self::Output) -> Self::Output; - /// Evaluate the [`Expression::Product`] case. + /// Evaluate the Expression::Product case. fn product(&self, lhs: Self::Output, rhs: Self::Output) -> Self::Output; - /// Evaluate the [`Expression::Scaled`] case. + /// Evaluate the Expression::Scaled case. fn scaled(&self, lhs: Self::Output, rhs: &F) -> Self::Output; } diff --git a/core/src/info_traits.rs b/core/src/info_traits.rs index 53cc4de..6d314dd 100644 --- a/core/src/info_traits.rs +++ b/core/src/info_traits.rs @@ -21,7 +21,7 @@ pub trait ConstraintSystemInfo { fn gates(&self) -> Vec<&dyn GateInfo>; /// Returns a list with data about the lookups defined in the system. - fn lookups<'cs>(&'cs self) -> Vec>; + fn lookups(&self) -> Vec>; } /// Trait for querying information about the a gate in the constraint system. diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..b475f2f --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.85.0" +components = ["rustfmt", "clippy"]