Skip to content
This repository was archived by the owner on Jun 7, 2026. It is now read-only.

Commit 1d32e5f

Browse files
authored
Merge pull request zkcrypto#61 from zkcrypto/ci-overhaul
CI overhaul
2 parents 0c5b044 + 39a9ad9 commit 1d32e5f

7 files changed

Lines changed: 145 additions & 82 deletions

File tree

.github/workflows/ci.yml

Lines changed: 72 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,93 @@
11
name: CI checks
22

3-
on: [push, pull_request]
3+
on:
4+
pull_request:
5+
push:
6+
branches: main
47

58
jobs:
6-
lint:
7-
name: Lint
8-
runs-on: ubuntu-latest
9-
9+
test-msrv:
10+
name: Test MSRV on ${{ matrix.os }}
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest, windows-latest, macOS-latest]
1015
steps:
11-
- uses: actions/checkout@v1
12-
- uses: actions-rs/toolchain@v1
13-
with:
14-
toolchain: 1.56.0
15-
override: true
16-
17-
# Ensure all code has been formatted with rustfmt
18-
- run: rustup component add rustfmt
19-
- name: Check formatting
20-
uses: actions-rs/cargo@v1
21-
with:
22-
command: fmt
23-
args: -- --check --color always
16+
- uses: actions/checkout@v4
17+
- name: Run tests
18+
run: cargo test --verbose --all-features
19+
- name: Verify working directory is clean
20+
run: git diff --exit-code
2421

25-
test:
26-
name: Test on ${{ matrix.os }}
22+
test-latest:
23+
name: Test latest on ${{ matrix.os }}
2724
runs-on: ${{ matrix.os }}
2825
strategy:
2926
matrix:
3027
os: [ubuntu-latest, windows-latest, macOS-latest]
31-
3228
steps:
33-
- uses: actions/checkout@v1
34-
- uses: actions-rs/toolchain@v1
35-
with:
36-
toolchain: 1.56.0
37-
override: true
38-
- name: cargo fetch
39-
uses: actions-rs/cargo@v1
40-
with:
41-
command: fetch
42-
- name: Build tests
43-
uses: actions-rs/cargo@v1
44-
with:
45-
command: build
46-
args: --verbose --release --tests
29+
- uses: actions/checkout@v4
30+
- uses: dtolnay/rust-toolchain@stable
31+
id: toolchain
32+
- run: rustup override set ${{steps.toolchain.outputs.name}}
33+
- name: Remove lockfile to build with latest dependencies
34+
run: rm Cargo.lock
4735
- name: Run tests
48-
uses: actions-rs/cargo@v1
49-
with:
50-
command: test
51-
args: --verbose --release
52-
- name: Run --all-features tests
53-
uses: actions-rs/cargo@v1
54-
with:
55-
command: test
56-
args: --all-features --verbose --release
36+
run: cargo test --verbose --all-features
37+
- name: Verify working directory is clean (excluding lockfile)
38+
run: git diff --exit-code ':!Cargo.lock'
5739

58-
no-std:
59-
name: Check no-std compatibility
40+
build-nodefault:
41+
name: Build target ${{ matrix.target }}
6042
runs-on: ubuntu-latest
61-
43+
strategy:
44+
matrix:
45+
target:
46+
- wasm32-wasi
47+
- thumbv6m-none-eabi
48+
- thumbv7em-none-eabihf
6249
steps:
63-
- uses: actions/checkout@v1
64-
- uses: actions-rs/toolchain@v1
50+
- uses: actions/checkout@v4
6551
with:
66-
toolchain: 1.56.0
67-
override: true
68-
- run: rustup target add thumbv6m-none-eabi
69-
- name: cargo fetch
70-
uses: actions-rs/cargo@v1
71-
with:
72-
command: fetch
73-
- name: Build
74-
uses: actions-rs/cargo@v1
75-
with:
76-
command: build
77-
args: --verbose --target thumbv6m-none-eabi --no-default-features
52+
path: crate_root
53+
# We use a synthetic crate to ensure no dev-dependencies are enabled, which can
54+
# be incompatible with some of these targets.
55+
- name: Create synthetic crate for testing
56+
run: cargo init --edition 2021 --lib ci-build
57+
- name: Copy Rust version into synthetic crate
58+
run: cp crate_root/rust-toolchain.toml ci-build/
59+
- name: Copy patch directives into synthetic crate
60+
run: |
61+
echo "[patch.crates-io]" >> ./ci-build/Cargo.toml
62+
cat ./crate_root/Cargo.toml | sed "0,/.\+\(patch.crates.\+\)/d" >> ./ci-build/Cargo.toml
63+
- name: Add no_std pragma to lib.rs
64+
run: |
65+
echo "#![no_std]" > ./ci-build/src/lib.rs
66+
- name: Add group as a dependency of the synthetic crate
67+
working-directory: ./ci-build
68+
# run: cargo add --no-default-features --path ../crate_root
69+
run: sed -i 's;\[dependencies\];\[dependencies\]\ngroup = { path = "../crate_root", default-features = false };g' ./Cargo.toml
70+
- name: Add target
71+
working-directory: ./ci-build
72+
run: rustup target add ${{ matrix.target }}
73+
- name: Build for target
74+
working-directory: ./ci-build
75+
run: cargo build --verbose --target ${{ matrix.target }}
7876

7977
doc-links:
80-
name: Nightly lint
78+
name: Intra-doc links
8179
runs-on: ubuntu-latest
82-
8380
steps:
84-
- uses: actions/checkout@v1
85-
- uses: actions-rs/toolchain@v1
86-
with:
87-
toolchain: nightly
88-
override: true
89-
- name: cargo fetch
90-
uses: actions-rs/cargo@v1
91-
with:
92-
command: fetch
93-
94-
# Ensure intra-documentation links all resolve correctly
95-
# Requires #![deny(intra_doc_link_resolution_failure)] in crate.
81+
- uses: actions/checkout@v4
82+
- run: cargo fetch
83+
# Requires #![deny(rustdoc::broken_intra_doc_links)] in crates.
84+
- run: sudo apt-get -y install libfontconfig1-dev
9685
- name: Check intra-doc links
97-
uses: actions-rs/cargo@v1
98-
with:
99-
command: doc
100-
args: --document-private-items
86+
run: cargo doc --all-features --document-private-items
87+
88+
fmt:
89+
name: Rustfmt
90+
runs-on: ubuntu-latest
91+
steps:
92+
- uses: actions/checkout@v4
93+
- run: cargo fmt -- --check

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
/target
22
**/*.rs.bk
3-
Cargo.lock

Cargo.lock

Lines changed: 61 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ authors = [
55
"Sean Bowe <ewillbefull@gmail.com>",
66
"Jack Grigg <jack@z.cash>",
77
]
8+
edition = "2021"
9+
rust-version = "1.56"
810
readme = "README.md"
911
license = "MIT/Apache-2.0"
1012

1113
description = "Elliptic curve group traits and utilities"
1214
documentation = "https://docs.rs/group/"
1315
homepage = "https://github.com/zkcrypto/group"
1416
repository = "https://github.com/zkcrypto/group"
15-
edition = "2021"
1617

1718
[dependencies]
1819
ff = { version = "0.13", default-features = false }

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ If you want to propose "substantial" changes to this crate (in particular to the
99
`group` traits), please [create an RFC](https://github.com/zkcrypto/rfcs) for
1010
wider discussion.
1111

12+
## Minimum Supported Rust Version
13+
14+
Requires Rust **1.56** or higher.
15+
16+
Minimum supported Rust version can be changed in the future, but it will be done with a
17+
minor version bump.
18+
1219
## License
1320

1421
Licensed under either of

rust-toolchain

Lines changed: 0 additions & 1 deletion
This file was deleted.

rust-toolchain.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[toolchain]
2+
channel = "1.56.0"
3+
components = [ "clippy", "rustfmt" ]

0 commit comments

Comments
 (0)