From f656ea8402057f6eac169d888a521363b05772e4 Mon Sep 17 00:00:00 2001 From: Benson Ma Date: Wed, 25 Sep 2024 16:12:47 -0700 Subject: [PATCH] Gate OSS CI workflows (#3173) Summary: - Add conditionals to determine which OSS CI workflow to run based on where the repo is hosted Pull Request resolved: https://github.com/pytorch/FBGEMM/pull/3173 Reviewed By: spcyppt Differential Revision: D63416829 Pulled By: q10 fbshipit-source-id: b021c3d92d5f7eb4bda9fa30cb0a627da377129b --- .github/workflows/build_wheels_linux_aarch64.yml | 2 ++ .github/workflows/build_wheels_linux_x86.yml | 2 ++ .github/workflows/fbgemm_ci.yml | 4 ++-- .github/workflows/fbgemm_gpu_ci_cpu.yml | 2 ++ .github/workflows/fbgemm_gpu_ci_cuda.yml | 2 ++ .github/workflows/fbgemm_gpu_ci_genai.yml | 2 ++ .github/workflows/fbgemm_gpu_ci_genai_generic_infra.yml | 2 ++ .github/workflows/fbgemm_gpu_ci_rocm.yml | 2 ++ .github/workflows/fbgemm_gpu_docs.yml | 1 + .github/workflows/fbgemm_gpu_pip.yml | 6 +++--- .github/workflows/fbgemm_gpu_release_cpu.yml | 2 ++ .github/workflows/fbgemm_gpu_release_cuda.yml | 2 ++ .github/workflows/fbgemm_gpu_release_genai.yml | 2 ++ 13 files changed, 26 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_wheels_linux_aarch64.yml b/.github/workflows/build_wheels_linux_aarch64.yml index bd2f6b3de..c5e432019 100644 --- a/.github/workflows/build_wheels_linux_aarch64.yml +++ b/.github/workflows/build_wheels_linux_aarch64.yml @@ -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 @@ -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 diff --git a/.github/workflows/build_wheels_linux_x86.yml b/.github/workflows/build_wheels_linux_x86.yml index e489f0c3c..3cd06573b 100644 --- a/.github/workflows/build_wheels_linux_x86.yml +++ b/.github/workflows/build_wheels_linux_x86.yml @@ -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 @@ -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 diff --git a/.github/workflows/fbgemm_ci.yml b/.github/workflows/fbgemm_ci.yml index 3bde37d4f..220654c3e 100644 --- a/.github/workflows/fbgemm_ci.yml +++ b/.github/workflows/fbgemm_ci.yml @@ -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 @@ -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 diff --git a/.github/workflows/fbgemm_gpu_ci_cpu.yml b/.github/workflows/fbgemm_gpu_ci_cpu.yml index 1867410cc..c73939a42 100644 --- a/.github/workflows/fbgemm_gpu_ci_cpu.yml +++ b/.github/workflows/fbgemm_gpu_ci_cpu.yml @@ -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 @@ -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 diff --git a/.github/workflows/fbgemm_gpu_ci_cuda.yml b/.github/workflows/fbgemm_gpu_ci_cuda.yml index c4e499089..6a8fc5367 100644 --- a/.github/workflows/fbgemm_gpu_ci_cuda.yml +++ b/.github/workflows/fbgemm_gpu_ci_cuda.yml @@ -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 @@ -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 }} diff --git a/.github/workflows/fbgemm_gpu_ci_genai.yml b/.github/workflows/fbgemm_gpu_ci_genai.yml index 3ffdf45c0..766150821 100644 --- a/.github/workflows/fbgemm_gpu_ci_genai.yml +++ b/.github/workflows/fbgemm_gpu_ci_genai.yml @@ -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 @@ -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: diff --git a/.github/workflows/fbgemm_gpu_ci_genai_generic_infra.yml b/.github/workflows/fbgemm_gpu_ci_genai_generic_infra.yml index ef9f78ed6..7c3c699b9 100644 --- a/.github/workflows/fbgemm_gpu_ci_genai_generic_infra.yml +++ b/.github/workflows/fbgemm_gpu_ci_genai_generic_infra.yml @@ -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 @@ -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 diff --git a/.github/workflows/fbgemm_gpu_ci_rocm.yml b/.github/workflows/fbgemm_gpu_ci_rocm.yml index 14e6c41cd..2de77e4d1 100644 --- a/.github/workflows/fbgemm_gpu_ci_rocm.yml +++ b/.github/workflows/fbgemm_gpu_ci_rocm.yml @@ -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 }} @@ -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" diff --git a/.github/workflows/fbgemm_gpu_docs.yml b/.github/workflows/fbgemm_gpu_docs.yml index 5654cae45..126269fac 100644 --- a/.github/workflows/fbgemm_gpu_docs.yml +++ b/.github/workflows/fbgemm_gpu_docs.yml @@ -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 diff --git a/.github/workflows/fbgemm_gpu_pip.yml b/.github/workflows/fbgemm_gpu_pip.yml index 33125145f..ae193db15 100644 --- a/.github/workflows/fbgemm_gpu_pip.yml +++ b/.github/workflows/fbgemm_gpu_pip.yml @@ -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 @@ -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: @@ -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" diff --git a/.github/workflows/fbgemm_gpu_release_cpu.yml b/.github/workflows/fbgemm_gpu_release_cpu.yml index 51e4a9bec..f7d211601 100644 --- a/.github/workflows/fbgemm_gpu_release_cpu.yml +++ b/.github/workflows/fbgemm_gpu_release_cpu.yml @@ -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 @@ -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 diff --git a/.github/workflows/fbgemm_gpu_release_cuda.yml b/.github/workflows/fbgemm_gpu_release_cuda.yml index 9b242950e..602664fe6 100644 --- a/.github/workflows/fbgemm_gpu_release_cuda.yml +++ b/.github/workflows/fbgemm_gpu_release_cuda.yml @@ -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 @@ -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: diff --git a/.github/workflows/fbgemm_gpu_release_genai.yml b/.github/workflows/fbgemm_gpu_release_genai.yml index 33fca1f64..fd2789603 100644 --- a/.github/workflows/fbgemm_gpu_release_genai.yml +++ b/.github/workflows/fbgemm_gpu_release_genai.yml @@ -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 @@ -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: