change(ci): When building crates individually, build all targets, and run clippy (#8024)
* Run clippy and build all targets on all crates individually * Fix prod and test features for scanner deps * Standardise dependency order * Remove unnecessary async in tests * Fix an unused import in a test * Work around a no space left on device error * Actually just use a larger runner
This commit is contained in:
parent
d28386ca12
commit
cb9452c5e3
|
|
@ -33,11 +33,11 @@ jobs:
|
||||||
# This step is meant to dynamically create a JSON containing the values of each crate
|
# This step is meant to dynamically create a JSON containing the values of each crate
|
||||||
# available in this repo in the root directory. We use `cargo tree` to accomplish this task.
|
# available in this repo in the root directory. We use `cargo tree` to accomplish this task.
|
||||||
#
|
#
|
||||||
# The result from `cargo tree` is then transform to JSON values between double quotes,
|
# The result from `cargo tree` is then transform to JSON values between double quotes,
|
||||||
# and separated by commas, then added to a `crates.txt` and assigned to a $JSON_CRATES variable.
|
# and separated by commas, then added to a `crates.txt` and assigned to a $JSON_CRATES variable.
|
||||||
#
|
#
|
||||||
# A JSON object is created and assigned to a $MATRIX variable, which is use to create an output
|
# A JSON object is created and assigned to a $MATRIX variable, which is use to create an output
|
||||||
# named `matrix`, which is then used as the input in following steps,
|
# named `matrix`, which is then used as the input in following steps,
|
||||||
# using ` ${{ fromJson(needs.matrix.outputs.matrix) }}`
|
# using ` ${{ fromJson(needs.matrix.outputs.matrix) }}`
|
||||||
- id: set-matrix
|
- id: set-matrix
|
||||||
name: Dynamically build crates JSON
|
name: Dynamically build crates JSON
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,8 @@ jobs:
|
||||||
name: Build ${{ matrix.crate }} crate
|
name: Build ${{ matrix.crate }} crate
|
||||||
timeout-minutes: 90
|
timeout-minutes: 90
|
||||||
needs: [ matrix, check-matrix ]
|
needs: [ matrix, check-matrix ]
|
||||||
runs-on: ubuntu-latest
|
# Some of these builds take more than 14GB disk space
|
||||||
|
runs-on: ubuntu-latest-m
|
||||||
strategy:
|
strategy:
|
||||||
# avoid rate-limit errors by only launching a few of these jobs at a time
|
# avoid rate-limit errors by only launching a few of these jobs at a time
|
||||||
max-parallel: 2
|
max-parallel: 2
|
||||||
|
|
@ -132,15 +133,18 @@ jobs:
|
||||||
# Some Zebra crates do not have any features, and most don't have any default features.
|
# Some Zebra crates do not have any features, and most don't have any default features.
|
||||||
- name: Build ${{ matrix.crate }} crate with no default features
|
- name: Build ${{ matrix.crate }} crate with no default features
|
||||||
run: |
|
run: |
|
||||||
cargo build --package ${{ matrix.crate }} --no-default-features
|
cargo clippy --package ${{ matrix.crate }} --no-default-features --all-targets -- -D warnings
|
||||||
|
cargo build --package ${{ matrix.crate }} --no-default-features --all-targets
|
||||||
|
|
||||||
- name: Build ${{ matrix.crate }} crate normally
|
- name: Build ${{ matrix.crate }} crate with default features
|
||||||
run: |
|
run: |
|
||||||
cargo build --package ${{ matrix.crate }}
|
cargo clippy --package ${{ matrix.crate }} --all-targets -- -D warnings
|
||||||
|
cargo build --package ${{ matrix.crate }} --all-targets
|
||||||
|
|
||||||
- name: Build ${{ matrix.crate }} crate with all features
|
- name: Build ${{ matrix.crate }} crate with all features
|
||||||
run: |
|
run: |
|
||||||
cargo build --package ${{ matrix.crate }} --all-features
|
cargo clippy --package ${{ matrix.crate }} --all-features --all-targets -- -D warnings
|
||||||
|
cargo build --package ${{ matrix.crate }} --all-features --all-targets
|
||||||
|
|
||||||
failure-issue:
|
failure-issue:
|
||||||
name: Open or update issues for building crates individually failures
|
name: Open or update issues for building crates individually failures
|
||||||
|
|
|
||||||
|
|
@ -98,11 +98,11 @@ jobs:
|
||||||
# GitHub displays the clippy job and its results as separate entries
|
# GitHub displays the clippy job and its results as separate entries
|
||||||
name: Clippy (stable) Results
|
name: Clippy (stable) Results
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
args: --all-features --all-targets -- -D warnings
|
args: --workspace --all-features --all-targets -- -D warnings
|
||||||
|
|
||||||
- name: Run clippy manually without annotations
|
- name: Run clippy manually without annotations
|
||||||
if: ${{ !steps.check_permissions.outputs.has-permission }}
|
if: ${{ !steps.check_permissions.outputs.has-permission }}
|
||||||
run: cargo clippy --all-features --all-targets -- -D warnings
|
run: cargo clippy --workspace --all-features --all-targets -- -D warnings
|
||||||
|
|
||||||
fmt:
|
fmt:
|
||||||
name: Rustfmt
|
name: Rustfmt
|
||||||
|
|
|
||||||
|
|
@ -19,26 +19,30 @@ categories = ["cryptography::cryptocurrencies"]
|
||||||
# Production features that activate extra dependencies, or extra features in dependencies
|
# Production features that activate extra dependencies, or extra features in dependencies
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
zebra-chain = { path = "../zebra-chain", version = "1.0.0-beta.31" }
|
|
||||||
zebra-state = { path = "../zebra-state", version = "1.0.0-beta.31" }
|
|
||||||
|
|
||||||
zcash_primitives = "0.13.0-rc.1"
|
|
||||||
zcash_client_backend = "0.10.0-rc.1"
|
|
||||||
|
|
||||||
color-eyre = "0.6.2"
|
color-eyre = "0.6.2"
|
||||||
indexmap = { version = "2.0.1", features = ["serde"] }
|
indexmap = { version = "2.0.1", features = ["serde"] }
|
||||||
serde = { version = "1.0.193", features = ["serde_derive"] }
|
serde = { version = "1.0.193", features = ["serde_derive"] }
|
||||||
tokio = { version = "1.34.0", features = ["test-util"] }
|
tokio = "1.34.0"
|
||||||
tower = "0.4.13"
|
tower = "0.4.13"
|
||||||
tracing = "0.1.39"
|
tracing = "0.1.39"
|
||||||
|
|
||||||
[dev-dependencies]
|
zcash_client_backend = "0.10.0-rc.1"
|
||||||
zcash_note_encryption = "0.4.0"
|
zcash_primitives = "0.13.0-rc.1"
|
||||||
|
|
||||||
|
zebra-chain = { path = "../zebra-chain", version = "1.0.0-beta.31" }
|
||||||
|
zebra-state = { path = "../zebra-state", version = "1.0.0-beta.31" }
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
|
||||||
rand = "0.8.5"
|
|
||||||
bls12_381 = "0.8.0"
|
bls12_381 = "0.8.0"
|
||||||
jubjub = "0.10.0"
|
|
||||||
ff = "0.13.0"
|
ff = "0.13.0"
|
||||||
group = "0.13.0"
|
group = "0.13.0"
|
||||||
|
jubjub = "0.10.0"
|
||||||
|
rand = "0.8.5"
|
||||||
|
tokio = { version = "1.34.0", features = ["test-util"] }
|
||||||
|
|
||||||
|
zcash_note_encryption = "0.4.0"
|
||||||
|
|
||||||
|
zebra-state = { path = "../zebra-state", version = "1.0.0-beta.31", features = ["proptest-impl"] }
|
||||||
zebra-test = { path = "../zebra-test" }
|
zebra-test = { path = "../zebra-test" }
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
//! The scan task.
|
//! The scanner task and scanning APIs.
|
||||||
|
|
||||||
use std::{sync::Arc, time::Duration};
|
use std::{sync::Arc, time::Duration};
|
||||||
|
|
||||||
use color_eyre::{eyre::eyre, Report};
|
use color_eyre::{eyre::eyre, Report};
|
||||||
use tower::{buffer::Buffer, util::BoxService, Service, ServiceExt};
|
use tower::{buffer::Buffer, util::BoxService, Service, ServiceExt};
|
||||||
use tracing::info;
|
use tracing::info;
|
||||||
|
|
||||||
use zcash_client_backend::{
|
use zcash_client_backend::{
|
||||||
data_api::ScannedBlock,
|
data_api::ScannedBlock,
|
||||||
proto::compact_formats::{
|
proto::compact_formats::{
|
||||||
|
|
@ -13,6 +14,7 @@ use zcash_client_backend::{
|
||||||
scanning::{ScanError, ScanningKey},
|
scanning::{ScanError, ScanningKey},
|
||||||
};
|
};
|
||||||
use zcash_primitives::zip32::AccountId;
|
use zcash_primitives::zip32::AccountId;
|
||||||
|
|
||||||
use zebra_chain::{
|
use zebra_chain::{
|
||||||
block::Block, parameters::Network, serialization::ZcashSerialize, transaction::Transaction,
|
block::Block, parameters::Network, serialization::ZcashSerialize, transaction::Transaction,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,11 @@
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
|
use color_eyre::Result;
|
||||||
|
use ff::{Field, PrimeField};
|
||||||
|
use group::GroupEncoding;
|
||||||
|
use rand::{rngs::OsRng, RngCore};
|
||||||
|
|
||||||
use zcash_client_backend::{
|
use zcash_client_backend::{
|
||||||
encoding::decode_extended_full_viewing_key,
|
encoding::decode_extended_full_viewing_key,
|
||||||
proto::compact_formats::{
|
proto::compact_formats::{
|
||||||
|
|
@ -26,13 +31,6 @@ use zcash_primitives::{
|
||||||
zip32::{AccountId, DiversifiableFullViewingKey, ExtendedSpendingKey},
|
zip32::{AccountId, DiversifiableFullViewingKey, ExtendedSpendingKey},
|
||||||
};
|
};
|
||||||
|
|
||||||
use color_eyre::Result;
|
|
||||||
|
|
||||||
use rand::{rngs::OsRng, RngCore};
|
|
||||||
|
|
||||||
use ff::{Field, PrimeField};
|
|
||||||
use group::GroupEncoding;
|
|
||||||
|
|
||||||
use zebra_chain::{
|
use zebra_chain::{
|
||||||
block::Block, chain_tip::ChainTip, parameters::Network, serialization::ZcashDeserializeInto,
|
block::Block, chain_tip::ChainTip, parameters::Network, serialization::ZcashDeserializeInto,
|
||||||
transaction::Hash,
|
transaction::Hash,
|
||||||
|
|
@ -114,8 +112,8 @@ async fn scanning_from_populated_zebra_state() -> Result<()> {
|
||||||
/// the transaction and one additional random transaction without it.
|
/// the transaction and one additional random transaction without it.
|
||||||
/// - Verify one relevant transaction is found in the chain when scanning for the pre created fake
|
/// - Verify one relevant transaction is found in the chain when scanning for the pre created fake
|
||||||
/// account's nullifier.
|
/// account's nullifier.
|
||||||
#[tokio::test]
|
#[test]
|
||||||
async fn scanning_from_fake_generated_blocks() -> Result<()> {
|
fn scanning_from_fake_generated_blocks() -> Result<()> {
|
||||||
let account = AccountId::from(12);
|
let account = AccountId::from(12);
|
||||||
let extsk = ExtendedSpendingKey::master(&[]);
|
let extsk = ExtendedSpendingKey::master(&[]);
|
||||||
let dfvk: DiversifiableFullViewingKey = extsk.to_diversifiable_full_viewing_key();
|
let dfvk: DiversifiableFullViewingKey = extsk.to_diversifiable_full_viewing_key();
|
||||||
|
|
@ -235,9 +233,9 @@ async fn scanning_zecpages_from_populated_zebra_state() -> Result<()> {
|
||||||
|
|
||||||
/// In this test we generate a viewing key and manually add it to the database. Also we send results to the Storage database.
|
/// In this test we generate a viewing key and manually add it to the database. Also we send results to the Storage database.
|
||||||
/// The purpose of this test is to check if our database and our scanning code are compatible.
|
/// The purpose of this test is to check if our database and our scanning code are compatible.
|
||||||
#[tokio::test]
|
#[test]
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
async fn scanning_fake_blocks_store_key_and_results() -> Result<()> {
|
fn scanning_fake_blocks_store_key_and_results() -> Result<()> {
|
||||||
// Generate a key
|
// Generate a key
|
||||||
let account = AccountId::from(12);
|
let account = AccountId::from(12);
|
||||||
let extsk = ExtendedSpendingKey::master(&[]);
|
let extsk = ExtendedSpendingKey::master(&[]);
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ use std::{
|
||||||
use color_eyre::eyre::Result;
|
use color_eyre::eyre::Result;
|
||||||
use tempfile::TempDir;
|
use tempfile::TempDir;
|
||||||
|
|
||||||
use zebra_chain::parameters::Network::{self, *};
|
use zebra_chain::parameters::Network;
|
||||||
use zebra_test::net::random_known_port;
|
use zebra_test::net::random_known_port;
|
||||||
use zebrad::{
|
use zebrad::{
|
||||||
components::{mempool, sync, tracing},
|
components::{mempool, sync, tracing},
|
||||||
|
|
@ -70,10 +70,11 @@ pub fn default_test_config(net: Network) -> Result<ZebradConfig> {
|
||||||
|
|
||||||
#[cfg(feature = "getblocktemplate-rpcs")]
|
#[cfg(feature = "getblocktemplate-rpcs")]
|
||||||
{
|
{
|
||||||
let miner_address = if network.network == Mainnet {
|
let miner_address = if network.network.is_a_test_network() {
|
||||||
"t3dvVE3SQEi7kqNzwrfNePxZ1d4hUyztBA1"
|
// Assume test networks all use the same address prefix and format
|
||||||
} else {
|
|
||||||
"t27eWDgjFYJGVXmzrXeVjnb5J3uXDM9xH9v"
|
"t27eWDgjFYJGVXmzrXeVjnb5J3uXDM9xH9v"
|
||||||
|
} else {
|
||||||
|
"t3dvVE3SQEi7kqNzwrfNePxZ1d4hUyztBA1"
|
||||||
};
|
};
|
||||||
|
|
||||||
mining.miner_address = Some(miner_address.parse().expect("hard-coded address is valid"));
|
mining.miner_address = Some(miner_address.parse().expect("hard-coded address is valid"));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue