-
Notifications
You must be signed in to change notification settings - Fork 181
fix(test): speed up test-release and codecov on CI #6372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hanabi1224
wants to merge
23
commits into
main
Choose a base branch
from
hm/speed-up-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 18 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
e496b3f
fix(ci): try codecov on hosted runner
hanabi1224 5a8675d
Merge branch 'main' into hm/try-codecov-on-hosted-runner
hanabi1224 afa58f3
fix tests
hanabi1224 45f74a8
sccache for test-release
hanabi1224 80b2f2e
fix AI comment
hanabi1224 6ad6456
fetch proof params with docker
hanabi1224 9425181
Merge remote-tracking branch 'origin/main' into hm/speed-up-tests
hanabi1224 4edf480
prove the fetch
hanabi1224 73b3d8f
Merge branch 'main' into hm/speed-up-tests
hanabi1224 0eb2812
set permission
hanabi1224 00f0d72
fetch proof params for test-release as well
hanabi1224 a74c99c
less log
hanabi1224 284ec79
nextest
hanabi1224 836b7a2
no nextest
hanabi1224 89ba6d9
fetch proof params only once
hanabi1224 f63bdc1
more retry in downloading rpc snapshots
hanabi1224 b5de8d1
FOREST_TEST_SKIP_PROOF_PARAM_CHECK
hanabi1224 7ea16b7
pre-fetch rpc test snapshots
hanabi1224 f136bdd
speedup nextest build
hanabi1224 f3dae30
fix
hanabi1224 d056b6a
Merge remote-tracking branch 'origin/main' into hm/speed-up-tests
hanabi1224 c0d2813
run codecov on hosted runner
hanabi1224 400b88e
Merge remote-tracking branch 'origin/main' into hm/speed-up-tests
hanabi1224 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -115,7 +115,7 @@ test-release-docs: | |
| cargo test --profile quick --doc --features doctest-private | ||
|
|
||
| codecov: | ||
| cargo llvm-cov --workspace --codecov --output-path lcov.info | ||
| cargo llvm-cov -p forest-filecoin --no-default-features --codecov --output-path lcov.info | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| # Checks if all headers are present and adds if not | ||
| license: | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| // Copyright 2019-2025 ChainSafe Systems | ||
| // SPDX-License-Identifier: Apache-2.0, MIT | ||
|
|
||
| #[tokio::main(flavor = "multi_thread")] | ||
| async fn main() -> anyhow::Result<()> { | ||
| forest::forest_dev_main(std::env::args_os()).await | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| // Copyright 2019-2025 ChainSafe Systems | ||
| // SPDX-License-Identifier: Apache-2.0, MIT | ||
|
|
||
| use super::subcommands::Cli; | ||
| use crate::cli_shared::logger::setup_minimal_logger; | ||
| use clap::Parser as _; | ||
| use std::ffi::OsString; | ||
|
|
||
| pub async fn main<ArgT>(args: impl IntoIterator<Item = ArgT>) -> anyhow::Result<()> | ||
| where | ||
| ArgT: Into<OsString> + Clone, | ||
| { | ||
| // Capture Cli inputs | ||
| let Cli { cmd } = Cli::parse_from(args); | ||
| setup_minimal_logger(); | ||
| let client = crate::rpc::Client::default_or_from_env(None)?; | ||
| cmd.run(client).await | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| // Copyright 2019-2025 ChainSafe Systems | ||
| // SPDX-License-Identifier: Apache-2.0, MIT | ||
|
|
||
| pub mod main; | ||
| pub mod subcommands; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| // Copyright 2019-2025 ChainSafe Systems | ||
| // SPDX-License-Identifier: Apache-2.0, MIT | ||
|
|
||
| use crate::cli_shared::cli::HELP_MESSAGE; | ||
| use crate::rpc::Client; | ||
| use crate::utils::net::{DownloadFileOption, download_file_with_cache}; | ||
| use crate::utils::proofs_api::ensure_proof_params_downloaded; | ||
| use crate::utils::version::FOREST_VERSION_STRING; | ||
| use anyhow::Context as _; | ||
| use clap::Parser; | ||
| use directories::ProjectDirs; | ||
| use std::borrow::Cow; | ||
| use std::path::PathBuf; | ||
| use std::time::Duration; | ||
| use tokio::task::JoinSet; | ||
| use url::Url; | ||
|
|
||
| /// Command-line options for the `forest-dev` binary | ||
| #[derive(Parser)] | ||
| #[command(name = env!("CARGO_PKG_NAME"), bin_name = "forest-dev", author = env!("CARGO_PKG_AUTHORS"), version = FOREST_VERSION_STRING.as_str(), about = env!("CARGO_PKG_DESCRIPTION") | ||
| )] | ||
| #[command(help_template(HELP_MESSAGE))] | ||
| pub struct Cli { | ||
| #[command(subcommand)] | ||
| pub cmd: Subcommand, | ||
| } | ||
|
|
||
| /// forest-dev sub-commands | ||
| #[derive(clap::Subcommand)] | ||
| pub enum Subcommand { | ||
| /// Fetch RPC test snapshots to the local cache | ||
| FetchRpcTests, | ||
| } | ||
|
|
||
| impl Subcommand { | ||
| pub async fn run(self, _client: Client) -> anyhow::Result<()> { | ||
| match self { | ||
| Self::FetchRpcTests => fetch_rpc_tests().await, | ||
| } | ||
| } | ||
| } | ||
|
|
||
| async fn fetch_rpc_tests() -> anyhow::Result<()> { | ||
| crate::utils::proofs_api::maybe_set_proofs_parameter_cache_dir_env( | ||
| &crate::Config::default().client.data_dir, | ||
| ); | ||
| ensure_proof_params_downloaded().await?; | ||
| let tests = include_str!("../../tool/subcommands/api_cmd/test_snapshots.txt") | ||
| .lines() | ||
| .map(|i| { | ||
| // Remove comment | ||
| i.split("#").next().unwrap().trim().to_string() | ||
| }) | ||
| .filter(|l| !l.is_empty() && !l.starts_with('#')); | ||
| let mut joinset = JoinSet::new(); | ||
| for test in tests { | ||
| joinset.spawn(fetch_rpc_test_snapshot(test.into())); | ||
| } | ||
| for result in joinset.join_all().await { | ||
| if let Err(e) = result { | ||
| tracing::warn!("{e}"); | ||
| } | ||
| } | ||
| Ok(()) | ||
| } | ||
|
|
||
| pub async fn fetch_rpc_test_snapshot<'a>(name: Cow<'a, str>) -> anyhow::Result<PathBuf> { | ||
| let url: Url = | ||
| format!("https://forest-snapshots.fra1.cdn.digitaloceanspaces.com/rpc_test/{name}") | ||
| .parse() | ||
| .with_context(|| format!("Failed to parse URL for test: {name}"))?; | ||
| let project_dir = | ||
| ProjectDirs::from("com", "ChainSafe", "Forest").context("failed to get project dir")?; | ||
| let cache_dir = project_dir.cache_dir().join("test").join("rpc-snapshots"); | ||
| let path = crate::utils::retry( | ||
| crate::utils::RetryArgs { | ||
| timeout: Some(Duration::from_secs(60)), | ||
| max_retries: Some(5), | ||
| delay: Some(Duration::from_secs(1)), | ||
| }, | ||
| || async { | ||
| download_file_with_cache(&url, &cache_dir, DownloadFileOption::NonResumable).await | ||
| }, | ||
| ) | ||
| .await | ||
| .map_err(|e| anyhow::anyhow!("failed to fetch rpc test snapshot {name} :{e}"))? | ||
| .path; | ||
| Ok(path) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.