|
| 1 | +name: Upload benchmark results |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + benchmark-artifact: |
| 7 | + description: The name of the benchmark artifact to upload |
| 8 | + required: true |
| 9 | + type: string |
| 10 | + benchmark-metadata: |
| 11 | + description: The benchmark metadata provided by gather-benchmark-metadata GHA |
| 12 | + required: true |
| 13 | + type: string |
| 14 | + runners-info: |
| 15 | + description: The runners info gathered by gather-runners-info GHA |
| 16 | + required: true |
| 17 | + type: string |
| 18 | + dependencies: |
| 19 | + description: The list of dependencies (not yet implemented) |
| 20 | + required: false |
| 21 | + type: string |
| 22 | + default: '{}' |
| 23 | + schema-version: |
| 24 | + default: 'v3' |
| 25 | + type: string |
| 26 | + dry-run: |
| 27 | + default: true |
| 28 | + type: boolean |
| 29 | + |
| 30 | +jobs: |
| 31 | + job: |
| 32 | + name: Uploading ${{ inputs.benchmark-artifact }} |
| 33 | + runs-on: linux.2xlarge |
| 34 | + # Keep this in case we need to use OIDC later on, so the permission is there |
| 35 | + permissions: |
| 36 | + id-token: write |
| 37 | + contents: read |
| 38 | + steps: |
| 39 | + - name: Checkout test-infra |
| 40 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 41 | + with: |
| 42 | + repository: pytorch/test-infra |
| 43 | + ref: main |
| 44 | + path: test-infra |
| 45 | + |
| 46 | + - name: Download benchmark artifacts |
| 47 | + uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7 |
| 48 | + with: |
| 49 | + name: ${{ inputs.benchmark-artifact }} |
| 50 | + path: ${{ runner.temp }}/benchmark-artifact |
| 51 | + |
| 52 | + - name: Upload benchmark results |
| 53 | + shell: bash |
| 54 | + working-directory: test-infra |
| 55 | + env: |
| 56 | + BENCHMARK_RESULTS_DIR: ${{ runner.temp }}/benchmark-artifact |
| 57 | + DRY_RUN: ${{ inputs.dry-run }} |
| 58 | + # Additional information about the benchmarks |
| 59 | + BENCHMARK_METADATA: ${{ inputs.benchmark-metadata }} |
| 60 | + RUNNERS_INFO: ${{ inputs.runners-info }} |
| 61 | + DEPENDENCIES: ${{ inputs.dependencies }} |
| 62 | + run: | |
| 63 | + set -eux |
| 64 | +
|
| 65 | + if [[ ! -d "${BENCHMARK_RESULTS_DIR}" ]]; then |
| 66 | + echo "${BENCHMARK_RESULTS_DIR} does not exist, skipping" |
| 67 | + # We don't want the job to fail if the directory doesn't exist |
| 68 | + exit 0 |
| 69 | + fi |
| 70 | +
|
| 71 | + python3 -mpip install boto3==1.35.33 |
| 72 | +
|
| 73 | + if [[ "${DRY_RUN}" == "true" ]]; then |
| 74 | + python3 ".github/scripts/upload_benchmark_results.py" \ |
| 75 | + --benchmark-results-dir "${BENCHMARK_RESULTS_DIR}" \ |
| 76 | + --metadata "${BENCHMARK_METADATA}" \ |
| 77 | + --runners "${RUNNERS_INFO}" \ |
| 78 | + --dependencies "${DEPENDENCIES}" \ |
| 79 | + --dry-run |
| 80 | + else |
| 81 | + python3 ".github/scripts/upload_benchmark_results.py" \ |
| 82 | + --benchmark-results-dir "${BENCHMARK_RESULTS_DIR}" \ |
| 83 | + --metadata "${BENCHMARK_METADATA}" \ |
| 84 | + --runners "${RUNNERS_INFO}" \ |
| 85 | + --dependencies "${DEPENDENCIES}" |
| 86 | + fi |
0 commit comments