Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/github_actions/crs-k/stale-branch…
Browse files Browse the repository at this point in the history
…es-3.1.3
  • Loading branch information
minikin authored Dec 18, 2023
2 parents 8567c3e + fac79e7 commit fb546bb
Show file tree
Hide file tree
Showing 27 changed files with 15 additions and 3,425 deletions.
11 changes: 6 additions & 5 deletions catalyst-gateway/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Use MOLD linker where possible, but ONLY in CI applicable targets.
# cspell: words rustflags armv gnueabihf msvc nextest idents rustdocflags
# cspell: words rustdoc lintfix lintrestrict testfast testdocs codegen testci
# cspell: words rustflags armv gnueabihf msvc nextest idents rustdocflags
# cspell: words rustdoc lintfix lintrestrict testfast testdocs codegen testci testunit
# cspell: words fmtchk fmtfix

# Configure how Docker container targets build.

# If you want to customize these targets for a local build, then customize them in you:
# $CARGO_HOME/config.toml
# $CARGO_HOME/config.toml
# NOT in the project itself.
# These targets are ONLY the targets used by CI and inside docker builds.

Expand Down Expand Up @@ -108,14 +108,15 @@ incremental = false
codegen-units = 16

[alias]
lint = "clippy -- -D warnings -D clippy::pedantic -D clippy::unwrap_used -D clippy::expect_used -D clippy::exit -D clippy::get_unwrap -D clippy::index_refutable_slice -D clippy::indexing_slicing -D clippy::match_on_vec_items -D clippy::match_wild_err_arm -D clippy::missing_panics_doc -D clippy::panic -D clippy::string_slice -D clippy::unchecked_duration_subtraction -D clippy::unreachable -D clippy::missing_docs_in_private_items"
lintfix = "clippy -- -D warnings -D clippy::pedantic -D clippy::unwrap_used -D clippy::expect_used -D clippy::exit -D clippy::get_unwrap -D clippy::index_refutable_slice -D clippy::indexing_slicing -D clippy::match_on_vec_items -D clippy::match_wild_err_arm -D clippy::missing_panics_doc -D clippy::panic -D clippy::string_slice -D clippy::unchecked_duration_subtraction -D clippy::unreachable"
lint = "clippy --all-targets -- -D warnings -D clippy::pedantic -D clippy::unwrap_used -D clippy::expect_used -D clippy::exit -D clippy::get_unwrap -D clippy::index_refutable_slice -D clippy::indexing_slicing -D clippy::match_on_vec_items -D clippy::match_wild_err_arm -D clippy::missing_panics_doc -D clippy::panic -D clippy::string_slice -D clippy::unchecked_duration_subtraction -D clippy::unreachable -D clippy::missing_docs_in_private_items"
lintfix = "clippy --all-targets --fix --allow-dirty -- -D warnings -D clippy::pedantic -D clippy::unwrap_used -D clippy::expect_used -D clippy::exit -D clippy::get_unwrap -D clippy::index_refutable_slice -D clippy::indexing_slicing -D clippy::match_on_vec_items -D clippy::match_wild_err_arm -D clippy::missing_panics_doc -D clippy::panic -D clippy::string_slice -D clippy::unchecked_duration_subtraction -D clippy::unreachable -D clippy::missing_docs_in_private_items"
lintrestrict = "clippy -- -D warnings -D clippy::pedantic -D clippy::restriction -D clippy::missing_docs_in_private_items"
lint-vscode = "clippy --workspace --message-format=json-diagnostic-rendered-ansi --all-targets -- -D warnings -D clippy::pedantic -D clippy::unwrap_used -D clippy::expect_used -D clippy::exit -D clippy::get_unwrap -D clippy::index_refutable_slice -D clippy::indexing_slicing -D clippy::match_on_vec_items -D clippy::match_wild_err_arm -D clippy::missing_panics_doc -D clippy::panic -D clippy::string_slice -D clippy::unchecked_duration_subtraction -D clippy::unreachable -D clippy::missing_docs_in_private_items"

docs = "doc --workspace -r --all-features --no-deps --bins --document-private-items --examples --locked"
# nightly docs build broken... when they are'nt we can enable these docs... --unit-graph --timings=html,json -Z unstable-options"
testfast = "nextest run --release --workspace --locked"
testunit = "nextest run --release --bins --lib --workspace --locked -P ci"
testci = "nextest run --release --workspace --locked -P ci"
testdocs = "test --doc --release --workspace --locked"

Expand Down
12 changes: 6 additions & 6 deletions catalyst-gateway/Earthfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
VERSION 0.7

#cspell: words rustup readelf nextest testci testdocs rustfmt toolsets USERARCH
#cspell: words rustfmt toolsets USERARCH

# Set up our target toolchains, and copy our files.
builder:
FROM github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.11+rust-base
FROM github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.12+rust-base

DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.11+SETUP --toolchain=rust-toolchain.toml
DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.12+SETUP --toolchain=rust-toolchain.toml

COPY --dir .cargo .config Cargo.* clippy.toml deny.toml rustfmt.toml bin crates .

# Test rust build container - Use best architecture host tools.
check-hosted:
FROM +builder

DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.11+CHECK
DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.12+CHECK

# Test which runs check with all supported host tooling. Needs qemu or rosetta to run.
# Only used to validate tooling is working across host toolsets.
Expand All @@ -27,9 +27,9 @@ build-hosted:
# Build the service
FROM +builder

DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.11+BUILD --bins="cat-gateway/cat-gateway"
DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.12+BUILD --bins="cat-gateway/cat-gateway"

DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.11+SMOKE_TEST --bin="cat-gateway"
DO github.com/input-output-hk/catalyst-ci/earthly/rust:v2.0.12+SMOKE_TEST --bin="cat-gateway"

SAVE ARTIFACT target/$TARGETARCH/doc doc
SAVE ARTIFACT target/$TARGETARCH/release/cat-gateway cat-gateway
Expand Down
26 changes: 0 additions & 26 deletions catalyst-gateway/bin/src/event_db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,29 +79,3 @@ pub(crate) async fn establish_connection(

Ok(db)
}

// Need to setup and run a test event db instance
// To do it you can use the following commands:
// Prepare docker images
// ```
// earthly ./containers/event-db-migrations+docker --data=test
// ```
// Run event-db container
// ```
// docker-compose -f src/event-db/docker-compose.yml up migrations
// ```
// Also need establish `EVENT_DB_URL` env variable with the following value
// ```
// EVENT_DB_URL = "postgres://catalyst-event-dev:CHANGE_ME@localhost/CatalystEventDev"
// ```
// [readme](https://github.com/input-output-hk/catalyst-core/tree/main/src/event-db/Readme.md)
// #[cfg(test)]
// mod test {
// use super::*;
//
// Check if the schema version in the DB is up to date.
// #[tokio::test]
// async fn check_schema_version() {
// establish_connection(None).await.unwrap();
// }
// }
188 changes: 0 additions & 188 deletions catalyst-gateway/bin/src/event_db/queries/event/ballot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,191 +210,3 @@ impl BallotQueries for EventDB {
.collect())
}
}

/// Need to setup and run a test event db instance
/// To do it you can use the following commands:
/// Prepare docker images
/// ```
/// earthly ./containers/event-db-migrations+docker --data=test
/// ```
/// Run event-db container
/// ```
/// docker-compose -f src/event-db/docker-compose.yml up migrations
/// ```
/// Also need establish `EVENT_DB_URL` env variable with the following value
/// ```
/// EVENT_DB_URL = "postgres://catalyst-event-dev:CHANGE_ME@localhost/CatalystEventDev"
/// ```
/// [readme](https://github.com/input-output-hk/catalyst-core/tree/main/src/event-db/Readme.md)
#[cfg(test)]
mod tests {
// use super::*;
// use crate::event_db::establish_connection;
//
// #[tokio::test]
// async fn get_ballot_test() {
// let event_db = establish_connection(None).await.unwrap();
//
// let ballot = event_db
// .get_ballot(EventId(1), ObjectiveId(1), ProposalId(10))
// .await
// .unwrap();
//
// assert_eq!(
// Ballot {
// choices: ObjectiveChoices(vec!["yes".to_string(), "no".to_string()]),
// voteplans: GroupVotePlans(vec![
// VotePlan {
// chain_proposal_index: 10,
// group: Some(VoterGroupId("direct".to_string())),
// ballot_type: BallotType("public".to_string()),
// chain_voteplan_id: "1".to_string(),
// encryption_key: None,
// },
// VotePlan {
// chain_proposal_index: 12,
// group: Some(VoterGroupId("rep".to_string())),
// ballot_type: BallotType("public".to_string()),
// chain_voteplan_id: "2".to_string(),
// encryption_key: None,
// }
// ]),
// },
// ballot,
// );
// }
//
// #[tokio::test]
// async fn get_objective_ballots_test() {
// let event_db = establish_connection(None).await.unwrap();
//
// let ballots = event_db
// .get_objective_ballots(EventId(1), ObjectiveId(1))
// .await
// .unwrap();
//
// assert_eq!(
// vec![
// ProposalBallot {
// proposal_id: ProposalId(10),
// ballot: Ballot {
// choices: ObjectiveChoices(vec!["yes".to_string(), "no".to_string()]),
// voteplans: GroupVotePlans(vec![
// VotePlan {
// chain_proposal_index: 10,
// group: Some(VoterGroupId("direct".to_string())),
// ballot_type: BallotType("public".to_string()),
// chain_voteplan_id: "1".to_string(),
// encryption_key: None,
// },
// VotePlan {
// chain_proposal_index: 12,
// group: Some(VoterGroupId("rep".to_string())),
// ballot_type: BallotType("public".to_string()),
// chain_voteplan_id: "2".to_string(),
// encryption_key: None,
// }
// ]),
// },
// },
// ProposalBallot {
// proposal_id: ProposalId(20),
// ballot: Ballot {
// choices: ObjectiveChoices(vec!["yes".to_string(), "no".to_string()]),
// voteplans: GroupVotePlans(vec![
// VotePlan {
// chain_proposal_index: 11,
// group: Some(VoterGroupId("direct".to_string())),
// ballot_type: BallotType("public".to_string()),
// chain_voteplan_id: "1".to_string(),
// encryption_key: None,
// },
// VotePlan {
// chain_proposal_index: 13,
// group: Some(VoterGroupId("rep".to_string())),
// ballot_type: BallotType("public".to_string()),
// chain_voteplan_id: "2".to_string(),
// encryption_key: None,
// }
// ]),
// },
// },
// ProposalBallot {
// proposal_id: ProposalId(30),
// ballot: Ballot {
// choices: ObjectiveChoices(vec!["yes".to_string(), "no".to_string()]),
// voteplans: GroupVotePlans(vec![]),
// },
// }
// ],
// ballots,
// );
// }
//
// #[tokio::test]
// async fn get_event_ballots_test() {
// let event_db = establish_connection(None).await.unwrap();
//
// let ballots = event_db.get_event_ballots(EventId(1)).await.unwrap();
//
// assert_eq!(
// vec![ObjectiveBallots {
// objective_id: ObjectiveId(1),
// ballots: vec![
// ProposalBallot {
// proposal_id: ProposalId(10),
// ballot: Ballot {
// choices: ObjectiveChoices(vec!["yes".to_string(), "no".to_string()]),
// voteplans: GroupVotePlans(vec![
// VotePlan {
// chain_proposal_index: 10,
// group: Some(VoterGroupId("direct".to_string())),
// ballot_type: BallotType("public".to_string()),
// chain_voteplan_id: "1".to_string(),
// encryption_key: None,
// },
// VotePlan {
// chain_proposal_index: 12,
// group: Some(VoterGroupId("rep".to_string())),
// ballot_type: BallotType("public".to_string()),
// chain_voteplan_id: "2".to_string(),
// encryption_key: None,
// }
// ]),
// },
// },
// ProposalBallot {
// proposal_id: ProposalId(20),
// ballot: Ballot {
// choices: ObjectiveChoices(vec!["yes".to_string(), "no".to_string()]),
// voteplans: GroupVotePlans(vec![
// VotePlan {
// chain_proposal_index: 11,
// group: Some(VoterGroupId("direct".to_string())),
// ballot_type: BallotType("public".to_string()),
// chain_voteplan_id: "1".to_string(),
// encryption_key: None,
// },
// VotePlan {
// chain_proposal_index: 13,
// group: Some(VoterGroupId("rep".to_string())),
// ballot_type: BallotType("public".to_string()),
// chain_voteplan_id: "2".to_string(),
// encryption_key: None,
// }
// ]),
// },
// },
// ProposalBallot {
// proposal_id: ProposalId(30),
// ballot: Ballot {
// choices: ObjectiveChoices(vec!["yes".to_string(), "no".to_string()]),
// voteplans: GroupVotePlans(vec![]),
// },
// }
// ]
// }],
// ballots
// );
// }
}
Loading

0 comments on commit fb546bb

Please sign in to comment.