From 01e9a83d3faf338287a3997bafb7152f8fd34c0c Mon Sep 17 00:00:00 2001 From: Bogdan Opanchuk Date: Tue, 19 Nov 2024 14:52:00 -0800 Subject: [PATCH] Update CI actions to match the newer setup of `manul` --- .github/workflows/ci.yml | 126 +++++++++++++++++++++++++++++++++++++ .github/workflows/lint.yml | 41 ------------ .github/workflows/test.yml | 66 ------------------- .gitignore | 7 +-- README.md | 5 +- synedrion/Cargo.toml | 1 + 6 files changed, 134 insertions(+), 112 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/lint.yml delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..641caca9 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,126 @@ +name: ci +on: + workflow_dispatch: + pull_request: + paths-ignore: [README.md] + push: + branches: master + paths-ignore: [README.md] + +env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-Dwarnings" + +jobs: + wasm-build: + runs-on: ubuntu-latest + strategy: + matrix: + rust: + - 1.81.0 # MSRV + - stable + target: + - wasm32-unknown-unknown + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + targets: ${{ matrix.target }} + - run: cargo build --target ${{ matrix.target }} --no-default-features + - run: cargo build --target ${{ matrix.target }} + + test-and-coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@v1 + with: + profile: minimal + toolchain: stable + target: x86_64-unknown-linux-gnu + override: true + - name: Install cargo-llvm-cov + uses: taiki-e/install-action@cargo-llvm-cov + - name: Generate code coverage + run: cargo llvm-cov --workspace --all-features --lcov --output-path lcov.info + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: lcov.info + fail_ci_if_error: true + + # This is supposed to factor out possible bugs introduced by Rust compiler changes + # and dependency changes, making the results more reproducible. + stable-test: + runs-on: ubuntu-latest + strategy: + matrix: + include: + - target: x86_64-unknown-linux-gnu + rust: 1.81.0 # MSRV + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + target: ${{ matrix.target }} + profile: minimal + override: true + - run: ${{ matrix.deps }} + - run: cargo test --workspace --locked --all-features --target ${{ matrix.target }} + + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions-rs/toolchain@v1 + with: + toolchain: 1.81.0 # MSRV + components: clippy + override: true + profile: minimal + - run: cargo clippy --all --all-features --tests --benches -- -D warnings + + # Mimics the setup of docs.rs, but fails on warnings + build-docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + override: true + profile: minimal + - run: env RUSTDOCFLAGS='--cfg docsrs -D warnings' cargo doc --all-features + + rustfmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@v1 + with: + toolchain: stable + components: rustfmt + profile: minimal + override: true + - uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check + + semver: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@v1 + with: + toolchain: stable + components: rustfmt + profile: minimal + override: true + - uses: obi1kenobi/cargo-semver-checks-action@v2 + with: + package: synedrion + feature-group: all-features diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 32e219b1..00000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Linting - -on: - pull_request: - paths-ignore: - - README.md - push: - branches: master - paths-ignore: - - README.md - -jobs: - format: - strategy: - matrix: - os: - - ubuntu-latest - runs-on: ${{ matrix.os }} - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - 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: --all --all-features --tests --benches -- -D warnings diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 9b6044f7..00000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,66 +0,0 @@ -name: Testing - -on: - pull_request: - paths-ignore: - - README.md - push: - branches: master - paths-ignore: - - README.md - -jobs: - - test-and-codecov: - runs-on: ubuntu-latest - strategy: - matrix: - rust: - - stable - target: - - wasm32-unknown-unknown - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ matrix.rust }} - target: ${{ matrix.target }} - override: true - - - name: Install cargo-llvm-cov - uses: taiki-e/install-action@cargo-llvm-cov - - name: Generate code coverage - run: cargo llvm-cov --workspace --release --lcov --output-path lcov.info - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: lcov.info - fail_ci_if_error: true - - build-wasm: - runs-on: ubuntu-latest - strategy: - matrix: - rust: - - stable - target: - - wasm32-unknown-unknown - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Install stable toolchain - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ matrix.rust }} - target: ${{ matrix.target }} - override: true - - - name: Build - run: cargo build --target ${{ matrix.target }} --release --no-default-features diff --git a/.gitignore b/.gitignore index cd54cdf7..359abe77 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -target/ -synedrion-wasm/pkg/ -node_modules -Cargo.lock +/target +*.sublime-project +*.sublime-workspace diff --git a/README.md b/README.md index 29baa8bf..4700c712 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ # Synedrion - [![crate][crate-image]][crate-link] [![Docs][docs-image]][docs-link] ![License][license-image] +[![Build Status][build-image]][build-link] [![Coverage][coverage-image]][coverage-link] [crate-image]: https://img.shields.io/crates/v/synedrion.svg @@ -11,9 +11,12 @@ [docs-image]: https://docs.rs/synedrion/badge.svg [docs-link]: https://docs.rs/synedrion/ [license-image]: https://img.shields.io/crates/l/synedrion +[build-image]: https://github.com/entropyxyz/synedrion/actions/workflows/ci.yml/badge.svg?branch=master&event=push +[build-link]: https://github.com/entropyxyz/synedrion/actions?query=workflow%3Aci [coverage-image]: https://codecov.io/gh/entropyxyz/synedrion/branch/master/graph/badge.svg [coverage-link]: https://codecov.io/gh/entropyxyz/synedrion + ### A threshold signing library based on the CGGMP'21 scheme. **WARNING:** the library is a work in progress (see [Issues](https://github.com/entropyxyz/synedrion/issues)), and has not been audited. Use at your own risk. diff --git a/synedrion/Cargo.toml b/synedrion/Cargo.toml index c71899f0..62690259 100644 --- a/synedrion/Cargo.toml +++ b/synedrion/Cargo.toml @@ -3,6 +3,7 @@ name = "synedrion" authors = ['Entropy Cryptography '] version = "0.3.0-dev" edition = "2021" +rust-version = "1.81" license = "AGPL-3.0-or-later" description = "Threshold signing library based on Canetti-Gennaro-Goldfeder-Makriyannis-Peled '21 scheme" repository = "https://github.com/entropyxyz/synedrion"