From 7e5a841361595eaa67b6ce417fd93ec6f2153972 Mon Sep 17 00:00:00 2001 From: Huy Do Date: Wed, 13 Mar 2024 00:22:25 -0700 Subject: [PATCH] Add nightly build workflow (#2363) Summary: Onboard ExecuTorch to Nova wheel build workflow https://github.com/pytorch/test-infra/wiki/Using-Nova-Reusable-Build-Workflows. The wheel is built using `python setup.py bdist_wheel`. All the pre-build, post-build, and smoke test scripts are placeholders. Having this will enable the team to easily add more logic into the build scripts later. ### Testing * Linux wheel build https://github.com/pytorch/executorch/actions/runs/8243162791 * macOS wheel build https://github.com/pytorch/executorch/actions/runs/8243162792 Pull Request resolved: https://github.com/pytorch/executorch/pull/2363 Reviewed By: guangy10 Differential Revision: D54788737 Pulled By: huydhn fbshipit-source-id: 3b1daf8cc6949f5229cd73eedd8db26066669dfc --- .github/pytorch-probot.yml | 2 + .github/workflows/build-wheels-linux.yml | 57 +++++++++++++++++++++++ .github/workflows/build-wheels-m1.yml | 58 ++++++++++++++++++++++++ build/packaging/post_build_script.sh | 10 ++++ build/packaging/pre_build_script.sh | 10 ++++ build/packaging/smoke_test.py | 18 ++++++++ 6 files changed, 155 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/pytorch-probot.yml b/.github/pytorch-probot.yml index 77725298a2..d93e9e9cef 100644 --- a/.github/pytorch-probot.yml +++ b/.github/pytorch-probot.yml @@ -2,3 +2,5 @@ ciflow_push_tags: - ciflow/nightly - ciflow/trunk +- ciflow/binaries +- ciflow/binaries/all diff --git a/.github/workflows/build-wheels-linux.yml b/.github/workflows/build-wheels-linux.yml new file mode 100644 index 0000000000..a2f86b219f --- /dev/null +++ b/.github/workflows/build-wheels-linux.yml @@ -0,0 +1,57 @@ +# 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 + - 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: + 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 + with-cuda: disabled + with-rocm: disabled + + 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 0000000000..dbc74433ff --- /dev/null +++ b/.github/workflows/build-wheels-m1.yml @@ -0,0 +1,58 @@ +# From https://github.com/pytorch/test-infra/wiki/Using-Nova-Reusable-Build-Workflows +name: Build M1 Wheels + +on: + pull_request: + paths: + - build/packaging/** + - .github/workflows/build-wheels-m1.yml + push: + branches: + - nightly + - 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: + 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 + with-cuda: disabled + with-rocm: disabled + + 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_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 0000000000..fd71b18565 --- /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 0000000000..3940168c40 --- /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 0000000000..5273a457f1 --- /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()