| name: mac-test |
| |
| on: |
| workflow_call: |
| inputs: |
| build-environment: |
| required: true |
| type: string |
| description: Top-level label for what's being built/tested. |
| test-matrix: |
| required: true |
| type: string |
| description: JSON description of what test configs to run. |
| |
| secrets: |
| AWS_OSSCI_METRICS_V2_ACCESS_KEY_ID: |
| required: true |
| description: access key id for test stats upload |
| AWS_OSSCI_METRICS_V2_SECRET_ACCESS_KEY: |
| required: true |
| description: secret acess key for test stats upload |
| |
| env: |
| IN_CI: 1 # TODO delete in favor of GITHUB_ACTIONS |
| IS_GHA: 1 # TODO delete in favor of GITHUB_ACTIONS |
| |
| # For setup-miniconda, see https://github.com/conda-incubator/setup-miniconda/issues/179 |
| defaults: |
| run: |
| shell: bash -e -l {0} |
| |
| jobs: |
| test: |
| # Don't run on forked repos. |
| if: github.repository_owner == 'pytorch' |
| strategy: |
| matrix: ${{ fromJSON(inputs.test-matrix) }} |
| fail-fast: false |
| runs-on: ${{ matrix.runner }} |
| timeout-minutes: 240 |
| env: |
| GIT_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} |
| BUILD_ENVIRONMENT: ${{ inputs.build-environment }} |
| COMPACT_JOB_NAME: ${{ inputs.build-environment }} |
| JOB_BASE_NAME: ${{ inputs.build-environment }}-test |
| TEST_CONFIG: ${{ matrix.config }} |
| SHARD_NUMBER: ${{ matrix.shard }} |
| NUM_TEST_SHARDS: ${{ matrix.num_shards }} |
| PR_BODY: ${{ github.event.pull_request.body }} |
| PYTORCH_RETRY_TEST_CASES: 1 |
| steps: |
| # [see note: pytorch repo ref] |
| - name: Checkout PyTorch |
| uses: pytorch/pytorch/.github/actions/checkout-pytorch@master |
| |
| - name: Download build artifacts |
| uses: ./.github/actions/download-build-artifacts |
| with: |
| name: ${{ inputs.build-environment }} |
| use-gha: true |
| |
| - name: Setup miniconda |
| uses: conda-incubator/setup-miniconda@v2 |
| with: |
| auto-update-conda: true |
| python-version: 3.8 |
| activate-environment: build |
| |
| - name: Install macOS homebrew dependencies |
| run: | |
| # Install dependencies |
| brew install libomp |
| |
| - name: Parse ref |
| id: parse-ref |
| run: .github/scripts/parse_ref.py |
| |
| - name: Test |
| run: | |
| COMMIT_MESSAGES=$(git cherry -v "origin/${GIT_DEFAULT_BRANCH:-master}") |
| export COMMIT_MESSAGES |
| python3 -mpip install dist/*.whl |
| .jenkins/pytorch/macos-test.sh |
| |
| - name: Get workflow job id |
| id: get-job-id |
| uses: pytorch/pytorch/.github/actions/get-workflow-job-id@master |
| if: always() |
| with: |
| github-token: ${{ secrets.GITHUB_TOKEN }} |
| |
| - name: Upload test artifacts |
| uses: ./.github/actions/upload-test-artifacts |
| if: always() |
| with: |
| use-gha: true |
| file-suffix: ${{ github.job }}-${{ matrix.config }}-${{ matrix.shard }}-${{ matrix.num_shards }}-${{ matrix.runner }}_${{ steps.get-job-id.outputs.job-id }} |
| |
| - name: Upload test statistics |
| if: always() |
| env: |
| AWS_DEFAULT_REGION: us-east-1 |
| GIT_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} |
| BRANCH: ${{ steps.parse-ref.outputs.branch }} |
| JOB_BASE_NAME: ${{ inputs.build-environment }}-test |
| BUILD_ENVIRONMENT: ${{ inputs.build-environment }} |
| PR_NUMBER: ${{ github.event.pull_request.number }} |
| SHA1: ${{ github.event.pull_request.head.sha || github.sha }} |
| TAG: ${{ steps.parse-ref.outputs.tag }} |
| WORKFLOW_ID: ${{ github.run_id }} |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| AWS_ACCESS_KEY_ID: ${{ secrets.AWS_OSSCI_METRICS_V2_ACCESS_KEY_ID }} |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_OSSCI_METRICS_V2_SECRET_ACCESS_KEY }} |
| GHA_WORKFLOW_JOB_ID: ${{ steps.get-job-id.outputs.job-id }} |
| shell: bash |
| run: | |
| set -x |
| python3 -m pip install -r requirements.txt |
| python3 -m pip install boto3==1.19.12 |
| python3 -m tools.stats.print_test_stats --upload-to-s3 --compare-with-s3 test |