Skip to content

Commit 23e5243

Browse files
Add CI check to ensure that rustdoc JSON FORMAT_VERSION is correctly updated
1 parent 1bb3352 commit 23e5243

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

src/ci/docker/host-x86_64/mingw-check-1/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ RUN pip3 install --no-deps --no-cache-dir --require-hashes -r /tmp/reuse-require
4040
COPY host-x86_64/mingw-check-1/check-default-config-profiles.sh /scripts/
4141
COPY host-x86_64/mingw-check-1/validate-toolstate.sh /scripts/
4242
COPY host-x86_64/mingw-check-1/validate-error-codes.sh /scripts/
43+
COPY host-x86_64/mingw-check-1/validate-rustdoc-json-format-version-update.sh /scripts/
4344

4445
# Check library crates on all tier 1 targets.
4546
# We disable optimized compiler built-ins because that requires a C toolchain for the target.
@@ -53,6 +54,7 @@ ENV SCRIPT \
5354
python3 ../x.py check --stage 1 --set build.optimized-compiler-builtins=false core alloc std --target=aarch64-unknown-linux-gnu,i686-pc-windows-msvc,i686-unknown-linux-gnu,x86_64-apple-darwin,x86_64-pc-windows-gnu,x86_64-pc-windows-msvc && \
5455
/scripts/validate-toolstate.sh && \
5556
/scripts/validate-error-codes.sh && \
57+
/scripts/validate-rustdoc-json-format-version-update.sh && \
5658
reuse --include-submodules lint && \
5759
python3 ../x.py test collect-license-metadata && \
5860
# Runs checks to ensure that there are no issues in our JS code.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
# Checks that the rustdoc-json-types `FORMAT_VERSION` was updated correctly.
3+
4+
set -eo pipefail
5+
6+
if [[ -z "$BASE_COMMIT" ]]; then
7+
echo "not checking error code explanations removal"
8+
exit 0
9+
fi
10+
11+
echo 'Check if rustdoc JSON `FORMAT_VERSION` was correctly updated...'
12+
13+
if (git diff "$BASE_COMMIT" --name-status | grep '^M' \
14+
| grep --quiet "src/rustdoc-json-types"); then
15+
# FIXME: Also check that `FORMAT_VERSION` is increased if any code change occurred
16+
if (git diff "$BASE_COMMIT" src/rustdoc-json-types \
17+
| grep --quiet "+pub const FORMAT_VERSION: u32 =") && !(
18+
git diff "$BASE_COMMIT" | grep --quiet "+// Latest feature:"); then
19+
echo '`FORMAT_VERSION` was updated, but the `Latest feature` comment was not'
20+
exit 1
21+
fi
22+
fi
23+
24+
echo 'No problem with rustdoc JSON `FORMAT_VERSION` update'

src/ci/docker/host-x86_64/mingw-check-tidy/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ RUN pip3 install --no-deps --no-cache-dir --require-hashes -r /tmp/reuse-require
4040

4141
COPY host-x86_64/mingw-check-1/validate-toolstate.sh /scripts/
4242
COPY host-x86_64/mingw-check-1/validate-error-codes.sh /scripts/
43+
COPY host-x86_64/mingw-check-1/validate-rustdoc-json-format-version-update.sh /scripts/
4344

4445
RUN bash -c 'npm install -g eslint@$(cat /tmp/eslint.version)'
4546

0 commit comments

Comments
 (0)