Skip to content

Commit

Permalink
Merge pull request #890 from input-output-hk/djo/fix_doc_warnings_not…
Browse files Browse the repository at this point in the history
…_in_ci

Make doc ci reports & fails if there's an error
  • Loading branch information
Alenar authored May 2, 2023
2 parents 9e5ab51 + 6cee784 commit 0173a98
Show file tree
Hide file tree
Showing 12 changed files with 48 additions and 18 deletions.
25 changes: 24 additions & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,32 @@ jobs:
uses: ./.github/workflows/actions/toolchain-and-cache
with:
cache-version: ${{ secrets.CACHE_VERSION }}
cargo-tools: clippy-sarif sarif-fmt

- name: Generate cargo doc
run: cargo doc --no-deps -p mithril-stm -p mithril-common -p mithril-aggregator -p mithril-signer -p mithril-client
run: |
cargo doc --no-deps -p mithril-stm -p mithril-common -p mithril-aggregator \
-p mithril-signer -p mithril-client --message-format=json \
| clippy-sarif | tee rust-cargo-doc-results.sarif | sarif-fmt
# Update tool sarif metadata from "clippy" to "cargo-doc" (since it's set this way by clippy-sarif)
contents=$(cat rust-cargo-doc-results.sarif \
| jq '.runs[].tool.driver.name = "cargo-doc"' \
| jq '.runs[].tool.driver.informationUri = "https://doc.rust-lang.org/cargo/commands/cargo-doc.html"' \
)
echo -E "${contents}" > rust-cargo-doc-results.sarif
# Make this step fail if any warning has been found
if [[ $(cat rust-cargo-doc-results.sarif | jq '.runs[0].results') != "[]" ]]; then
false
fi
- name: Upload cargo-doc results to GitHub
if: success() || failure()
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: rust-cargo-doc-results.sarif
wait-for-processing: true

- name: Publish Mithril-rust-doc
uses: actions/upload-artifact@v3
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion mithril-aggregator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mithril-aggregator"
version = "0.3.8"
version = "0.3.9"
description = "A Mithril Aggregator server"
authors = { workspace = true }
edition = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion mithril-aggregator/src/certifier_service.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! ## Certifier Service
//!
//! This service is responsible of [OpenMessage] cycle of life. It creates open
//! messages and turn them into [CertificateRecord]. To do so, it registers
//! messages and turn them into [Certificate]. To do so, it registers
//! single signatures and deal with the multi_signer for aggregate signature
//! creation.
use std::sync::Arc;
Expand Down
8 changes: 4 additions & 4 deletions mithril-aggregator/src/database/provider/open_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ impl OpenMessageRepository {
Self { connection }
}

/// Return the latest [OpenMessage] for the given Epoch and [SignedEntityType].
/// Return the latest [OpenMessageRecord] for the given Epoch and [SignedEntityType].
pub async fn get_open_message(
&self,
signed_entity_type: &SignedEntityType,
Expand All @@ -486,7 +486,7 @@ impl OpenMessageRepository {
Ok(messages.next())
}

/// Create a new [OpenMessage] in the database.
/// Create a new [OpenMessageRecord] in the database.
pub async fn create_open_message(
&self,
epoch: Epoch,
Expand All @@ -503,7 +503,7 @@ impl OpenMessageRepository {
.ok_or_else(|| panic!("Inserting an open_message should not return nothing."))
}

/// Updates an [OpenMessage] in the database.
/// Updates an [OpenMessageRecord] in the database.
pub async fn update_open_message(
&self,
open_message: &OpenMessageRecord,
Expand All @@ -518,7 +518,7 @@ impl OpenMessageRepository {
.ok_or_else(|| panic!("Updating an open_message should not return nothing."))
}

/// Remove all the [OpenMessage] for the given Epoch in the database.
/// Remove all the [OpenMessageRecord] for the given Epoch in the database.
/// It returns the number of messages removed.
pub async fn clean_epoch(&self, epoch: Epoch) -> StdResult<usize> {
let lock = self.connection.lock().await;
Expand Down
2 changes: 1 addition & 1 deletion mithril-aggregator/src/dependency_injection/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -864,7 +864,7 @@ impl DependenciesBuilder {
Ok(signer_recorder)
}

/// [SignerRecorder]
/// [SignerRecorder] service
pub async fn get_signer_recorder(&mut self) -> Result<Arc<dyn SignerRecorder>> {
if self.signer_recorder.is_none() {
self.signer_recorder = Some(self.build_signer_recorder().await?);
Expand Down
8 changes: 6 additions & 2 deletions mithril-aggregator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,14 @@ mod store;
pub mod ticker_service;
mod tools;

pub use crate::artifact_builder::{ArtifactBuilder, ArtifactBuilderService};
pub use crate::configuration::{
Configuration, DefaultConfiguration, ExecutionEnvironment, SnapshotUploaderType,
};
pub use crate::multi_signer::{MultiSigner, MultiSignerImpl, ProtocolError};
pub use crate::signable_builder::{
ImmutableSignableBuilder, MithrilStakeDistributionSignableBuilder, SignableBuilderService,
};
pub use crate::snapshot_stores::{LocalSnapshotStore, SnapshotStore};
pub use command_args::MainOpts;
pub use dependency::DependencyManager;
Expand All @@ -48,8 +52,8 @@ pub use runtime::{
AggregatorConfig, AggregatorRunner, AggregatorRunnerTrait, AggregatorRuntime, RuntimeError,
};
pub use signer_registerer::{
MithrilSignerRegisterer, SignerRegisterer, SignerRegistrationError, SignerRegistrationRound,
SignerRegistrationRoundOpener,
MithrilSignerRegisterer, SignerRecorder, SignerRegisterer, SignerRegistrationError,
SignerRegistrationRound, SignerRegistrationRoundOpener,
};
pub use snapshot_uploaders::{
DumbSnapshotUploader, LocalSnapshotUploader, RemoteSnapshotUploader, SnapshotUploader,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use mithril_common::{
StdResult,
};

/// A [SignableBuilder] for cardano immutable files.
pub struct ImmutableSignableBuilder {
immutable_digester: Arc<dyn ImmutableDigester>,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use mithril_common::{

use crate::MultiSigner;

/// A [MithrilStakeDistributionSignable] builder
/// A [SignableBuilder] for mithril stake distribution.
pub struct MithrilStakeDistributionSignableBuilder {
multi_signer: Arc<RwLock<dyn MultiSigner>>,
}
Expand Down
2 changes: 1 addition & 1 deletion mithril-common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mithril-common"
version = "0.2.44"
version = "0.2.45"
authors = { workspace = true }
edition = { workspace = true }
documentation = { workspace = true }
Expand Down
6 changes: 4 additions & 2 deletions mithril-common/src/crypto_helper/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ mod genesis;
pub mod tests_setup;
mod types;

pub use cardano::ColdKeyGenerator;
pub use cardano::{KESPeriod, OpCert, SerDeShelleyFileFormat, Sum6KesBytes};
pub use cardano::{
ColdKeyGenerator, KESPeriod, OpCert, ProtocolInitializerErrorWrapper,
ProtocolRegistrationErrorWrapper, SerDeShelleyFileFormat, Sum6KesBytes,
};
pub use codec::*;
pub use era::{
EraMarkersSigner, EraMarkersVerifier, EraMarkersVerifierError, EraMarkersVerifierSecretKey,
Expand Down
4 changes: 2 additions & 2 deletions mithril-common/src/crypto_helper/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ pub type ProtocolGenesisSecretKey = ed25519_dalek::SecretKey;
pub type ProtocolGenesisSignature = ed25519_dalek::Signature;

// Error alias
/// Alias of a wrapper of [MithrilCommon:ProtocolRegistrationErrorWrapper](enum@mithril_common::ProtocolRegistrationErrorWrapper).
/// Alias of a wrapper of [MithrilCommon:ProtocolRegistrationErrorWrapper](enum@ProtocolRegistrationErrorWrapper).
pub type ProtocolRegistrationError = ProtocolRegistrationErrorWrapper;

/// Alias of a wrapper of [MithrilCommon:ProtocolInitializerErrorWrapper](enum@mithril_common::ProtocolInitializerErrorWrapper).
/// Alias of a wrapper of [MithrilCommon:ProtocolInitializerErrorWrapper](enum@ProtocolInitializerErrorWrapper).
pub type ProtocolInitializerError = ProtocolInitializerErrorWrapper;

/// Alias of [MithrilStm:AggregationError](enum@mithril_stm::AggregationError).
Expand Down

0 comments on commit 0173a98

Please sign in to comment.