|
1 | 1 | name: Run performance benchmark tests |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - branches: |
6 | | - - main |
| 4 | + workflow_run: |
| 5 | + workflows: ["Build docker images"] |
| 6 | + types: |
| 7 | + - completed |
| 8 | + # Allow manual triggering for testing |
| 9 | + workflow_dispatch: |
7 | 10 |
|
8 | 11 | jobs: |
9 | 12 | build: |
10 | 13 | runs-on: ubuntu-latest |
| 14 | + # Only run if: |
| 15 | + # 1. Manual trigger, OR |
| 16 | + # 2. Build workflow completed successfully after a tag push |
| 17 | + if: | |
| 18 | + github.event_name == 'workflow_dispatch' || |
| 19 | + (github.event.workflow_run.conclusion == 'success' && |
| 20 | + github.event.workflow_run.event == 'push') |
11 | 21 | defaults: |
12 | 22 | run: |
13 | 23 | working-directory: example |
14 | 24 | steps: |
15 | 25 | - name: Checkout monorepo |
16 | 26 | uses: actions/checkout@v4 |
17 | 27 | with: |
| 28 | + # For workflow_run, we need to checkout the specific commit that triggered the build |
| 29 | + ref: ${{ github.event.workflow_run.head_sha || github.sha }} |
18 | 30 | fetch-depth: 2 |
19 | 31 | - name: Check if benchmark has already run |
20 | 32 | run: | |
21 | | - version=$(grep dataCatererVersion ../gradle.properties | cut -d= -f2) |
| 33 | + version=$(grep -E "^version=" ../gradle.properties | cut -d= -f2) |
22 | 34 | if [ ! -f benchmark/results/benchmark_results_${version}.txt ]; then |
23 | 35 | echo "No benchmark results for version: $version, starting to run benchmarks" |
24 | 36 | else |
25 | 37 | echo "Benchmarks already run!" |
26 | 38 | exit 1 |
27 | 39 | fi |
| 40 | + - name: Wait for Docker image to be available |
| 41 | + run: | |
| 42 | + version=$(grep -E "^version=" ../gradle.properties | cut -d= -f2) |
| 43 | + echo "Waiting for Docker image datacatering/data-caterer:${version} to be available..." |
| 44 | + max_attempts=10 |
| 45 | + attempt=1 |
| 46 | + while [ $attempt -le $max_attempts ]; do |
| 47 | + if docker pull datacatering/data-caterer:${version} 2>/dev/null; then |
| 48 | + echo "Docker image is available!" |
| 49 | + break |
| 50 | + else |
| 51 | + echo "Attempt $attempt/$max_attempts: Image not yet available, waiting 30 seconds..." |
| 52 | + sleep 30 |
| 53 | + ((attempt++)) |
| 54 | + fi |
| 55 | + done |
| 56 | + |
| 57 | + if [ $attempt -gt $max_attempts ]; then |
| 58 | + echo "ERROR: Docker image not available after $max_attempts attempts" |
| 59 | + exit 1 |
| 60 | + fi |
28 | 61 | - name: Checkout datafusion-comet repo |
29 | 62 | uses: actions/checkout@v4 |
30 | 63 | with: |
|
35 | 68 | run: bash benchmark/setup_query_engine_jars.sh |
36 | 69 | - name: Run benchmark script |
37 | 70 | run: | |
38 | | - version=$(grep dataCatererVersion ../gradle.properties | cut -d= -f2) |
| 71 | + version=$(grep -E "^version=" ../gradle.properties | cut -d= -f2) |
39 | 72 | bash benchmark/run_benchmark.sh |
40 | 73 | bash benchmark/compare_benchmark_results.sh "$version" |
41 | 74 | - name: Create pull request |
|
0 commit comments