Skip to content

Commit e769c74

Browse files
authored
Check .git in formatter progress checkouts for build (#6387)
From the formatter progress CI logs: ``` 2023-08-07T03:49:02.5178602Z + mkdir -p /home/runner/work/ruff/ruff/target/progress_projects 2023-08-07T03:49:02.5193474Z + '[' '!' -d /home/runner/work/ruff/ruff/target/progress_projects/build ']' 2023-08-07T03:49:02.5194228Z + '[' '!' -d /home/runner/work/ruff/ruff/target/progress_projects/django ']' 2023-08-07T03:49:02.5194966Z + git clone --filter=tree:0 https://github.com/django/django /home/runner/work/ruff/ruff/target/progress_projects/django 2023-08-07T03:49:02.5209260Z Cloning into '/home/runner/work/ruff/ruff/target/progress_projects/django'... ``` ``` 2023-08-07T03:51:17.4726088Z �[2m2023-08-07T03:51:17.472404Z�[0m �[31mERROR�[0m Failed /home/runner/work/ruff/ruff/target/progress_projects/build: no python files in ["/home/runner/work/ruff/ruff/target/progress_projects/build"] ``` Seems that build exists but is an empty cached folder. These changes should fix this by a) checking for `.git` instead of just the folder existing b) running the commit checkout unconditionally. The latter is also important if we ever want to update the SHAs.
1 parent d815a25 commit e769c74

File tree

2 files changed

+18
-20
lines changed

2 files changed

+18
-20
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
- "!crates/ruff_formatter/**"
4343
- "!crates/ruff_dev/**"
4444
- "!crates/ruff_shrinking/**"
45-
- scripts/check_ecosystem.py
45+
- scripts/*
4646
4747
formatter:
4848
- Cargo.toml
@@ -56,6 +56,7 @@ jobs:
5656
- crates/ruff_text_size/**
5757
- crates/ruff_python_parser/**
5858
- crates/ruff_dev/**
59+
- scripts/*
5960
6061
cargo-fmt:
6162
name: "cargo fmt"
@@ -338,8 +339,5 @@ jobs:
338339
run: scripts/formatter_ecosystem_checks.sh
339340
- name: "Github step summary"
340341
run: grep "similarity index" target/progress_projects_log.txt | sort > $GITHUB_STEP_SUMMARY
341-
# CPython is not black formatted, so we run only the stability check
342-
- name: "Clone CPython 3.10"
343-
run: git clone --branch 3.10 --depth 1 https://github.com/python/cpython.git crates/ruff/resources/test/cpython
344-
- name: "Check CPython stability"
345-
run: cargo run --bin ruff_dev -- format-dev --stability-check crates/ruff/resources/test/cpython
342+
- name: "Remove checkouts from cache"
343+
run: rm -r target/progress_projects

scripts/formatter_ecosystem_checks.sh

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,40 +17,40 @@ dir="$target/progress_projects"
1717
mkdir -p "$dir"
1818

1919
# small util library
20-
if [ ! -d "$dir/build" ]; then
20+
if [ ! -d "$dir/build/.git" ]; then
2121
git clone --filter=tree:0 https://github.com/pypa/build "$dir/build"
22-
git -C "$dir/build" checkout d90f9ac6503a40ddbfaef94b7a7040f87178a4b3
2322
fi
23+
git -C "$dir/build" checkout d90f9ac6503a40ddbfaef94b7a7040f87178a4b3
2424
# web framework that implements a lot of magic
25-
if [ ! -d "$dir/django" ]; then
25+
if [ ! -d "$dir/django/.git" ]; then
2626
git clone --filter=tree:0 https://github.com/django/django "$dir/django"
27-
git -C "$dir/django" checkout 95e4d6b81312fdd9f8ebf3385be1c1331168b5cf
2827
fi
28+
git -C "$dir/django" checkout 95e4d6b81312fdd9f8ebf3385be1c1331168b5cf
2929
# an ML project
30-
if [ ! -d "$dir/transformers" ]; then
30+
if [ ! -d "$dir/transformers/.git" ]; then
3131
git clone --filter=tree:0 https://github.com/huggingface/transformers "$dir/transformers"
32-
git -C "$dir/transformers" checkout c9a82be592ca305180a7ab6a36e884bca1d426b8
3332
fi
33+
git -C "$dir/django" checkout 95e4d6b81312fdd9f8ebf3385be1c1331168b5cf
3434
# type annotations
35-
if [ ! -d "$dir/typeshed" ]; then
35+
if [ ! -d "$dir/typeshed/.git" ]; then
3636
git clone --filter=tree:0 https://github.com/python/typeshed "$dir/typeshed"
37-
git -C "$dir/typeshed" checkout 7d33060e6ae3ebe54462a891f0c566c97371915b
3837
fi
38+
git -C "$dir/typeshed" checkout 7d33060e6ae3ebe54462a891f0c566c97371915b
3939
# python 3.11, typing and 100% test coverage
40-
if [ ! -d "$dir/warehouse" ]; then
40+
if [ ! -d "$dir/warehouse/.git" ]; then
4141
git clone --filter=tree:0 https://github.com/pypi/warehouse "$dir/warehouse"
42-
git -C "$dir/warehouse" checkout fe6455c0a946e81f61d72edc1049f536d8bba903
4342
fi
43+
git -C "$dir/warehouse" checkout fe6455c0a946e81f61d72edc1049f536d8bba903
4444
# zulip, a django user
45-
if [ ! -d "$dir/zulip" ]; then
45+
if [ ! -d "$dir/zulip/.git" ]; then
4646
git clone --filter=tree:0 https://github.com/zulip/zulip "$dir/zulip"
47-
git -C "$dir/zulip" checkout 6cb080c4479546a7f5cb017fcddea56605910b48
4847
fi
48+
git -C "$dir/zulip" checkout 6cb080c4479546a7f5cb017fcddea56605910b48
4949
# cpython itself
50-
if [ ! -d "$dir/cpython" ]; then
50+
if [ ! -d "$dir/cpython/.git" ]; then
5151
git clone --filter=tree:0 https://github.com/python/cpython "$dir/cpython"
52-
git -C "$dir/cpython" checkout 45de31db9cc9be945702f3a7ca35bbb9f98476af
5352
fi
53+
git -C "$dir/cpython" checkout 45de31db9cc9be945702f3a7ca35bbb9f98476af
5454

5555
# Uncomment if you want to update the hashes
5656
# for i in "$dir"/*/; do git -C "$i" switch main && git -C "$i" pull && echo "# $(basename "$i") $(git -C "$i" rev-parse HEAD)"; done

0 commit comments

Comments
 (0)