From ff216ebc969cb5d86f55f57583b1298b8f92773f Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Wed, 19 Apr 2023 22:37:40 +0100 Subject: [PATCH 1/3] chore: make `server-check` a workspace member --- .github/workflows/main.yml | 3 ++- Cargo.lock | 7 +++++++ {src/doc => crates}/semver-check/Cargo.toml | 0 {src/doc => crates}/semver-check/src/main.rs | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) rename {src/doc => crates}/semver-check/Cargo.toml (100%) rename {src/doc => crates}/semver-check/src/main.rs (99%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 94cfb044f1b..b3900da0cfd 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -185,7 +185,8 @@ jobs: - run: rustup component add rust-docs - run: ci/validate-man.sh # This requires rustfmt, use stable. - - run: cd src/doc/semver-check && cargo +stable run + - name: Run semver-check + run: cargo +stable run -p semver-check - run: | mkdir mdbook curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.27/mdbook-v0.4.27-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook diff --git a/Cargo.lock b/Cargo.lock index e37a66212eb..818ca172783 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2779,6 +2779,13 @@ dependencies = [ "serde", ] +[[package]] +name = "semver-check" +version = "0.1.0" +dependencies = [ + "tempfile", +] + [[package]] name = "serde" version = "1.0.160" diff --git a/src/doc/semver-check/Cargo.toml b/crates/semver-check/Cargo.toml similarity index 100% rename from src/doc/semver-check/Cargo.toml rename to crates/semver-check/Cargo.toml diff --git a/src/doc/semver-check/src/main.rs b/crates/semver-check/src/main.rs similarity index 99% rename from src/doc/semver-check/src/main.rs rename to crates/semver-check/src/main.rs index 51aacbe1105..f1630f519f4 100644 --- a/src/doc/semver-check/src/main.rs +++ b/crates/semver-check/src/main.rs @@ -25,7 +25,7 @@ const SEPARATOR: &str = "/////////////////////////////////////////////////////// fn doit() -> Result<(), Box> { let filename = std::env::args() .nth(1) - .unwrap_or_else(|| "../src/reference/semver.md".to_string()); + .unwrap_or_else(|| "src/doc/src/reference/semver.md".to_string()); let contents = fs::read_to_string(filename)?; let mut lines = contents.lines().enumerate(); From 3b8d744b44765055e4a743158a4f7eedcfcec8b1 Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Wed, 19 Apr 2023 22:24:38 +0100 Subject: [PATCH 2/3] ci: run linkchekcer from target dir This helps us remove `src/doc` from `exclude` list in Cargo.toml --- .github/workflows/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b3900da0cfd..303082018d5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -196,11 +196,11 @@ jobs: env: RUSTDOCFLAGS: -D warnings - run: cd src/doc && mdbook build --dest-dir ../../target/doc - - run: | - cd src/doc - curl -sSLo linkcheck.sh \ - https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh - sh linkcheck.sh --all cargo + - name: Run linkchecker.sh + run: | + cd target + curl -sSLO https://raw.githubusercontent.com/rust-lang/rust/master/src/tools/linkchecker/linkcheck.sh + sh linkcheck.sh --all --path ../src/doc cargo success: permissions: From 8966ab0e19e30aa242d70de5c7cf0794462f637f Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Wed, 19 Apr 2023 22:41:07 +0100 Subject: [PATCH 3/3] chore: remove `src/doc` from `exclude` list in Cargo.toml --- Cargo.toml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0959271a302..cb5aeb54234 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,10 +7,6 @@ members = [ "benches/capture", ] exclude = [ - # For linkchecker (downloaded during CI) and semver-check - # TODO: Either move semver-check to crates/ folder, - # or make linkchecker run from a given directory. - "src/doc/", "target/", # exclude bench testing ]