Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions .github/workflows/_mac-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,21 @@ on:
default: "3.8"
description: |
The python version to be used. Will be 3.8 by default
test-matrix:
required: false
type: string
description: |
An option JSON description of what test configs to run later on. This
is moved here from the Linux test workflow so that we can apply filter
logic using test-config labels earlier and skip unnecessary builds

outputs:
test-matrix:
value: ${{ inputs.test-matrix }}
description: An optional JSON description of what test configs to run later on.
build-outcome:
value: ${{ jobs.build.outputs.build-outcome }}
description: The outcome of the build step. This is used to influence test filtering logic later on.

secrets:
MACOS_SCCACHE_S3_ACCESS_KEY_ID:
Expand All @@ -52,6 +67,8 @@ jobs:
AWS_ACCESS_KEY_ID: ${{ secrets.MACOS_SCCACHE_S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.MACOS_SCCACHE_S3_SECRET_ACCESS_KEY }}
BUILD_ENVIRONMENT: ${{ inputs.build-environment }}
outputs:
build-outcome: ${{ steps.build.outcome }}
steps:
# [see note: pytorch repo ref]
- name: Checkout PyTorch
Expand Down Expand Up @@ -90,21 +107,31 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}

# Apply the filter logic to the build step too if the test-config label is already there
- name: Select all requested test configurations (if the test matrix is available)
id: filter
uses: ./.github/actions/filter-test-configs
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
test-matrix: ${{ inputs.test-matrix }}

- name: Build
if: steps.filter.outputs.is-test-matrix-empty == 'False' || inputs.test-matrix == ''
id: build
env:
OUR_GITHUB_JOB_ID: ${{ steps.get-job-id.outputs.job-id }}
run: |
echo "CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname "$(which conda)")/../"}" >> "${GITHUB_ENV}"
${CONDA_RUN} .jenkins/pytorch/macos-build.sh

- name: Archive artifacts into zip
if: inputs.build-generates-artifacts
if: inputs.build-generates-artifacts && steps.build.outcome != 'skipped'
run: |
zip -1 -r artifacts.zip dist/ build/.ninja_log build/compile_commands.json .pytorch-test-times.json

- name: Store PyTorch Build Artifacts on GHA
uses: actions/upload-artifact@v2
if: inputs.build-generates-artifacts
if: inputs.build-generates-artifacts && steps.build.outcome != 'skipped'
with:
name: ${{ env.BUILD_ENVIRONMENT }}
retention-days: 14
Expand All @@ -114,7 +141,7 @@ jobs:
- name: Upload sccache stats to GHA
uses: actions/upload-artifact@v2
# Only if sccache is installed, see above
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository }}
if: ${{ (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && steps.build.outcome != 'skipped' }}
with:
name: sccache-stats-${{ inputs.build-environment }}-runattempt${{ github.run_attempt }}-${{ steps.get-job-id.outputs.job-id }}
retention-days: 14
Expand Down
28 changes: 25 additions & 3 deletions .github/workflows/_mac-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,38 @@ on:
description: secret acess key for test stats upload

jobs:
# This needs to be run right before the test starts so that it can gather the
# latest labels from the PR
filter:
runs-on: [self-hosted, linux.large]
outputs:
test-matrix: ${{ steps.filter.outputs.test-matrix }}
is-test-matrix-empty: ${{ steps.filter.outputs.is-test-matrix-empty }}
steps:
- name: Checkout PyTorch
uses: pytorch/pytorch/.github/actions/checkout-pytorch@master
with:
fetch-depth: 1
submodules: false

- name: Select all requested test configurations
id: filter
uses: ./.github/actions/filter-test-configs
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
test-matrix: ${{ inputs.test-matrix }}

test:
# Don't run on forked repos.
if: github.repository_owner == 'pytorch'
needs: filter
# Don't run on forked repos or empty test matrix
if: github.repository_owner == 'pytorch' && needs.filter.outputs.is-test-matrix-empty == 'False'
# For setup-miniconda, see https://github.com/conda-incubator/setup-miniconda/issues/179
# Also ensure that we always run with the right architecture
defaults:
run:
shell: arch -arch ${{ inputs.arch }} bash -e -l {0}
strategy:
matrix: ${{ fromJSON(inputs.test-matrix) }}
matrix: ${{ fromJSON(needs.filter.outputs.test-matrix) }}
fail-fast: false
runs-on: ${{ matrix.runner }}
timeout-minutes: 240
Expand Down
25 changes: 14 additions & 11 deletions .github/workflows/trunk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ jobs:
xcode-version: "13.3.1"
runner-type: macos-12-xl
build-generates-artifacts: true
test-matrix: |
{ include: [
{ config: "default", shard: 1, num_shards: 2, runner: "macos-12" },
{ config: "default", shard: 2, num_shards: 2, runner: "macos-12" },
{ config: "functorch", shard: 1, num_shards: 1, runner: "macos-12" },
]}
secrets:
MACOS_SCCACHE_S3_ACCESS_KEY_ID: ${{ secrets.MACOS_SCCACHE_S3_ACCESS_KEY_ID }}
MACOS_SCCACHE_S3_SECRET_ACCESS_KEY: ${{ secrets.MACOS_SCCACHE_S3_SECRET_ACCESS_KEY }}
Expand All @@ -151,12 +157,7 @@ jobs:
needs: macos-12-py3-x86-64-build
with:
build-environment: macos-12-py3-x86-64
test-matrix: |
{ include: [
{ config: "default", shard: 1, num_shards: 2, runner: "macos-12" },
{ config: "default", shard: 2, num_shards: 2, runner: "macos-12" },
{ config: "functorch", shard: 1, num_shards: 1, runner: "macos-12" },
]}
test-matrix: ${{ needs.macos-12-py3-x86-64-build.outputs.test-matrix }}
arch: x86_64
secrets:
AWS_OSSCI_METRICS_V2_ACCESS_KEY_ID: ${{ secrets.AWS_OSSCI_METRICS_V2_ACCESS_KEY_ID }}
Expand Down Expand Up @@ -185,6 +186,11 @@ jobs:
build-generates-artifacts: true
# To match the one pre-installed in the m1 runners
python_version: 3.9.12
test-matrix: |
{ include: [
{ config: "default", shard: 1, num_shards: 2, runner: "macos-m1-12" },
{ config: "default", shard: 2, num_shards: 2, runner: "macos-m1-12" },
]}
secrets:
MACOS_SCCACHE_S3_ACCESS_KEY_ID: ${{ secrets.MACOS_SCCACHE_S3_ACCESS_KEY_ID }}
MACOS_SCCACHE_S3_SECRET_ACCESS_KEY: ${{ secrets.MACOS_SCCACHE_S3_SECRET_ACCESS_KEY }}
Expand All @@ -193,6 +199,7 @@ jobs:
name: macos-12-py3-arm64-mps
uses: ./.github/workflows/_mac-test-mps.yml
needs: macos-12-py3-arm64-build
if: needs.macos-12-py3-arm64-build.outputs.build-outcome == 'success'
with:
sync-tag: macos-12-py3-arm64-mps-test
build-environment: macos-12-py3-arm64
Expand All @@ -203,11 +210,7 @@ jobs:
needs: macos-12-py3-arm64-build
with:
build-environment: macos-12-py3-arm64
test-matrix: |
{ include: [
{ config: "default", shard: 1, num_shards: 2, runner: "macos-m1-12" },
{ config: "default", shard: 2, num_shards: 2, runner: "macos-m1-12" },
]}
test-matrix: ${{ needs.macos-12-py3-arm64-build.outputs.test-matrix }}
arch: arm64
secrets:
AWS_OSSCI_METRICS_V2_ACCESS_KEY_ID: ${{ secrets.AWS_OSSCI_METRICS_V2_ACCESS_KEY_ID }}
Expand Down