Skip to content

Commit bc079eb

Browse files
authored
[CI] Fix fork builds (hao-ai-lab#590)
1 parent 701eb4e commit bc079eb

File tree

4 files changed

+35
-33
lines changed

4 files changed

+35
-33
lines changed

.buildkite/pipeline.yml

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
env:
22
IMAGE_VERSION: "py3.12-latest"
3+
BUILDKITE_CLEAN_CHECKOUT: true
34

45
steps:
56
- label: "pre-commit"
67
command: ".buildkite/scripts/pre_commit.sh"
78
agents:
89
queue: "default"
9-
env:
10-
- BUILDKITE_CLEAN_CHECKOUT=true
1110

1211
- wait
1312

@@ -23,10 +22,9 @@ steps:
2322
- "pyproject.toml"
2423
- "docker/Dockerfile.python3.12"
2524
config:
26-
command: "timeout 30m .buildkite/scripts/pr_test.sh"
25+
command: "timeout 15m .buildkite/scripts/pr_test.sh"
2726
label: "Encoder Tests"
2827
env:
29-
- BUILDKITE_CLEAN_CHECKOUT=true
3028
- TEST_TYPE=encoder
3129
agents:
3230
queue: "default"
@@ -37,10 +35,9 @@ steps:
3735
- "pyproject.toml"
3836
- "docker/Dockerfile.python3.12"
3937
config:
40-
command: "timeout 30m .buildkite/scripts/pr_test.sh"
38+
command: "timeout 15m .buildkite/scripts/pr_test.sh"
4139
label: "VAE Tests"
4240
env:
43-
- BUILDKITE_CLEAN_CHECKOUT=true
4441
- TEST_TYPE=vae
4542
agents:
4643
queue: "default"
@@ -53,20 +50,18 @@ steps:
5350
- "pyproject.toml"
5451
- "docker/Dockerfile.python3.12"
5552
config:
56-
command: "timeout 30m .buildkite/scripts/pr_test.sh"
53+
command: "timeout 15m .buildkite/scripts/pr_test.sh"
5754
label: "Transformer Tests"
5855
env:
59-
- BUILDKITE_CLEAN_CHECKOUT=true
6056
- TEST_TYPE=transformer
6157
agents:
6258
queue: "default"
6359
- path:
6460
- "fastvideo/v1/**/*.py"
6561
config:
66-
command: "timeout 60m .buildkite/scripts/pr_test.sh"
62+
command: "timeout 30m .buildkite/scripts/pr_test.sh"
6763
label: "SSIM Tests"
6864
env:
69-
- BUILDKITE_CLEAN_CHECKOUT=true
7065
- TEST_TYPE=ssim
7166
agents:
7267
queue: "default"
@@ -75,10 +70,9 @@ steps:
7570
- "pyproject.toml"
7671
- "docker/Dockerfile.python3.12"
7772
config:
78-
command: "timeout 30m .buildkite/scripts/pr_test.sh"
73+
command: "timeout 15m .buildkite/scripts/pr_test.sh"
7974
label: "Training Tests"
8075
env:
81-
- BUILDKITE_CLEAN_CHECKOUT=true
8276
- TEST_TYPE=training
8377
agents:
8478
queue: "default"
@@ -92,10 +86,9 @@ steps:
9286
- "pyproject.toml"
9387
- "docker/Dockerfile.python3.12"
9488
config:
95-
command: "timeout 30m .buildkite/scripts/pr_test.sh"
89+
command: "timeout 15m .buildkite/scripts/pr_test.sh"
9690
label: "Training Tests VSA"
9791
env:
98-
- BUILDKITE_CLEAN_CHECKOUT=true
9992
- TEST_TYPE=training_vsa
10093
agents:
10194
queue: "default"
@@ -108,10 +101,9 @@ steps:
108101
- "pyproject.toml"
109102
- "docker/Dockerfile.python3.12"
110103
config:
111-
command: "timeout 30m .buildkite/scripts/pr_test.sh"
104+
command: "timeout 15m .buildkite/scripts/pr_test.sh"
112105
label: "Inference Tests STA"
113106
env:
114-
- BUILDKITE_CLEAN_CHECKOUT=true
115107
- TEST_TYPE=inference_sta
116108
agents:
117109
queue: "default"
@@ -123,10 +115,9 @@ steps:
123115
- "pyproject.toml"
124116
- "docker/Dockerfile.python3.12"
125117
config:
126-
command: "timeout 30m .buildkite/scripts/pr_test.sh"
118+
command: "timeout 15m .buildkite/scripts/pr_test.sh"
127119
label: "Precision Tests STA"
128120
env:
129-
- BUILDKITE_CLEAN_CHECKOUT=true
130121
- TEST_TYPE=precision_sta
131122
agents:
132123
queue: "default"
@@ -139,10 +130,9 @@ steps:
139130
- "pyproject.toml"
140131
- "docker/Dockerfile.python3.12"
141132
config:
142-
command: "timeout 30m .buildkite/scripts/pr_test.sh"
133+
command: "timeout 15m .buildkite/scripts/pr_test.sh"
143134
label: "Precision Tests VSA"
144135
env:
145-
- BUILDKITE_CLEAN_CHECKOUT=true
146136
- TEST_TYPE=precision_vsa
147137
agents:
148138
queue: "default"

.buildkite/scripts/pr_test.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ if [ -z "${TEST_TYPE:-}" ]; then
5858
fi
5959
log "Test type: $TEST_TYPE"
6060

61-
MODAL_ENV="BUILDKITE_REPO=$BUILDKITE_REPO BUILDKITE_COMMIT=$BUILDKITE_COMMIT IMAGE_VERSION=$IMAGE_VERSION"
61+
MODAL_ENV="BUILDKITE_REPO=$BUILDKITE_REPO BUILDKITE_COMMIT=$BUILDKITE_COMMIT BUILDKITE_PULL_REQUEST=$BUILDKITE_PULL_REQUEST IMAGE_VERSION=$IMAGE_VERSION"
6262

6363
case "$TEST_TYPE" in
6464
"encoder")

fastvideo/v1/tests/modal/pr_test.py

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
"PATH": "/root/.cargo/bin:$PATH",
1919
"BUILDKITE_REPO": os.environ.get("BUILDKITE_REPO", ""),
2020
"BUILDKITE_COMMIT": os.environ.get("BUILDKITE_COMMIT", ""),
21+
"BUILDKITE_PULL_REQUEST": os.environ.get("BUILDKITE_PULL_REQUEST", ""),
22+
"IMAGE_VERSION": os.environ.get("IMAGE_VERSION", ""),
2123
})
2224
)
2325

@@ -29,16 +31,27 @@ def run_test(pytest_command: str):
2931

3032
git_repo = os.environ.get("BUILDKITE_REPO")
3133
git_commit = os.environ.get("BUILDKITE_COMMIT")
34+
pr_number = os.environ.get("BUILDKITE_PULL_REQUEST")
3235

3336
print(f"Cloning repository: {git_repo}")
34-
print(f"Checking out commit: {git_commit}")
37+
print(f"Target commit: {git_commit}")
38+
if pr_number:
39+
print(f"PR number: {pr_number}")
40+
41+
# For PRs (including forks), use GitHub's PR refs to get the correct commit
42+
if pr_number and pr_number != "false":
43+
checkout_command = f"git fetch --prune origin refs/pull/{pr_number}/head && git checkout FETCH_HEAD"
44+
print(f"Using PR ref for checkout: {checkout_command}")
45+
else:
46+
checkout_command = f"git checkout {git_commit}"
47+
print(f"Using direct commit checkout: {checkout_command}")
3548

3649
command = f"""
3750
source $HOME/.local/bin/env &&
3851
source /opt/venv/bin/activate &&
3952
git clone {git_repo} /FastVideo &&
4053
cd /FastVideo &&
41-
git checkout {git_commit} &&
54+
{checkout_command} &&
4255
uv pip install -e .[test] &&
4356
{pytest_command}
4457
"""
@@ -49,38 +62,38 @@ def run_test(pytest_command: str):
4962

5063
sys.exit(result.returncode)
5164

52-
@app.function(gpu="L40S:1", image=image, timeout=1800)
65+
@app.function(gpu="L40S:1", image=image, timeout=900)
5366
def run_encoder_tests():
5467
run_test("pytest ./fastvideo/v1/tests/encoders -vs")
5568

56-
@app.function(gpu="L40S:1", image=image, timeout=1800)
69+
@app.function(gpu="L40S:1", image=image, timeout=900)
5770
def run_vae_tests():
5871
run_test("pytest ./fastvideo/v1/tests/vaes -vs")
5972

60-
@app.function(gpu="L40S:1", image=image, timeout=1800)
73+
@app.function(gpu="L40S:1", image=image, timeout=900)
6174
def run_transformer_tests():
6275
run_test("pytest ./fastvideo/v1/tests/transformers -vs")
6376

64-
@app.function(gpu="L40S:2", image=image, timeout=3600)
77+
@app.function(gpu="L40S:2", image=image, timeout=1800)
6578
def run_ssim_tests():
6679
run_test("pytest ./fastvideo/v1/tests/ssim -vs")
6780

68-
@app.function(gpu="L40S:4", image=image, timeout=1800, secrets=[modal.Secret.from_dict({"WANDB_API_KEY": os.environ.get("WANDB_API_KEY", "")})])
81+
@app.function(gpu="L40S:4", image=image, timeout=900, secrets=[modal.Secret.from_dict({"WANDB_API_KEY": os.environ.get("WANDB_API_KEY", "")})])
6982
def run_training_tests():
7083
run_test("wandb login $WANDB_API_KEY && pytest ./fastvideo/v1/tests/training/Vanilla -srP")
7184

72-
@app.function(gpu="H100:2", image=image, timeout=1800, secrets=[modal.Secret.from_dict({"WANDB_API_KEY": os.environ.get("WANDB_API_KEY", "")})])
85+
@app.function(gpu="H100:2", image=image, timeout=900, secrets=[modal.Secret.from_dict({"WANDB_API_KEY": os.environ.get("WANDB_API_KEY", "")})])
7386
def run_training_tests_VSA():
7487
run_test("wandb login $WANDB_API_KEY && pytest ./fastvideo/v1/tests/training/VSA -srP")
7588

76-
@app.function(gpu="H100:2", image=image, timeout=1800)
89+
@app.function(gpu="H100:2", image=image, timeout=900)
7790
def run_inference_tests_STA():
7891
run_test("pytest ./fastvideo/v1/tests/inference/STA -srP")
7992

80-
@app.function(gpu="H100:1", image=image, timeout=1800)
93+
@app.function(gpu="H100:1", image=image, timeout=900)
8194
def run_precision_tests_STA():
8295
run_test("python csrc/attn/tests/test_sta.py")
8396

84-
@app.function(gpu="H100:1", image=image, timeout=1800)
97+
@app.function(gpu="H100:1", image=image, timeout=900)
8598
def run_precision_tests_VSA():
8699
run_test("python csrc/attn/tests/test_block_sparse.py")

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# trigger test
21
[build-system]
32
requires = ["setuptools>=61.0"]
43
build-backend = "setuptools.build_meta"

0 commit comments

Comments
 (0)