From 0d8214d6c1093a18ea276bc7a415e8bbe8c9606a Mon Sep 17 00:00:00 2001 From: Huy Do Date: Mon, 11 Mar 2024 20:15:55 -0700 Subject: [PATCH 1/6] Add nightly wheel build workflows for Linux and macOS --- .github/workflows/build-wheels-linux.yml | 55 ++++++++++++++++++++++++ .github/workflows/build-wheels-m1.yml | 55 ++++++++++++++++++++++++ build/packaging/post_build_script.sh | 10 +++++ build/packaging/pre_build_script.sh | 10 +++++ build/packaging/smoke_test.py | 18 ++++++++ 5 files changed, 148 insertions(+) create mode 100644 .github/workflows/build-wheels-linux.yml create mode 100644 .github/workflows/build-wheels-m1.yml create mode 100644 build/packaging/post_build_script.sh create mode 100644 build/packaging/pre_build_script.sh create mode 100644 build/packaging/smoke_test.py diff --git a/.github/workflows/build-wheels-linux.yml b/.github/workflows/build-wheels-linux.yml new file mode 100644 index 00000000000..35a4856b431 --- /dev/null +++ b/.github/workflows/build-wheels-linux.yml @@ -0,0 +1,55 @@ +# From https://github.com/pytorch/test-infra/wiki/Using-Nova-Reusable-Build-Workflows +name: Build Linux Wheels + +on: + pull_request: + paths: + - build/packaging/** + - .github/workflows/build-wheels-linux.yml + push: + branches: + - nightly + - main + - release/* + tags: + # NOTE: Binary build pipelines should only get triggered on release candidate builds + # Release candidate tags look like: v1.11.0-rc1 + - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ + workflow_dispatch: + +jobs: + generate-matrix: + uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main + with: + package-type: wheel + os: linux + test-infra-repository: pytorch/test-infra + test-infra-ref: main + + build: + needs: generate-matrix + permissions: + id-token: write + contents: read + strategy: + fail-fast: false + matrix: + include: + - repository: pytorch/executorch + pre-script: build/packaging/pre_build_script.sh + post-script: build/packaging/post_build_script.sh + smoke-test-script: build/packaging/smoke_test.py + package-name: executorch + name: ${{ matrix.repository }} + uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main + with: + repository: ${{ matrix.repository }} + ref: "" + test-infra-repository: pytorch/test-infra + test-infra-ref: main + build-matrix: ${{ needs.generate-matrix.outputs.matrix }} + pre-script: ${{ matrix.pre-script }} + post-script: ${{ matrix.post-script }} + package-name: ${{ matrix.package-name }} + smoke-test-script: ${{ matrix.smoke-test-script }} + trigger-event: ${{ github.event_name }} diff --git a/.github/workflows/build-wheels-m1.yml b/.github/workflows/build-wheels-m1.yml new file mode 100644 index 00000000000..93486ff3d91 --- /dev/null +++ b/.github/workflows/build-wheels-m1.yml @@ -0,0 +1,55 @@ +name: Build M1 Wheels + +on: + pull_request: + paths: + - build/packaging/** + - .github/workflows/build-wheels-m1.yml + push: + branches: + - nightly + - main + - release/* + tags: + # NOTE: Binary build pipelines should only get triggered on release candidate builds + # Release candidate tags look like: v1.11.0-rc1 + - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ + workflow_dispatch: + +permissions: + id-token: write + contents: read + +jobs: + generate-matrix: + uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main + with: + package-type: wheel + os: macos-arm64 + test-infra-repository: pytorch/test-infra + test-infra-ref: main + build: + needs: generate-matrix + strategy: + fail-fast: false + matrix: + include: + - repository: pytorch/executorch + pre-script: build/packaging/pre_build_script.sh + post-script: build/packaging/post_build_script.sh + smoke-test-script: build/packaging/smoke_test.py + package-name: executorch + name: ${{ matrix.repository }} + uses: pytorch/test-infra/.github/workflows/build_wheels_macos.yml@main + with: + repository: ${{ matrix.repository }} + ref: "" + test-infra-repository: pytorch/test-infra + test-infra-ref: main + build-matrix: ${{ needs.generate-matrix.outputs.matrix }} + pre-script: ${{ matrix.pre-script }} + post-script: ${{ matrix.post-script }} + package-name: ${{ matrix.package-name }} + runner-type: macos-m1-stable + smoke-test-script: ${{ matrix.smoke-test-script }} + trigger-event: ${{ github.event_name }} diff --git a/build/packaging/post_build_script.sh b/build/packaging/post_build_script.sh new file mode 100644 index 00000000000..fd71b185651 --- /dev/null +++ b/build/packaging/post_build_script.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# Copyright (c) Meta Platforms, Inc. and affiliates. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +set -eux + +echo "This script is run after building ExecuTorch binaries" diff --git a/build/packaging/pre_build_script.sh b/build/packaging/pre_build_script.sh new file mode 100644 index 00000000000..3940168c403 --- /dev/null +++ b/build/packaging/pre_build_script.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# Copyright (c) Meta Platforms, Inc. and affiliates. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + +set -eux + +echo "This script is run before building ExecuTorch binaries" diff --git a/build/packaging/smoke_test.py b/build/packaging/smoke_test.py new file mode 100644 index 00000000000..5273a457f13 --- /dev/null +++ b/build/packaging/smoke_test.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 +# Copyright (c) Meta Platforms, Inc. and affiliates. +# All rights reserved. +# +# This source code is licensed under the BSD-style license found in the +# LICENSE file in the root directory of this source tree. + + +def main(): + """ + Run ExecuTorch binary smoke tests. This is a placeholder for future tests. See + https://github.com/pytorch/test-infra/wiki/Using-Nova-Reusable-Build-Workflows + for more information about Nova binary workflow. + """ + + +if __name__ == "__main__": + main() From 94a768a1f7d27220f2e4dc08e864d429695d20bb Mon Sep 17 00:00:00 2001 From: Huy Do Date: Mon, 11 Mar 2024 20:19:01 -0700 Subject: [PATCH 2/6] Add comments --- .github/workflows/build-wheels-m1.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-wheels-m1.yml b/.github/workflows/build-wheels-m1.yml index 93486ff3d91..f6f521e41f2 100644 --- a/.github/workflows/build-wheels-m1.yml +++ b/.github/workflows/build-wheels-m1.yml @@ -1,3 +1,4 @@ +# From https://github.com/pytorch/test-infra/wiki/Using-Nova-Reusable-Build-Workflows name: Build M1 Wheels on: From a0eda9169b34e57dc81e3c0670abebfc017e7899 Mon Sep 17 00:00:00 2001 From: Huy Do Date: Mon, 11 Mar 2024 20:22:07 -0700 Subject: [PATCH 3/6] Disable cuda and rocm builds --- .github/workflows/build-wheels-linux.yml | 2 ++ .github/workflows/build-wheels-m1.yml | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-wheels-linux.yml b/.github/workflows/build-wheels-linux.yml index 35a4856b431..3751f56da8f 100644 --- a/.github/workflows/build-wheels-linux.yml +++ b/.github/workflows/build-wheels-linux.yml @@ -25,6 +25,8 @@ jobs: os: linux test-infra-repository: pytorch/test-infra test-infra-ref: main + with-cuda: disabled + with-rocm: disabled build: needs: generate-matrix diff --git a/.github/workflows/build-wheels-m1.yml b/.github/workflows/build-wheels-m1.yml index f6f521e41f2..237adc43edf 100644 --- a/.github/workflows/build-wheels-m1.yml +++ b/.github/workflows/build-wheels-m1.yml @@ -17,10 +17,6 @@ on: - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ workflow_dispatch: -permissions: - id-token: write - contents: read - jobs: generate-matrix: uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main @@ -29,8 +25,14 @@ jobs: os: macos-arm64 test-infra-repository: pytorch/test-infra test-infra-ref: main + with-cuda: disabled + with-rocm: disabled + build: needs: generate-matrix + permissions: + id-token: write + contents: read strategy: fail-fast: false matrix: From 6b462dbbfcd39c8da7adf3b74ec93e4a9f6d369b Mon Sep 17 00:00:00 2001 From: Huy Do Date: Mon, 11 Mar 2024 20:28:42 -0700 Subject: [PATCH 4/6] Add ciflow/binaries/all label --- .github/pytorch-probot.yml | 1 + .github/workflows/build-wheels-linux.yml | 6 +++--- .github/workflows/build-wheels-m1.yml | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/pytorch-probot.yml b/.github/pytorch-probot.yml index 77725298a23..4338f495b2d 100644 --- a/.github/pytorch-probot.yml +++ b/.github/pytorch-probot.yml @@ -2,3 +2,4 @@ ciflow_push_tags: - ciflow/nightly - ciflow/trunk +- ciflow/binaries/all diff --git a/.github/workflows/build-wheels-linux.yml b/.github/workflows/build-wheels-linux.yml index 3751f56da8f..4d29122b749 100644 --- a/.github/workflows/build-wheels-linux.yml +++ b/.github/workflows/build-wheels-linux.yml @@ -12,9 +12,9 @@ on: - main - release/* tags: - # NOTE: Binary build pipelines should only get triggered on release candidate builds - # Release candidate tags look like: v1.11.0-rc1 - - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ + # NOTE: Binary build pipelines should only get triggered on release candidate builds + # Release candidate tags look like: v1.11.0-rc1 + - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ workflow_dispatch: jobs: diff --git a/.github/workflows/build-wheels-m1.yml b/.github/workflows/build-wheels-m1.yml index 237adc43edf..73f62f31960 100644 --- a/.github/workflows/build-wheels-m1.yml +++ b/.github/workflows/build-wheels-m1.yml @@ -12,9 +12,9 @@ on: - main - release/* tags: - # NOTE: Binary build pipelines should only get triggered on release candidate builds - # Release candidate tags look like: v1.11.0-rc1 - - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ + # NOTE: Binary build pipelines should only get triggered on release candidate builds + # Release candidate tags look like: v1.11.0-rc1 + - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ workflow_dispatch: jobs: From 53f4db6425973f471a59106320e2694d02a215ff Mon Sep 17 00:00:00 2001 From: Huy Do Date: Tue, 12 Mar 2024 17:22:08 -0700 Subject: [PATCH 5/6] Remove main push trigger --- .github/workflows/build-wheels-linux.yml | 2 +- .github/workflows/build-wheels-m1.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-wheels-linux.yml b/.github/workflows/build-wheels-linux.yml index 4d29122b749..a2f86b219f8 100644 --- a/.github/workflows/build-wheels-linux.yml +++ b/.github/workflows/build-wheels-linux.yml @@ -9,12 +9,12 @@ on: push: branches: - nightly - - main - release/* tags: # NOTE: Binary build pipelines should only get triggered on release candidate builds # Release candidate tags look like: v1.11.0-rc1 - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ + - ciflow/binaries/* workflow_dispatch: jobs: diff --git a/.github/workflows/build-wheels-m1.yml b/.github/workflows/build-wheels-m1.yml index 73f62f31960..dbc74433ff8 100644 --- a/.github/workflows/build-wheels-m1.yml +++ b/.github/workflows/build-wheels-m1.yml @@ -9,12 +9,12 @@ on: push: branches: - nightly - - main - release/* tags: # NOTE: Binary build pipelines should only get triggered on release candidate builds # Release candidate tags look like: v1.11.0-rc1 - v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ + - ciflow/binaries/* workflow_dispatch: jobs: From c8f49b2a5996e0db065888039368c4fd2f7765fc Mon Sep 17 00:00:00 2001 From: Huy Do Date: Tue, 12 Mar 2024 19:15:10 -0700 Subject: [PATCH 6/6] Update pytorch-probot.yml to also add ciflow/binaries --- .github/pytorch-probot.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/pytorch-probot.yml b/.github/pytorch-probot.yml index 4338f495b2d..d93e9e9cef4 100644 --- a/.github/pytorch-probot.yml +++ b/.github/pytorch-probot.yml @@ -2,4 +2,5 @@ ciflow_push_tags: - ciflow/nightly - ciflow/trunk +- ciflow/binaries - ciflow/binaries/all