Skip to content

Commit

Permalink
Gate OSS CI workflows (pytorch#3173)
Browse files Browse the repository at this point in the history
Summary:
- Add conditionals to determine which OSS CI workflow to run based on where the repo is hosted

Pull Request resolved: pytorch#3173

Reviewed By: spcyppt

Differential Revision: D63416829

Pulled By: q10

fbshipit-source-id: b021c3d92d5f7eb4bda9fa30cb0a627da377129b
  • Loading branch information
q10 authored and facebook-github-bot committed Sep 25, 2024
1 parent 85de260 commit f656ea8
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build_wheels_linux_aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ permissions:

jobs:
generate-matrix:
if: ${{ github.repository_owner == 'pytorch' }}
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
with:
package-type: wheel
Expand All @@ -32,6 +33,7 @@ jobs:
test-infra-ref: main
with-cuda: disable
build:
if: ${{ github.repository_owner == 'pytorch' }}
needs: generate-matrix
strategy:
fail-fast: false
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/build_wheels_linux_x86.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ permissions:

jobs:
generate-matrix:
if: ${{ github.repository_owner == 'pytorch' }}
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
with:
package-type: wheel
Expand All @@ -34,6 +35,7 @@ jobs:
with-rocm: enable
with-cpu: enable
build:
if: ${{ github.repository_owner == 'pytorch' }}
needs: generate-matrix
name: pytorch/FBGEMM
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/fbgemm_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ concurrency:

jobs:
build-linux:
runs-on: ${{ matrix.host-machine.instance }}
runs-on: ${{ github.repository_owner == 'pytorch' && matrix.host-machine.instance || 'ubuntu-latest' }}
container:
image: amazonlinux:2023
options: --user root
Expand Down Expand Up @@ -105,7 +105,7 @@ jobs:
build-bazel:
runs-on: linux.12xlarge
runs-on: ${{ github.repository_owner == 'pytorch' && matrix.host-machine.instance || 'ubuntu-latest' }}
container:
image: amazonlinux:2023
options: --user root
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/fbgemm_gpu_ci_cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ concurrency:
jobs:
# Build on CPU hosts, run tests, and upload to GHA
build_artifact:
if: ${{ github.repository_owner == 'pytorch' }}
runs-on: ${{ matrix.host-machine.instance }}
container:
image: amazonlinux:2023
Expand Down Expand Up @@ -118,6 +119,7 @@ jobs:

# Download the built artifact from GHA, test on GPU, and push to PyPI
test_and_publish_artifact:
if: ${{ github.repository_owner == 'pytorch' }}
runs-on: ${{ matrix.host-machine.instance }}
container:
image: amazonlinux:2023
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/fbgemm_gpu_ci_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ concurrency:
jobs:
# Build on CPU hosts and upload to GHA
build_artifact:
if: ${{ github.repository_owner == 'pytorch' }}
runs-on: ${{ matrix.host-machine.instance }}
container:
image: amazonlinux:2023
Expand Down Expand Up @@ -127,6 +128,7 @@ jobs:

# Download the built artifact from GHA, test on GPU, and push to PyPI
test_and_publish_artifact:
if: ${{ github.repository_owner == 'pytorch' }}
# runs-on: linux.4xlarge.nvidia.gpu
# Use available instance types - https://github.com/pytorch/test-infra/blob/main/.github/scale-config.yml
runs-on: ${{ matrix.host-machine.instance }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/fbgemm_gpu_ci_genai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ concurrency:
jobs:
# Build on CPU hosts and upload to GHA
build_artifact:
if: ${{ github.repository_owner == 'pytorch' }}
runs-on: ${{ matrix.host-machine.instance }}
container:
image: amazonlinux:2023
Expand Down Expand Up @@ -127,6 +128,7 @@ jobs:

# Download the built artifact from GHA, test on GPU, and push to PyPI
test_and_publish_artifact:
if: ${{ github.repository_owner == 'pytorch' }}
# Use available instance types - https://github.com/pytorch/test-infra/blob/main/.github/scale-config.yml
runs-on: ${{ matrix.host-machine.instance }}
defaults:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/fbgemm_gpu_ci_genai_generic_infra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ concurrency:
jobs:
# Build on CPU hosts and upload to GHA
build_artifact:
if: ${{ github.repository_owner != 'pytorch' }}
runs-on: ${{ matrix.host-machine.instance }}
container:
image: amazonlinux:2023
Expand Down Expand Up @@ -116,6 +117,7 @@ jobs:

# Download the built artifact from GHA, test on GPU, and push to PyPI
test_artifact:
if: ${{ github.repository_owner != 'pytorch' }}
runs-on: ${{ matrix.host-machine.instance }}
container:
image: amazonlinux:2023
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/fbgemm_gpu_ci_rocm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ concurrency:
jobs:
# Build on CPU hosts and upload to GHA
build_artifact:
if: ${{ github.repository_owner == 'pytorch' }}
runs-on: ${{ matrix.host-machine.instance }}
container:
image: ${{ matrix.container-image }}
Expand Down Expand Up @@ -125,6 +126,7 @@ jobs:

# Download the built artifact from GHA, test on GPU, and push to PyPI
test_and_publish_artifact:
if: ${{ github.repository_owner == 'pytorch' }}
runs-on: ${{ matrix.host-machine.instance }}
container:
image: "rocm/dev-ubuntu-20.04:${{ matrix.rocm-version }}-complete"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/fbgemm_gpu_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ on:

jobs:
build-docs:
if: ${{ github.repository_owner == 'pytorch' }}
permissions:
# Grant write permission here so that the generated docs can be pushed to `gh-pages` branch
contents: write
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/fbgemm_gpu_pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ on:

jobs:
test_pypi_install_cpu:
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.fbgemm_gpu_variant_type == 'cpu') }}
if: ${{ github.repository_owner == 'pytorch' && (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.fbgemm_gpu_variant_type == 'cpu')) }}
runs-on: ${{ matrix.host-machine.instance }}
container:
image: amazonlinux:2023
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:


test_pypi_install_cuda:
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.fbgemm_gpu_variant_type == 'cuda') }}
if: ${{ github.repository_owner == 'pytorch' && (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.fbgemm_gpu_variant_type == 'cuda') }}
runs-on: ${{ matrix.host-machine.instance }}
defaults:
run:
Expand Down Expand Up @@ -165,7 +165,7 @@ jobs:


test_pypi_install_rocm:
if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.fbgemm_gpu_variant_type == 'rocm') }}
if: ${{ github.repository_owner == 'pytorch' && (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.fbgemm_gpu_variant_type == 'rocm') }}
runs-on: ${{ matrix.host-machine.instance }}
container:
image: "rocm/dev-ubuntu-20.04:${{ matrix.rocm-version }}-complete"
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/fbgemm_gpu_release_cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ concurrency:
jobs:
# Build on CPU hosts, run tests, and upload to GHA
build_artifact:
if: ${{ github.repository_owner == 'pytorch' }}
runs-on: ${{ matrix.host-machine.instance }}
container:
image: amazonlinux:2023
Expand Down Expand Up @@ -114,6 +115,7 @@ jobs:

# Download the built artifact from GHA, test on GPU, and push to PyPI
test_and_publish_artifact:
if: ${{ github.repository_owner == 'pytorch' }}
runs-on: ${{ matrix.host-machine.instance }}
container:
image: amazonlinux:2023
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/fbgemm_gpu_release_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ concurrency:
jobs:
# Build on CPU hosts and upload to GHA
build_artifact:
if: ${{ github.repository_owner == 'pytorch' }}
runs-on: ${{ matrix.host-machine.instance }}
container:
image: amazonlinux:2023
Expand Down Expand Up @@ -126,6 +127,7 @@ jobs:

# Download the built artifact from GHA, test on GPU, and push to PyPI
test_and_publish_artifact:
if: ${{ github.repository_owner == 'pytorch' }}
runs-on: ${{ matrix.host-machine.instance }}
defaults:
run:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/fbgemm_gpu_release_genai.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ concurrency:
jobs:
# Build on CPU hosts and upload to GHA
build_artifact:
if: ${{ github.repository_owner == 'pytorch' }}
runs-on: ${{ matrix.host-machine.instance }}
container:
image: amazonlinux:2023
Expand Down Expand Up @@ -126,6 +127,7 @@ jobs:

# Download the built artifact from GHA, test on GPU, and push to PyPI
test_and_publish_artifact:
if: ${{ github.repository_owner == 'pytorch' }}
runs-on: ${{ matrix.host-machine.instance }}
defaults:
run:
Expand Down

0 comments on commit f656ea8

Please sign in to comment.