MCPcopy Create free account
hub / github.com/bytecodealliance/wstd / main

Function main

ci/publish.rs:44–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

42}
43
44fn main() {
45 let mut crates = Vec::new();
46 let root = read_crate(None, "./Cargo.toml".as_ref());
47 let ws = Workspace {
48 version: root.workspace_version.clone().unwrap(),
49 };
50 find_crates(".".as_ref(), &ws, &mut crates);
51
52 let pos = CRATES_TO_PUBLISH
53 .iter()
54 .enumerate()
55 .map(|(i, c)| (*c, i))
56 .collect::<HashMap<_, _>>();
57 crates.sort_by_key(|krate| pos.get(&krate.name[..]));
58
59 match &env::args().nth(1).expect("must have one argument")[..] {
60 name @ "bump" | name @ "bump-patch" => {
61 for krate in crates.iter() {
62 bump_version(&krate, &crates, name == "bump-patch");
63 }
64 // update the lock file
65 assert!(
66 Command::new("cargo")
67 .arg("fetch")
68 .status()
69 .unwrap()
70 .success()
71 );
72 }
73
74 "publish" => {
75 // We have so many crates to publish we're frequently either
76 // rate-limited or we run into issues where crates can't publish
77 // successfully because they're waiting on the index entries of
78 // previously-published crates to propagate. This means we try to
79 // publish in a loop and we remove crates once they're successfully
80 // published. Failed-to-publish crates get enqueued for another try
81 // later on.
82 for _ in 0..10 {
83 crates.retain(|krate| !publish(krate));
84
85 if crates.is_empty() {
86 break;
87 }
88
89 println!(
90 "{} crates failed to publish, waiting for a bit to retry",
91 crates.len(),
92 );
93 thread::sleep(Duration::from_secs(40));
94 }
95
96 assert!(crates.is_empty(), "failed to publish all crates");
97 }
98
99 "verify" => {
100 verify(&crates);
101 }

Callers

nothing calls this directly

Calls 6

read_crateFunction · 0.85
find_cratesFunction · 0.85
bump_versionFunction · 0.85
publishFunction · 0.85
sleepFunction · 0.85
verifyFunction · 0.85

Tested by

no test coverage detected