Skip to content

Commit

Permalink
[WIP] Create build_wheels_windows.yml (pytorch#1101)
Browse files Browse the repository at this point in the history
* Create build_wheels_windows.yml

* Create vc_env_helper.bat

* Update build_wheels_windows.yml

* Update build_wheels_windows.yml

* Update vc_env_helper.bat

* Update vc_env_helper.bat

* Update vc_env_helper.bat

* Update build_wheels_windows.yml
  • Loading branch information
msaroufim authored Oct 17, 2024
1 parent 7849875 commit 7aaf0ff
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/build_wheels_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build Windows Wheels

on:
pull_request:
paths:
- build/packaging/**
- .github/workflows/build_wheels_windows.yml
- setup.py
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]+
schedule:
- cron: '0 0 * * *' # Runs at midnight UTC every day
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: windows
test-infra-repository: pytorch/test-infra
test-infra-ref: main
with-xpu: enable
with-cuda: disable

build:
needs: generate-matrix
strategy:
fail-fast: false
matrix:
include:
- repository: pytorch/ao
pre-script: packaging/pre_build_script.sh
env-script: packaging/vc_env_helper.bat
# post-script: "python packaging/wheel/relocate.py"
smoke-test-script: packaging/smoke_test.py
package-name: torchao
name: ${{ matrix.repository }}
uses: pytorch/test-infra/.github/workflows/build_wheels_windows.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 }}
env-script: ${{ matrix.env-script }}
post-script: ${{ matrix.post-script }}
package-name: ${{ matrix.package-name }}
smoke-test-script: ${{ matrix.smoke-test-script }}
trigger-event: ${{ github.event_name }}
43 changes: 43 additions & 0 deletions packaging/vc_env_helper.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
@echo on

set VC_VERSION_LOWER=17
set VC_VERSION_UPPER=18
if "%VC_YEAR%" == "2019" ( set VC_VERSION_LOWER=16 set VC_VERSION_UPPER=17)
if "%VC_YEAR%" == "2017" ( set VC_VERSION_LOWER=15 set VC_VERSION_UPPER=16)

for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -legacy -products * -version [%VC_VERSION_LOWER%^,%VC_VERSION_UPPER%^) -property installationPath`) do (
if exist "%%i" if exist "%%i\VC\Auxiliary\Build\vcvarsall.bat" (
set "VS15INSTALLDIR=%%i"
set "VS15VCVARSALL=%%i\VC\Auxiliary\Build\vcvarsall.bat"
goto vswhere
)
)

:vswhere
if "%VSDEVCMD_ARGS%" == "" (
call "%VS15VCVARSALL%" x64 || exit /b 1
) else (
call "%VS15VCVARSALL%" x64 %VSDEVCMD_ARGS% || exit /b 1
)

@echo on

if "%CU_VERSION%" == "xpu" call "C:\Program Files (x86)\Intel\oneAPI\setvars.bat"

set DISTUTILS_USE_SDK=1

set args=%1
shift
:start
if [%1] == [] goto done
set args=%args% %1
shift
goto start

:done
if "%args%" == "" (
echo Usage: vc_env_helper.bat [command] [args]
echo e.g. vc_env_helper.bat cl /c test.cpp
)

%args% || exit /b 1

0 comments on commit 7aaf0ff

Please sign in to comment.