Skip to content

Commit bcdf147

Browse files
authored
Rollup merge of #7298 - flip1995:ci-switch-to-monster, r=xFrednet,flip1995
Switch CI to new metadata collection r? `@xFrednet` Things we have to keep in mind: - This removes the template files and the scripts used for deployment from the checkout. This was added in #5517. I don't think we ever needed those there. Not sure though. - ~~As a result, we can't remove the python scripts yet. We have to wait until this hits a stable Clippy release.~~ I'll just break the next stable deploy and do it by hand once. - This should be merged together with #7279. Me and `@xFrednet` will coordinate the switch - ...? I still have to try out some things: - [x] Is it worth caching? Yes - [x] ~~Is it worth to do a release build?~~ Nope - [x] Does it actually work? With a few changes, yes - [ ] ...? changelog: Clippy now uses a lint to generate its documentation 🎉
2 parents ce46599 + c951a3c commit bcdf147

File tree

8 files changed

+26
-213
lines changed

8 files changed

+26
-213
lines changed

.github/deploy.sh

+4-5
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,12 @@ rm -rf out/master/ || exit 0
88
echo "Making the docs for master"
99
mkdir out/master/
1010
cp util/gh-pages/index.html out/master
11-
python3 ./util/export.py out/master/lints.json
11+
cp util/gh-pages/lints.json out/master
1212

1313
if [[ -n $TAG_NAME ]]; then
1414
echo "Save the doc for the current tag ($TAG_NAME) and point stable/ to it"
15-
cp -r out/master "out/$TAG_NAME"
16-
rm -f out/stable
17-
ln -s "$TAG_NAME" out/stable
15+
cp -Tr out/master "out/$TAG_NAME"
16+
ln -sf "$TAG_NAME" out/stable
1817
fi
1918

2019
if [[ $BETA = "true" ]]; then
@@ -28,8 +27,8 @@ cp util/gh-pages/versions.html out/index.html
2827
echo "Making the versions.json file"
2928
python3 ./util/versions.py out
3029

31-
cd out
3230
# Now let's go have some fun with the cloned repo
31+
cd out
3332
git config user.name "GHA CI"
3433
git config user.email "[email protected]"
3534

.github/workflows/deploy.yml

+15-2
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,23 @@ jobs:
3939
if: github.ref == 'refs/heads/beta'
4040
run: echo "BETA=true" >> $GITHUB_ENV
4141

42-
- name: Use scripts and templates from master branch
42+
# We need to check out all files that (transitively) depend on the
43+
# structure of the gh-pages branch, so that we're able to change that
44+
# structure without breaking the deployment.
45+
- name: Use deploy files from master branch
4346
run: |
4447
git fetch --no-tags --prune --depth=1 origin master
45-
git checkout origin/master -- .github/deploy.sh util/gh-pages/ util/*.py
48+
git checkout origin/master -- .github/deploy.sh util/versions.py util/gh-pages/versions.html
49+
50+
# Generate lockfile for caching to avoid build problems with cached deps
51+
- name: cargo generate-lockfile
52+
run: cargo generate-lockfile
53+
54+
- name: Cache
55+
uses: Swatinem/[email protected]
56+
57+
- name: cargo collect-metadata
58+
run: cargo collect-metadata
4659

4760
- name: Deploy
4861
run: |

clippy_dev/src/serve.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ pub fn run(port: u16, lint: Option<&str>) -> ! {
1515

1616
loop {
1717
if mtime("util/gh-pages/lints.json") < mtime("clippy_lints/src") {
18-
Command::new("python3")
19-
.arg("util/export.py")
18+
Command::new("cargo")
19+
.arg("collect-metadata")
2020
.spawn()
2121
.unwrap()
2222
.wait()

clippy_lints/src/utils/internal_lints/metadata_collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use clippy_utils::{
3232
};
3333

3434
/// This is the output file of the lint collector.
35-
const OUTPUT_FILE: &str = "../util/gh-pages/metadata_collection.json";
35+
const OUTPUT_FILE: &str = "../util/gh-pages/lints.json";
3636
/// These lints are excluded from the export.
3737
const BLACK_LISTED_LINTS: [&str; 3] = ["lint_author", "deep_code_inspection", "internal_metadata_collector"];
3838
/// These groups will be ignored by the lint group matcher. This is useful for collections like

tests/dogfood.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ fn run_metadata_collection_lint() {
183183
use std::time::SystemTime;
184184

185185
// Setup for validation
186-
let metadata_output_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("util/gh-pages/metadata_collection.json");
186+
let metadata_output_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("util/gh-pages/lints.json");
187187
let start_time = SystemTime::now();
188188

189189
// Run collection as is

util/export.py

-84
This file was deleted.

util/lintlib.py

-115
This file was deleted.

util/versions.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import json
44
import os
55
import sys
6-
7-
from lintlib import log
6+
import logging as log
7+
log.basicConfig(level=log.INFO, format='%(levelname)s: %(message)s')
88

99

1010
def key(v):
@@ -26,7 +26,7 @@ def key(v):
2626

2727
def main():
2828
if len(sys.argv) < 2:
29-
print("Error: specify output directory")
29+
log.error("specify output directory")
3030
return
3131

3232
outdir = sys.argv[1]

0 commit comments

Comments
 (0)