Skip to content

Commit eb52ccc

Browse files
committed
Add repo clean step before every build
1 parent 0506f8a commit eb52ccc

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

.github/workflows/integration.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,10 @@ jobs:
7474

7575
- name: Verify JIT build works
7676
# Use commit that I know has JIT support with LLVM 20
77-
run: uv run every-python run 42d014086098d3d70cacb4d8993f04cace120c12 --jit -- --version
77+
run: uv run every-python run 42d014086098d3d70cacb4d8993f04cace120c12 --jit -- --version
78+
79+
- name: Verify consecutive builds work
80+
# Use two versions that can only be built if repo cleanup between works
81+
run: |
82+
uv run every-python install v3.12.0
83+
uv run every-python install v3.11.0

every_python/main.py

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,35 @@ def _get_configure_args(build_dir: Path, enable_jit: bool) -> list[str]:
135135
return args
136136

137137

138+
def _run_clean_repo(
139+
runner: CommandRunner,
140+
verbose: bool,
141+
progress: Progress,
142+
task: TaskID,
143+
) -> None:
144+
"""Run the clean repo step."""
145+
output = get_output()
146+
args = ["clean", "-fdx"]
147+
148+
if verbose:
149+
progress.stop()
150+
output.status(f"Running: git {' '.join(args)}")
151+
else:
152+
progress.update(task, description="Cleaning repo...")
153+
154+
result = runner.run_git(args, repo_dir=REPO_DIR)
155+
156+
if not result.success:
157+
if not verbose:
158+
progress.stop()
159+
output.error(
160+
f"Cleaning repo failed: {result.stderr if not verbose else ''}"
161+
)
162+
else:
163+
output.error("Cleaning repo failed!")
164+
raise typer.Exit(1)
165+
166+
138167
def _run_configure(
139168
runner: CommandRunner,
140169
build_dir: Path,
@@ -263,6 +292,9 @@ def build_python(commit: str, enable_jit: bool = False, verbose: bool = False) -
263292
output.error(f"Failed to checkout {commit}: {result.stderr}")
264293
raise typer.Exit(1)
265294

295+
# Clean repo
296+
_run_clean_repo(runner, verbose, progress, task)
297+
266298
# Configure
267299
_run_configure(runner, build_dir, enable_jit, verbose, progress, task)
268300

@@ -527,7 +559,7 @@ def bisect(
527559

528560
# Reset any local changes in the repo
529561
runner.run_git(["reset", "--hard"], REPO_DIR)
530-
runner.run_git(["clean", "-fd"], REPO_DIR)
562+
runner.run_git(["clean", "-fdx"], REPO_DIR)
531563

532564
runner.run_git(["bisect", "start"], REPO_DIR, check=True)
533565
runner.run_git(["bisect", "bad", bad_commit], REPO_DIR, check=True)

0 commit comments

Comments
 (0)