Skip to content

Commit

Permalink
Merge pull request #103 from zkcrypto/update-ci
Browse files Browse the repository at this point in the history
Update CI
  • Loading branch information
str4d authored Feb 27, 2023
2 parents a6c2056 + 477b97c commit 31e3bcf
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 70 deletions.
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
timezone: Etc/UTC
open-pull-requests-limit: 10
reviewers:
- str4d
assignees:
- str4d
labels:
- "A-CI"
101 changes: 33 additions & 68 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,6 @@ name: CI checks
on: [push, pull_request]

jobs:
lint:
name: Lint
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.56.0
override: true

# Ensure all code has been formatted with rustfmt
- run: rustup component add rustfmt
- name: Check formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check --color always

test:
name: Test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand All @@ -30,25 +11,9 @@ jobs:
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.56.0
override: true
- name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch
- name: Build tests
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --release --tests --features experimental,zeroize
- uses: actions/checkout@v3
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --release --features experimental,zeroize
run: cargo test --verbose --release --features experimental,zeroize

no-std:
name: Check no-std target ${{ matrix.target }}
Expand All @@ -61,41 +26,41 @@ jobs:
- wasm32-wasi

steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: 1.56.0
override: true
- uses: actions/checkout@v3
- run: rustup target add ${{ matrix.target }}
- name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch
- run: cargo fetch
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --verbose --target ${{ matrix.target }} --no-default-features --features groups,pairings
run: >
cargo build
--verbose
--target ${{ matrix.target }}
--no-default-features
--features groups,pairings
doc-links:
name: Nightly lint
bitrot:
name: Bitrot check
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: cargo fetch
uses: actions-rs/cargo@v1
with:
command: fetch
- uses: actions/checkout@v3
# Build benchmarks and all-features to prevent bitrot
- name: Build benchmarks
run: cargo build --benches --examples --all-features

# Ensure intra-documentation links all resolve correctly
# Requires #![deny(intra_doc_link_resolution_failure)] in crate.
doc-links:
name: Intra-doc links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: cargo fetch
# Requires #![deny(rustdoc::broken_intra_doc_links)] in crate.
- name: Check intra-doc links
uses: actions-rs/cargo@v1
with:
command: doc
args: --document-private-items
run: cargo doc --document-private-items

fmt:
name: Rustfmt
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check formatting
run: cargo fmt --all -- --check
24 changes: 24 additions & 0 deletions .github/workflows/lints-beta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Beta lints

# These lints are only informative, so we only run them directly on branches
# and not trial-merges of PRs, to reduce noise.
on: push

jobs:
clippy-beta:
name: Clippy (beta)
timeout-minutes: 30
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@beta
id: toolchain
- run: rustup override set ${{steps.toolchain.outputs.name}}
- name: Run Clippy (beta)
uses: actions-rs/clippy-check@v1
continue-on-error: true
with:
name: Clippy (beta)
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -W clippy::all
18 changes: 18 additions & 0 deletions .github/workflows/lints-stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Stable lints

# We only run these lints on trial-merges of PRs to reduce noise.
on: pull_request

jobs:
clippy:
name: Clippy (MSRV)
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run clippy
uses: actions-rs/clippy-check@v1
with:
name: Clippy (MSRV)
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features --all-targets -- -D warnings
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ edition = "2021"
rustdoc-args = [ "--html-in-header", "katex-header.html" ]

[dev-dependencies]
csv = ">= 1.0, < 1.2" # csv 1.2 has MSRV 1.60
criterion = "0.3"
hex = "0.4"
rand_xorshift = "0.3"
Expand Down
1 change: 0 additions & 1 deletion rust-toolchain

This file was deleted.

3 changes: 3 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "1.56.0"
components = [ "clippy", "rustfmt" ]
2 changes: 1 addition & 1 deletion src/hash_to_curve/map_scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ impl HashToField for Scalar {

fn from_okm(okm: &GenericArray<u8, U48>) -> Scalar {
let mut bs = [0u8; 64];
bs[16..].copy_from_slice(&okm);
bs[16..].copy_from_slice(okm);
bs.reverse(); // into little endian
Scalar::from_bytes_wide(&bs)
}
Expand Down

0 comments on commit 31e3bcf

Please sign in to comment.