1name: Upload test stats 2 3on: 4 workflow_run: 5 workflows: [pull, trunk, periodic, inductor, unstable, slow, unstable-periodic, inductor-periodic, rocm, inductor-micro-benchmark] 6 types: 7 - completed 8 9jobs: 10 # the conclusion field in the github context is sometimes null 11 # solution adapted from https://github.com/community/community/discussions/21090#discussioncomment-3226271 12 get_workflow_conclusion: 13 if: github.repository_owner == 'pytorch' 14 runs-on: ubuntu-latest 15 outputs: 16 conclusion: ${{ fromJson(steps.get_conclusion.outputs.data).conclusion }} 17 steps: 18 - name: Get workflow run conclusion 19 uses: octokit/request-action@v2.1.0 20 id: get_conclusion 21 with: 22 route: GET /repos/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }}/attempts/${{ github.event.workflow_run.run_attempt }} 23 env: 24 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 25 26 upload-test-stats: 27 needs: get_workflow_conclusion 28 if: 29 github.repository_owner == 'pytorch' && 30 (github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == 'failure' || 31 needs.get_workflow_conclusion.outputs.conclusion == 'success' || needs.get_workflow_conclusion.outputs.conclusion == 'failure') 32 runs-on: ubuntu-22.04 33 environment: upload-stats 34 name: Upload test stats for ${{ github.event.workflow_run.id }}, attempt ${{ github.event.workflow_run.run_attempt }} 35 steps: 36 - name: Print workflow information 37 env: 38 TRIGGERING_WORKFLOW: ${{ toJSON(github.event.workflow_run) }} 39 run: echo "${TRIGGERING_WORKFLOW}" 40 41 - name: Checkout PyTorch 42 uses: pytorch/pytorch/.github/actions/checkout-pytorch@release/2.4 43 44 - uses: actions/setup-python@v4 45 with: 46 python-version: '3.11' 47 cache: pip 48 49 - run: | 50 pip3 install requests==2.32.2 rockset==1.0.3 boto3==1.19.12 51 52 - name: Upload test artifacts 53 id: upload-s3 54 env: 55 AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} 56 AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 57 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 58 WORKFLOW_ARTIFACTS_URL: ${{ github.event.workflow_run.artifacts_url }} 59 WORKFLOW_RUN_ID: ${{ github.event.workflow_run.id }} 60 WORKFLOW_RUN_ATTEMPT: ${{ github.event.workflow_run.run_attempt }} 61 REPO_FULLNAME: ${{ github.event.workflow_run.repository.full_name }} 62 run: | 63 echo "${WORKFLOW_ARTIFACTS_URL}" 64 65 # Note that in the case of Linux and Windows, their artifacts have already been uploaded to S3, so there simply won't be 66 # anything on GitHub to upload. The command should return right away 67 python3 -m tools.stats.upload_artifacts --workflow-run-id "${WORKFLOW_RUN_ID}" --workflow-run-attempt "${WORKFLOW_RUN_ATTEMPT}" --repo "${REPO_FULLNAME}" 68 69 - name: Upload test stats 70 env: 71 ROCKSET_API_KEY: ${{ secrets.ROCKSET_API_KEY }} 72 AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} 73 AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 74 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 75 WORKFLOW_RUN_ID: ${{ github.event.workflow_run.id }} 76 WORKFLOW_RUN_ATTEMPT: ${{ github.event.workflow_run.run_attempt }} 77 WORKFLOW_URL: ${{ github.event.workflow_run.html_url }} 78 HEAD_REPOSITORY: ${{ github.event.workflow_run.head_repository.full_name }} 79 HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }} 80 run: | 81 echo "${WORKFLOW_URL}" 82 python3 -m tools.stats.upload_test_stats --workflow-run-id "${WORKFLOW_RUN_ID}" --workflow-run-attempt "${WORKFLOW_RUN_ATTEMPT}" --head-branch "${HEAD_BRANCH}" --head-repository "${HEAD_REPOSITORY}" 83 python3 -m tools.stats.upload_sccache_stats --workflow-run-id "${WORKFLOW_RUN_ID}" --workflow-run-attempt "${WORKFLOW_RUN_ATTEMPT}" 84 85 - name: Analyze disabled tests rerun 86 env: 87 AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} 88 AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 89 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 90 WORKFLOW_ARTIFACTS_URL: ${{ github.event.workflow_run.artifacts_url }} 91 WORKFLOW_RUN_ID: ${{ github.event.workflow_run.id }} 92 WORKFLOW_RUN_ATTEMPT: ${{ github.event.workflow_run.run_attempt }} 93 REPO_FULLNAME: ${{ github.event.workflow_run.repository.full_name }} 94 run: | 95 # Analyze the results from disable tests rerun and upload them to S3 96 python3 -m tools.stats.check_disabled_tests --workflow-run-id "${WORKFLOW_RUN_ID}" --workflow-run-attempt "${WORKFLOW_RUN_ATTEMPT}" --repo "${REPO_FULLNAME}" 97 98 - name: Upload gpt-fast benchmark results to Rockset 99 if: steps.upload-s3.outcome && steps.upload-s3.outcome == 'success' && github.event.workflow_run.name == 'inductor-micro-benchmark' 100 env: 101 ROCKSET_API_KEY: ${{ secrets.ROCKSET_API_KEY }} 102 AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} 103 AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} 104 WORKFLOW_RUN_ID: ${{ github.event.workflow_run.id }} 105 WORKFLOW_RUN_ATTEMPT: ${{ github.event.workflow_run.run_attempt }} 106 REPO_FULLNAME: ${{ github.event.workflow_run.repository.full_name }} 107 HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }} 108 run: | 109 python3 -m tools.stats.upload_dynamo_perf_stats --workflow-run-id "${WORKFLOW_RUN_ID}" --workflow-run-attempt "${WORKFLOW_RUN_ATTEMPT}" --repo "${REPO_FULLNAME}" --head-branch "${HEAD_BRANCH}" --rockset-collection oss_ci_benchmark --rockset-workspace benchmarks --match-filename "^gpt_fast_benchmark" 110 111 check-api-rate: 112 if: ${{ always() && github.repository_owner == 'pytorch' }} 113 runs-on: ubuntu-latest 114 continue-on-error: true 115 steps: 116 - name: Get our GITHUB_TOKEN API limit usage 117 env: 118 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 119 run: | 120 curl -H "Accept: application/vnd.github.v3+json" -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/rate_limit 121