|
98 | 98 |
|
99 | 99 | echo "benchmark_configs is: ${{ steps.set-parameters.outputs.benchmark_configs }}"
|
100 | 100 |
|
| 101 | + prepare-test-specs: |
| 102 | + runs-on: linux.2xlarge |
| 103 | + needs: set-parameters |
| 104 | + strategy: |
| 105 | + matrix: ${{ fromJson(needs.set-parameters.outputs.benchmark_configs) }} |
| 106 | + fail-fast: false |
| 107 | + steps: |
| 108 | + - uses: actions/checkout@v3 |
| 109 | + |
| 110 | + - name: Prepare the spec |
| 111 | + id: prepare |
| 112 | + shell: bash |
| 113 | + env: |
| 114 | + BENCHMARK_CONFIG: ${{ toJSON(matrix) }} |
| 115 | + working-directory: extension/benchmark/apple/Benchmark |
| 116 | + run: | |
| 117 | + set -eux |
| 118 | +
|
| 119 | + # The model will be exported in the next step to this S3 path |
| 120 | + MODEL_PATH="https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/${{ matrix.model }}_${{ matrix.config }}/model.zip" |
| 121 | + # We could write a script to properly use jinja here, but there is only one variable, |
| 122 | + # so let's just sed it |
| 123 | + sed -i -e 's,{{ model_path }},'"${MODEL_PATH}"',g' default-ios-device-farm-appium-test-spec.yml.j2 |
| 124 | +
|
| 125 | + BENCHMARK_CONFIG_ID=$(echo "${{ matrix.model }}_${{ matrix.config }}" | sed -e 's/[^A-Za-z0-9._-]/_/g') |
| 126 | + # The config for this benchmark runs, we save it in the test spec so that it can be fetched |
| 127 | + # later by the upload script |
| 128 | + sed -i -e 's,{{ benchmark_config_id }},'"${BENCHMARK_CONFIG_ID}"',g' default-ios-device-farm-appium-test-spec.yml.j2 |
| 129 | +
|
| 130 | + cp default-ios-device-farm-appium-test-spec.yml.j2 default-ios-device-farm-appium-test-spec.yml |
| 131 | + # Just print the test spec for debugging |
| 132 | + cat default-ios-device-farm-appium-test-spec.yml |
| 133 | +
|
| 134 | + # Save the benchmark configs so that we can use it later in the dashboard |
| 135 | + echo "${BENCHMARK_CONFIG}" > "${BENCHMARK_CONFIG_ID}.json" |
| 136 | + echo "benchmark-config-id=${BENCHMARK_CONFIG_ID}" >> $GITHUB_OUTPUT |
| 137 | +
|
| 138 | + - name: Upload the spec |
| 139 | + uses: seemethere/upload-artifact-s3@v5 |
| 140 | + with: |
| 141 | + s3-bucket: gha-artifacts |
| 142 | + s3-prefix: | |
| 143 | + ${{ github.repository }}/${{ github.run_id }}/artifacts/${{ matrix.model }}_${{ matrix.config }} |
| 144 | + retention-days: 1 |
| 145 | + if-no-files-found: error |
| 146 | + path: extension/benchmark/apple/Benchmark/default-ios-device-farm-appium-test-spec.yml |
| 147 | + |
| 148 | + - name: Update the benchmark configs |
| 149 | + uses: seemethere/upload-artifact-s3@v5 |
| 150 | + with: |
| 151 | + s3-bucket: gha-artifacts |
| 152 | + s3-prefix: | |
| 153 | + ${{ github.repository }}/${{ github.run_id }}/artifacts/benchmark-configs/ |
| 154 | + retention-days: 1 |
| 155 | + if-no-files-found: error |
| 156 | + path: extension/benchmark/apple/Benchmark/${{ steps.prepare.outputs.benchmark-config-id }}.json |
| 157 | + |
101 | 158 | export-models:
|
102 | 159 | name: export-models
|
103 | 160 | uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
|
@@ -287,68 +344,6 @@ jobs:
|
287 | 344 | fi
|
288 | 345 | echo "::endgroup::"
|
289 | 346 |
|
290 |
| - prepare-test-specs: |
291 |
| - runs-on: linux.2xlarge |
292 |
| - needs: |
293 |
| - - set-parameters |
294 |
| - - export-models |
295 |
| - strategy: |
296 |
| - matrix: ${{ fromJson(needs.set-parameters.outputs.benchmark_configs) }} |
297 |
| - fail-fast: false |
298 |
| - steps: |
299 |
| - - uses: actions/checkout@v3 |
300 |
| - |
301 |
| - - name: Prepare the spec |
302 |
| - id: prepare |
303 |
| - shell: bash |
304 |
| - env: |
305 |
| - BENCHMARK_CONFIG: ${{ toJSON(matrix) }} |
306 |
| - working-directory: extension/benchmark/apple/Benchmark |
307 |
| - run: | |
308 |
| - set -eux |
309 |
| -
|
310 |
| - # The model will be exported in the next step to this S3 path |
311 |
| - MODEL_PATH="https://gha-artifacts.s3.amazonaws.com/${{ github.repository }}/${{ github.run_id }}/artifacts/${{ matrix.model }}_${{ matrix.config }}/model.zip" |
312 |
| - # Check if the model artifact exists, fail this step skip generating test-spec. |
313 |
| - curl -s --head -f ${MODEL_PATH} |
314 |
| - # We could write a script to properly use jinja here, but there is only one variable, |
315 |
| - # so let's just sed it |
316 |
| - sed -i -e 's,{{ model_path }},'"${MODEL_PATH}"',g' default-ios-device-farm-appium-test-spec.yml.j2 |
317 |
| -
|
318 |
| - BENCHMARK_CONFIG_ID=$(echo "${{ matrix.model }}_${{ matrix.config }}" | sed -e 's/[^A-Za-z0-9._-]/_/g') |
319 |
| - # The config for this benchmark runs, we save it in the test spec so that it can be fetched |
320 |
| - # later by the upload script |
321 |
| - sed -i -e 's,{{ benchmark_config_id }},'"${BENCHMARK_CONFIG_ID}"',g' default-ios-device-farm-appium-test-spec.yml.j2 |
322 |
| -
|
323 |
| - cp default-ios-device-farm-appium-test-spec.yml.j2 default-ios-device-farm-appium-test-spec.yml |
324 |
| - # Just print the test spec for debugging |
325 |
| - cat default-ios-device-farm-appium-test-spec.yml |
326 |
| -
|
327 |
| - # Save the benchmark configs so that we can use it later in the dashboard |
328 |
| - echo "${BENCHMARK_CONFIG}" > "${BENCHMARK_CONFIG_ID}.json" |
329 |
| - echo "benchmark-config-id=${BENCHMARK_CONFIG_ID}" >> $GITHUB_OUTPUT |
330 |
| -
|
331 |
| - - name: Upload the spec |
332 |
| - uses: seemethere/upload-artifact-s3@v5 |
333 |
| - with: |
334 |
| - s3-bucket: gha-artifacts |
335 |
| - s3-prefix: | |
336 |
| - ${{ github.repository }}/${{ github.run_id }}/artifacts/${{ matrix.model }}_${{ matrix.config }} |
337 |
| - retention-days: 1 |
338 |
| - if-no-files-found: error |
339 |
| - path: extension/benchmark/apple/Benchmark/default-ios-device-farm-appium-test-spec.yml |
340 |
| - |
341 |
| - - name: Update the benchmark configs |
342 |
| - uses: seemethere/upload-artifact-s3@v5 |
343 |
| - with: |
344 |
| - s3-bucket: gha-artifacts |
345 |
| - s3-prefix: | |
346 |
| - ${{ github.repository }}/${{ github.run_id }}/artifacts/benchmark-configs/ |
347 |
| - retention-days: 1 |
348 |
| - if-no-files-found: error |
349 |
| - path: extension/benchmark/apple/Benchmark/${{ steps.prepare.outputs.benchmark-config-id }}.json |
350 |
| - |
351 |
| - |
352 | 347 | build-benchmark-app:
|
353 | 348 | name: build-benchmark-app
|
354 | 349 | uses: pytorch/test-infra/.github/workflows/macos_job.yml@main
|
|
0 commit comments