@@ -64,22 +64,52 @@ jobs:
6464 memory : " "
6565 timeout_minutes : 60
6666
67- if : >
68- (github.event_name != 'workflow_dispatch' && matrix.profile == 'smoke') ||
69- (github.event_name == 'workflow_dispatch' && matrix.profile == inputs.profile)
70-
7167 steps :
68+ - name : Resolve run profile gate
69+ shell : bash
70+ run : |
71+ enabled=0
72+ if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then
73+ if [ "${{ matrix.profile }}" = "smoke" ]; then
74+ enabled=1
75+ fi
76+ else
77+ if [ "${{ matrix.profile }}" = "${{ inputs.profile }}" ]; then
78+ enabled=1
79+ fi
80+ fi
81+ echo "BENCH_ENABLED=$enabled" >> "$GITHUB_ENV"
82+
7283 - name : Checkout
73- uses : actions/checkout@v6
84+ if : env.BENCH_ENABLED == '1'
85+ uses : actions/checkout@v6.0.2
86+
87+ - name : Set up Python (macOS local benchmark)
88+ if : env.BENCH_ENABLED == '1' && runner.os == 'macOS'
89+ uses : actions/setup-python@v6.2.0
90+ with :
91+ python-version : " 3.13"
92+ allow-prereleases : true
93+
94+ - name : Set up uv (macOS local benchmark)
95+ if : env.BENCH_ENABLED == '1' && runner.os == 'macOS'
96+ uses : astral-sh/setup-uv@v5
97+ with :
98+ enable-cache : true
99+
100+ - name : Install dependencies (macOS local benchmark)
101+ if : env.BENCH_ENABLED == '1' && runner.os == 'macOS'
102+ run : uv sync --all-extras --dev
74103
75104 - name : Set benchmark output path
105+ if : env.BENCH_ENABLED == '1'
76106 shell : bash
77107 run : |
78108 mkdir -p .cache/benchmarks
79109 echo "BENCH_JSON=.cache/benchmarks/codeclone-benchmark-${{ matrix.label }}.json" >> "$GITHUB_ENV"
80110
81111 - name : Build and run Docker benchmark (Linux)
82- if : runner.os == 'Linux'
112+ if : env.BENCH_ENABLED == '1' && runner.os == 'Linux'
83113 env :
84114 RUNS : ${{ matrix.runs }}
85115 WARMUPS : ${{ matrix.warmups }}
90120 cp .cache/benchmarks/codeclone-benchmark.json "$BENCH_JSON"
91121
92122 - name : Run local benchmark (macOS)
93- if : runner.os == 'macOS'
123+ if : env.BENCH_ENABLED == '1' && runner.os == 'macOS'
94124 run : |
95125 uv run python benchmarks/run_benchmark.py \
96126 --target . \
@@ -100,7 +130,7 @@ jobs:
100130 --output "$BENCH_JSON"
101131
102132 - name : Print benchmark summary
103- if : always()
133+ if : env.BENCH_ENABLED == '1'
104134 shell : bash
105135 run : |
106136 python - <<'PY'
@@ -184,9 +214,13 @@ jobs:
184214 fh.write("\n".join(lines) + "\n")
185215 PY
186216
217+ - name : Skip non-selected profile
218+ if : env.BENCH_ENABLED != '1'
219+ run : echo "Skipping matrix profile '${{ matrix.profile }}' for event '${{ github.event_name }}'"
220+
187221 - name : Upload benchmark artifact
188- if : always()
189- uses : actions/upload-artifact@v7
222+ if : env.BENCH_ENABLED == '1'
223+ uses : actions/upload-artifact@v4
190224 with :
191225 name : codeclone-benchmark-${{ matrix.label }}
192226 path : ${{ env.BENCH_JSON }}
0 commit comments