Skip to content

Commit 89d88ea

Browse files
committed
[Windows] Add CI wheel build jobs for Windows
ghstack-source-id: 912aad1 ghstack-comment-id: 3240461597 Pull-Request: #13837
1 parent 0c6093a commit 89d88ea

File tree

5 files changed

+109
-0
lines changed

5 files changed

+109
-0
lines changed

.ci/scripts/wheel/envvar_windows.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) Meta Platforms, Inc. and affiliates.
2+
# All rights reserved.
3+
#
4+
# This source code is licensed under the BSD-style license found in the
5+
# LICENSE file in the root directory of this source tree.
6+
7+
# This file is sourced into the environment before building a pip wheel. It
8+
# should typically only contain shell variable assignments. Be sure to export
9+
# any variables so that subprocesses will see them.
10+
11+
source "${GITHUB_WORKSPACE}/${REPOSITORY}/.ci/scripts/wheel/envvar_base.sh"

.ci/scripts/wheel/pre_build_script.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,17 @@ set -euxo pipefail
99

1010
# This script is run before building ExecuTorch binaries
1111

12+
# Enable long paths (relevant for Windows, but can run on any system).
13+
git config --system core.longpaths true
14+
15+
# Clone nested submodules for tokenizers - this is a workaround for recursive
16+
# submodule clone failing due to path length limitations on Windows. Eventually,
17+
# we should update the core job in test-infra to enable long paths before
18+
# checkout to avoid needing to do this.
19+
pushd extension/llm/tokenizers
20+
git submodule update --init
21+
popd
22+
1223
# Manually install build requirements because `python setup.py bdist_wheel` does
1324
# not install them. TODO(dbort): Switch to using `python -m build --wheel`,
1425
# which does install them. Though we'd need to disable build isolation to be

.ci/scripts/wheel/test_windows.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/usr/bin/env python
2+
# Copyright (c) Meta Platforms, Inc. and affiliates.
3+
# All rights reserved.
4+
#
5+
# This source code is licensed under the BSD-style license found in the
6+
# LICENSE file in the root directory of this source tree.
7+
8+
import test_base
9+
from examples.models import Backend, Model
10+
11+
if __name__ == "__main__":
12+
test_base.run_tests(
13+
model_tests=[
14+
test_base.ModelTest(
15+
model=Model.Mv3,
16+
backend=Backend.XnnpackQuantizationDelegation,
17+
),
18+
]
19+
)
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Build Windows Wheels
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- .ci/**/*
7+
- .github/workflows/build-wheels-windows.yml
8+
- examples/**/*
9+
- pyproject.toml
10+
- setup.py
11+
tags:
12+
- ciflow/binaries/*
13+
push:
14+
branches:
15+
- nightly
16+
- release/*
17+
tags:
18+
# NOTE: Binary build pipelines should only get triggered on release candidate builds
19+
# Release candidate tags look like: v1.11.0-rc1
20+
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+
21+
- ciflow/binaries/*
22+
workflow_dispatch:
23+
24+
jobs:
25+
generate-matrix:
26+
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
27+
with:
28+
package-type: wheel
29+
os: windows
30+
test-infra-repository: pytorch/test-infra
31+
test-infra-ref: main
32+
with-cuda: disabled
33+
with-rocm: disabled
34+
python-versions: '["3.10", "3.11", "3.12"]'
35+
36+
build:
37+
needs: generate-matrix
38+
permissions:
39+
id-token: write
40+
contents: read
41+
strategy:
42+
fail-fast: false
43+
matrix:
44+
include:
45+
- repository: pytorch/executorch
46+
pre-script: .ci/scripts/wheel/pre_build_script.sh
47+
post-script: .ci/scripts/wheel/post_build_script.sh
48+
smoke-test-script: .ci/scripts/wheel/test_windows.py
49+
package-name: executorch
50+
name: ${{ matrix.repository }}
51+
uses: pytorch/test-infra/.github/workflows/build_wheels_windows.yml@main
52+
with:
53+
repository: ${{ matrix.repository }}
54+
ref: ""
55+
test-infra-repository: pytorch/test-infra
56+
test-infra-ref: main
57+
build-matrix: ${{ needs.generate-matrix.outputs.matrix }}
58+
submodules: true
59+
pre-script: ${{ matrix.pre-script }}
60+
post-script: ${{ matrix.post-script }}
61+
package-name: ${{ matrix.package-name }}
62+
smoke-test-script: ${{ matrix.smoke-test-script }}
63+
trigger-event: ${{ github.event_name }}

third-party/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ else()
2525
set(_executorch_external_project_additional_args CMAKE_GENERATOR "Unix Makefiles")
2626
endif()
2727

28+
# DEBUG
29+
if(WIN32)
30+
set_directory_properties(PROPERTIES EP_BASE "C:\\actions-runner\\_work\\")
31+
endif()
32+
2833
# We use ExternalProject to build flatc from source to force it target the host.
2934
# Otherwise, flatc will target the project's toolchain (i.e. iOS, or Android).
3035
ExternalProject_Add(

0 commit comments

Comments
 (0)