Skip to content

Commit

Permalink
[fbgemm_gpu] Gate OSS CI workflows
Browse files Browse the repository at this point in the history
- Add conditionals to prevent pytorch-infra-based OSS CI from running when repo is hosted in a non-pytorch organization
  • Loading branch information
q10 committed Sep 25, 2024
1 parent 85de260 commit 0def525
Show file tree
Hide file tree
Showing 14 changed files with 63 additions and 9 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
8 changes: 7 additions & 1 deletion .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 Expand Up @@ -188,7 +190,11 @@ jobs:
run: . $PRELUDE; test_all_fbgemm_gpu_modules $BUILD_ENV

- name: Push Wheel to PyPI
if: ${{ (github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_to_pypi == 'true')) && matrix.compiler == 'gcc' }}
if: |
${{
(github.event_name == 'schedule' ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish_to_pypi == 'true'))
&& matrix.compiler == 'gcc' }}
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: . $PRELUDE; publish_to_pypi $BUILD_ENV "$PYPI_TOKEN" *.whl
8 changes: 7 additions & 1 deletion .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 Expand Up @@ -209,7 +211,11 @@ jobs:
run: . $PRELUDE; test_all_fbgemm_gpu_modules $BUILD_ENV

- name: Push Wheel to PyPI
if: ${{ (github.event_name == 'schedule' && matrix.cuda-version == matrix.cuda-version-publish) || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_to_pypi == 'true' && matrix.cuda-version == matrix.cuda-version-publish) }}
if: |
${{
(github.event_name == 'schedule' && matrix.cuda-version == matrix.cuda-version-publish) ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish_to_pypi == 'true' && matrix.cuda-version == matrix.cuda-version-publish)
}}
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: . $PRELUDE; publish_to_pypi $BUILD_ENV "$PYPI_TOKEN" *.whl
8 changes: 7 additions & 1 deletion .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 Expand Up @@ -208,7 +210,11 @@ jobs:
run: . $PRELUDE; test_all_fbgemm_gpu_modules $BUILD_ENV

- name: Push Wheel to PyPI
if: ${{ (github.event_name == 'schedule' && matrix.cuda-version == matrix.cuda-version-publish) || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish_to_pypi == 'true' && matrix.cuda-version == matrix.cuda-version-publish) }}
if: |
${{
(github.event_name == 'schedule' && matrix.cuda-version == matrix.cuda-version-publish) ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.publish_to_pypi == 'true' && matrix.cuda-version == matrix.cuda-version-publish)
}}
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
run: . $PRELUDE; publish_to_pypi $BUILD_ENV "$PYPI_TOKEN" *.whl
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
2 changes: 1 addition & 1 deletion .github/workflows/fbgemm_gpu_lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [ "3.11" ]
python-version: [ "3.12" ]

steps:
- name: Checkout the Repository
Expand Down
27 changes: 24 additions & 3 deletions .github/workflows/fbgemm_gpu_pip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,14 @@ 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 +111,14 @@ 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 +179,14 @@ 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 0def525

Please sign in to comment.