Skip to content

Commit

Permalink
Merge pull request #1251 from zcash/ci-rework
Browse files Browse the repository at this point in the history
CI: Rework the test states
  • Loading branch information
nuttycom authored Mar 10, 2024
2 parents 0d4a730 + 6898dbf commit 654f116
Show file tree
Hide file tree
Showing 27 changed files with 270 additions and 203 deletions.
100 changes: 85 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,40 @@ on:
jobs:
test:
name: >
Test on ${{ matrix.os }}${{
matrix.extra_flags != 'NOT_A_PUZZLE' && format(' with --features {0}', matrix.extra_flags) || ''
}}
Test${{
matrix.state != 'NOT_A_PUZZLE' && format(' {0}', matrix.state) || ''
}} on ${{ matrix.target }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.extra_flags != 'NOT_A_PUZZLE' }}
continue-on-error: ${{ matrix.state != 'NOT_A_PUZZLE' }}
strategy:
matrix:
os: [ubuntu-latest-8cores, windows-latest-8cores, macOS-latest]
extra_flags:
target:
- Linux
- macOS
- Windows
state:
- NOT_A_PUZZLE
- orchard
- unstable-nu6
- zfuture
- Orchard
- NU6

include:
- extra_flags: orchard
- target: Linux
os: ubuntu-latest-8cores
- target: macOS
os: macOS-latest
- target: Windows
os: windows-latest-8cores

- state: Orchard
extra_flags: orchard
rustflags: '--cfg zcash_unstable="orchard"'
- state: NU6
rustflags: '--cfg zcash_unstable="nu6"'

exclude:
- os: macOS-latest
extra_flags: unstable-nu6
- os: macOS-latest
extra_flags: zfuture
- target: macOS
state: NU6

env:
RUSTFLAGS: ${{ matrix.rustflags }}
RUSTDOCFLAGS: ${{ matrix.rustflags }}
Expand All @@ -38,7 +51,7 @@ jobs:
- id: prepare
uses: ./.github/actions/prepare
with:
extra-features: ${{ matrix.extra_flags != 'NOT_A_PUZZLE' && matrix.extra_flags || '' }}
extra-features: ${{ matrix.state != 'NOT_A_PUZZLE' && matrix.extra_flags || '' }}
- uses: actions/cache@v4
with:
path: |
Expand All @@ -64,6 +77,63 @@ jobs:
- name: Verify working directory is clean
run: git diff --exit-code

# States that we want to ensure can be built, but that we don't actively run tests for.
check-msrv:
name: >
Check${{
matrix.state != 'NOT_A_PUZZLE' && format(' {0}', matrix.state) || ''
}} build on ${{ matrix.target }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.state != 'NOT_A_PUZZLE' }}
strategy:
matrix:
target:
- Linux
- macOS
- Windows
state:
- ZFuture

include:
- target: Linux
os: ubuntu-latest
- target: macOS
os: macOS-latest
- target: Windows
os: windows-latest

- state: ZFuture
rustflags: '--cfg zcash_unstable="zfuture"'

env:
RUSTFLAGS: ${{ matrix.rustflags }}
RUSTDOCFLAGS: ${{ matrix.rustflags }}

steps:
- uses: actions/checkout@v4
- id: prepare
uses: ./.github/actions/prepare
with:
extra-features: ${{ matrix.state != 'NOT_A_PUZZLE' && matrix.extra_flags || '' }}
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-msrv-${{ hashFiles('**/Cargo.lock') }}
- name: Run check
run: >
cargo check
--release
--workspace
--tests
${{ steps.prepare.outputs.feature-flags }}
- name: Verify working directory is clean
run: git diff --exit-code

build-latest:
name: Latest build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand Down
15 changes: 15 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ members = [
"components/zcash_protocol",
"zcash_client_backend",
"zcash_client_sqlite",
# Disabled until we replace the `zfutures` feature flag with a compiler flag.
# "zcash_extensions",
"zcash_extensions",
"zcash_history",
"zcash_keys",
"zcash_primitives",
Expand Down
5 changes: 5 additions & 0 deletions components/zcash_protocol/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ and this library adheres to Rust's notion of
- `zcash_protocol::memo`:
- `impl TryFrom<&MemoBytes> for Memo`

### Removed
- `unstable-nu6` and `zfuture` feature flags (use `--cfg zcash_unstable=\"nu6\"`
or `--cfg zcash_unstable=\"zfuture\"` in `RUSTFLAGS` and `RUSTDOCFLAGS`
instead).

## [0.1.0] - 2024-03-06
The entries below are relative to the `zcash_primitives` crate as of the tag
`zcash_primitives-0.14.0`.
Expand Down
11 changes: 0 additions & 11 deletions components/zcash_protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,3 @@ test-dependencies = [

## Exposes support for working with a local consensus (e.g. regtest).
local-consensus = []

#! ### Experimental features
#!
#! ⚠️ Enabling these features will likely make your code incompatible with current Zcash
#! consensus rules!

## Exposes the in-development NU6 features.
unstable-nu6 = []

## Exposes early in-development features that are not yet planned for any network upgrade.
zfuture = []
46 changes: 23 additions & 23 deletions components/zcash_protocol/src/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,9 @@ impl Parameters for MainNetwork {
NetworkUpgrade::Heartwood => Some(BlockHeight(903_000)),
NetworkUpgrade::Canopy => Some(BlockHeight(1_046_400)),
NetworkUpgrade::Nu5 => Some(BlockHeight(1_687_104)),
#[cfg(feature = "unstable-nu6")]
#[cfg(zcash_unstable = "nu6")]
NetworkUpgrade::Nu6 => None,
#[cfg(feature = "zfuture")]
#[cfg(zcash_unstable = "zfuture")]
NetworkUpgrade::ZFuture => None,
}
}
Expand Down Expand Up @@ -384,9 +384,9 @@ impl Parameters for TestNetwork {
NetworkUpgrade::Heartwood => Some(BlockHeight(903_800)),
NetworkUpgrade::Canopy => Some(BlockHeight(1_028_500)),
NetworkUpgrade::Nu5 => Some(BlockHeight(1_842_420)),
#[cfg(feature = "unstable-nu6")]
#[cfg(zcash_unstable = "nu6")]
NetworkUpgrade::Nu6 => None,
#[cfg(feature = "zfuture")]
#[cfg(zcash_unstable = "zfuture")]
NetworkUpgrade::ZFuture => None,
}
}
Expand Down Expand Up @@ -452,14 +452,14 @@ pub enum NetworkUpgrade {
/// The [Nu6] network upgrade.
///
/// [Nu6]: https://z.cash/upgrade/nu6/
#[cfg(feature = "unstable-nu6")]
#[cfg(zcash_unstable = "nu6")]
Nu6,
/// The ZFUTURE network upgrade.
///
/// This upgrade is expected never to activate on mainnet;
/// it is intended for use in integration testing of functionality
/// that is a candidate for integration in a future network upgrade.
#[cfg(feature = "zfuture")]
#[cfg(zcash_unstable = "zfuture")]
ZFuture,
}

Expand All @@ -474,9 +474,9 @@ impl fmt::Display for NetworkUpgrade {
NetworkUpgrade::Heartwood => write!(f, "Heartwood"),
NetworkUpgrade::Canopy => write!(f, "Canopy"),
NetworkUpgrade::Nu5 => write!(f, "Nu5"),
#[cfg(feature = "unstable-nu6")]
#[cfg(zcash_unstable = "nu6")]
NetworkUpgrade::Nu6 => write!(f, "Nu6"),
#[cfg(feature = "zfuture")]
#[cfg(zcash_unstable = "zfuture")]
NetworkUpgrade::ZFuture => write!(f, "ZFUTURE"),
}
}
Expand All @@ -491,9 +491,9 @@ impl NetworkUpgrade {
NetworkUpgrade::Heartwood => BranchId::Heartwood,
NetworkUpgrade::Canopy => BranchId::Canopy,
NetworkUpgrade::Nu5 => BranchId::Nu5,
#[cfg(feature = "unstable-nu6")]
#[cfg(zcash_unstable = "nu6")]
NetworkUpgrade::Nu6 => BranchId::Nu6,
#[cfg(feature = "zfuture")]
#[cfg(zcash_unstable = "zfuture")]
NetworkUpgrade::ZFuture => BranchId::ZFuture,
}
}
Expand All @@ -510,7 +510,7 @@ const UPGRADES_IN_ORDER: &[NetworkUpgrade] = &[
NetworkUpgrade::Heartwood,
NetworkUpgrade::Canopy,
NetworkUpgrade::Nu5,
#[cfg(feature = "unstable-nu6")]
#[cfg(zcash_unstable = "nu6")]
NetworkUpgrade::Nu6,
];

Expand Down Expand Up @@ -549,11 +549,11 @@ pub enum BranchId {
/// The consensus rules deployed by [`NetworkUpgrade::Nu5`].
Nu5,
/// The consensus rules deployed by [`NetworkUpgrade::Nu6`].
#[cfg(feature = "unstable-nu6")]
#[cfg(zcash_unstable = "nu6")]
Nu6,
/// Candidates for future consensus rules; this branch will never
/// activate on mainnet.
#[cfg(feature = "zfuture")]
#[cfg(zcash_unstable = "zfuture")]
ZFuture,
}

Expand All @@ -571,9 +571,9 @@ impl TryFrom<u32> for BranchId {
0xf5b9_230b => Ok(BranchId::Heartwood),
0xe9ff_75a6 => Ok(BranchId::Canopy),
0xc2d6_d0b4 => Ok(BranchId::Nu5),
#[cfg(feature = "unstable-nu6")]
#[cfg(zcash_unstable = "nu6")]
0xc8e7_1055 => Ok(BranchId::Nu6),
#[cfg(feature = "zfuture")]
#[cfg(zcash_unstable = "zfuture")]
0xffff_ffff => Ok(BranchId::ZFuture),
_ => Err("Unknown consensus branch ID"),
}
Expand All @@ -590,9 +590,9 @@ impl From<BranchId> for u32 {
BranchId::Heartwood => 0xf5b9_230b,
BranchId::Canopy => 0xe9ff_75a6,
BranchId::Nu5 => 0xc2d6_d0b4,
#[cfg(feature = "unstable-nu6")]
#[cfg(zcash_unstable = "nu6")]
BranchId::Nu6 => 0xc8e7_1055,
#[cfg(feature = "zfuture")]
#[cfg(zcash_unstable = "zfuture")]
BranchId::ZFuture => 0xffff_ffff,
}
}
Expand Down Expand Up @@ -658,15 +658,15 @@ impl BranchId {
.activation_height(NetworkUpgrade::Canopy)
.map(|lower| (lower, params.activation_height(NetworkUpgrade::Nu5))),
BranchId::Nu5 => params.activation_height(NetworkUpgrade::Nu5).map(|lower| {
#[cfg(feature = "zfuture")]
#[cfg(zcash_unstable = "zfuture")]
let upper = params.activation_height(NetworkUpgrade::ZFuture);
#[cfg(not(feature = "zfuture"))]
#[cfg(not(zcash_unstable = "zfuture"))]
let upper = None;
(lower, upper)
}),
#[cfg(feature = "unstable-nu6")]
#[cfg(zcash_unstable = "nu6")]
BranchId::Nu6 => None,
#[cfg(feature = "zfuture")]
#[cfg(zcash_unstable = "zfuture")]
BranchId::ZFuture => params
.activation_height(NetworkUpgrade::ZFuture)
.map(|lower| (lower, None)),
Expand Down Expand Up @@ -694,9 +694,9 @@ pub mod testing {
BranchId::Heartwood,
BranchId::Canopy,
BranchId::Nu5,
#[cfg(feature = "unstable-nu6")]
#[cfg(zcash_unstable = "nu6")]
BranchId::Nu6,
#[cfg(feature = "zfuture")]
#[cfg(zcash_unstable = "zfuture")]
BranchId::ZFuture,
])
}
Expand Down
Loading

0 comments on commit 654f116

Please sign in to comment.