Skip to content

Draft - Test Workflow arm64 logic #6369

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 126 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
561e93b
add scripts and workflow for Windows arm64 audio & vision wheels
alinpahontu2912 Feb 28, 2025
795975b
Merge branch 'pytorch:main' into winarm64_wheels
alinpahontu2912 Mar 3, 2025
7293512
fix workflow_call
alinpahontu2912 Mar 3, 2025
001d221
Merge branch 'winarm64_wheels' of https://github.com/alinpahontu2912/…
alinpahontu2912 Mar 3, 2025
07893bb
update runner name
alinpahontu2912 Mar 3, 2025
c9a8eb5
update permissions
alinpahontu2912 Mar 3, 2025
30f6472
use arm64 logic for building x64 dummy wheel
alinpahontu2912 Mar 3, 2025
af3fa0a
remove run_id reference for now
alinpahontu2912 Mar 3, 2025
e6cba57
fix path
alinpahontu2912 Mar 3, 2025
0553118
update powershell run command
alinpahontu2912 Mar 3, 2025
378372d
update path and input variable name
alinpahontu2912 Mar 3, 2025
44c0a56
update paths
alinpahontu2912 Mar 3, 2025
a3d2e53
fix elseif
alinpahontu2912 Mar 3, 2025
dc5367f
update Source dir path and pwsh calls
alinpahontu2912 Mar 3, 2025
8d0979b
fix typo
alinpahontu2912 Mar 3, 2025
2bdf110
fix powershell call
alinpahontu2912 Mar 3, 2025
02a0171
modify dummy path
alinpahontu2912 Mar 3, 2025
872de95
add debug prints
alinpahontu2912 Mar 3, 2025
c181fdb
add extra print debug
alinpahontu2912 Mar 3, 2025
4d9015d
update print path
alinpahontu2912 Mar 3, 2025
4c228e2
add more debugging
alinpahontu2912 Mar 3, 2025
463d419
update build commands
alinpahontu2912 Mar 4, 2025
c28b11e
fix slashes
alinpahontu2912 Mar 4, 2025
7d9b069
fix script calls
alinpahontu2912 Mar 4, 2025
b119236
fix scripts path
alinpahontu2912 Mar 4, 2025
a592273
Add debug prints
alinpahontu2912 Mar 4, 2025
9e43873
update git shell commands
alinpahontu2912 Mar 4, 2025
3b31cbf
add debug path step
alinpahontu2912 Mar 4, 2025
f13efc7
checkout test-infra changes
alinpahontu2912 Mar 4, 2025
520d9d0
fix scripts path
alinpahontu2912 Mar 4, 2025
15da107
update path
alinpahontu2912 Mar 4, 2025
255068a
update path
alinpahontu2912 Mar 4, 2025
31f5074
fix repository name extraction
alinpahontu2912 Mar 4, 2025
1edb9ab
debug print
alinpahontu2912 Mar 4, 2025
431ca50
add more debugging
alinpahontu2912 Mar 4, 2025
9aef78f
set bash shell
alinpahontu2912 Mar 4, 2025
8c0536e
test hardcode dir path
alinpahontu2912 Mar 4, 2025
f605dc0
test
alinpahontu2912 Mar 4, 2025
07ea151
test new path
alinpahontu2912 Mar 4, 2025
4cfff7d
slashes test
alinpahontu2912 Mar 4, 2025
c12f43e
test
alinpahontu2912 Mar 4, 2025
9ed5e1d
test debug script
alinpahontu2912 Mar 4, 2025
2f330ce
test script
alinpahontu2912 Mar 4, 2025
8cfb3f7
test
alinpahontu2912 Mar 4, 2025
448af36
change ops order
alinpahontu2912 Mar 4, 2025
8bb3daa
change to cmd shell and minor updates
alinpahontu2912 Mar 4, 2025
f065c87
test remove infra dir
alinpahontu2912 Mar 4, 2025
102cac4
fix typo
alinpahontu2912 Mar 4, 2025
0b8a6d5
test
alinpahontu2912 Mar 4, 2025
34fc48d
update checkout paths
alinpahontu2912 Mar 4, 2025
3e36f84
update bootstrap_git script
alinpahontu2912 Mar 4, 2025
4945fc2
test git bootstrap script
alinpahontu2912 Mar 4, 2025
c522220
update path test
alinpahontu2912 Mar 4, 2025
4830077
change dependenceis/downoads path
alinpahontu2912 Mar 4, 2025
825e041
test change env variables
alinpahontu2912 Mar 4, 2025
78693cd
test build script
alinpahontu2912 Mar 4, 2025
711505c
change shell to cmd
alinpahontu2912 Mar 4, 2025
c46e76c
test
alinpahontu2912 Mar 4, 2025
783f83c
fix path
alinpahontu2912 Mar 4, 2025
e6c5caf
fix links
alinpahontu2912 Mar 5, 2025
3379b83
reenable steps and change to bash shell
alinpahontu2912 Mar 5, 2025
07757fd
retry build script only
alinpahontu2912 Mar 5, 2025
7ed1e78
correctly set environment
alinpahontu2912 Mar 5, 2025
042eb0e
update build script
alinpahontu2912 Mar 5, 2025
2154383
test no venv
alinpahontu2912 Mar 5, 2025
edacacf
debug prints
alinpahontu2912 Mar 5, 2025
a8800b7
test remove unnecessary lines
alinpahontu2912 Mar 5, 2025
4f2965a
reorder inputs and delete debug print
alinpahontu2912 Mar 5, 2025
5b464ea
Merge branch 'pytorch:main' into x64windows_test
alinpahontu2912 Mar 6, 2025
2b97c09
test
alinpahontu2912 Apr 2, 2025
0f3d73a
Merge branch 'x64windows_test' of https://github.com/alinpahontu2912/…
alinpahontu2912 Apr 2, 2025
73619ce
test
alinpahontu2912 Apr 4, 2025
d9ff73d
update workflow for x64
alinpahontu2912 Apr 4, 2025
7dbdd7c
change steps order
alinpahontu2912 Apr 4, 2025
6808a42
update repo name extraction
alinpahontu2912 Apr 4, 2025
a918039
fix torch install
alinpahontu2912 Apr 4, 2025
3a1f1f7
attempt merge workflows
alinpahontu2912 Apr 7, 2025
d24f065
change test-infra references
alinpahontu2912 Apr 7, 2025
ac6581a
test concurrency group
alinpahontu2912 Apr 8, 2025
1eb878e
test aarch
alinpahontu2912 Apr 8, 2025
362eca6
test correct input
alinpahontu2912 Apr 8, 2025
7b3ffb3
delete input debug echos
alinpahontu2912 Apr 8, 2025
372f7a9
test
alinpahontu2912 Apr 8, 2025
32f7721
change concurrency group
alinpahontu2912 Apr 8, 2025
630cc2d
Merge branch 'pytorch:main' into x64windows_test
alinpahontu2912 Apr 8, 2025
5b01ea4
add check for arch
alinpahontu2912 Apr 8, 2025
6c531e6
Merge branch 'x64windows_test' of https://github.com/alinpahontu2912/…
alinpahontu2912 Apr 8, 2025
9cdbf5e
add debug prints
alinpahontu2912 Apr 9, 2025
326757c
correct if upload condition
alinpahontu2912 Apr 9, 2025
b01f7cf
add python version input
alinpahontu2912 Apr 9, 2025
f758650
update upload condition
alinpahontu2912 Apr 9, 2025
82ec4ab
test scratch
alinpahontu2912 Apr 9, 2025
9a11552
change input name
alinpahontu2912 Apr 9, 2025
ee8575e
change concurrency gorup
alinpahontu2912 Apr 9, 2025
b5aba83
change concurrency group
alinpahontu2912 Apr 9, 2025
f6310ed
update generate_binary_wheels matrix for winarm64
alinpahontu2912 Apr 9, 2025
8682f55
if statement change
alinpahontu2912 Apr 9, 2025
0ce0527
first attemot combine arm64 and x64 actions
alinpahontu2912 Apr 10, 2025
dbccee5
add repo checkout and env variables
alinpahontu2912 Apr 10, 2025
1735123
fix target repo checkout
alinpahontu2912 Apr 10, 2025
f5c6e6c
add debug prints
alinpahontu2912 Apr 10, 2025
04a8d69
add test workflow + small refactor
alinpahontu2912 Apr 10, 2025
b6a6670
add checks to smoke_test arm64
alinpahontu2912 Apr 10, 2025
329b164
test pytorch version ref
alinpahontu2912 Apr 10, 2025
7817e78
test extra python version
alinpahontu2912 Apr 10, 2025
a2e91a8
revert hardcoded version string
alinpahontu2912 Apr 10, 2025
7fbd6dc
update channel/pytorch version configs
alinpahontu2912 Apr 10, 2025
16e68c3
test similar smoke test wheel finding
alinpahontu2912 Apr 11, 2025
413582a
revert wheel finding
alinpahontu2912 Apr 11, 2025
cbea4cb
final nitpicks
alinpahontu2912 Apr 11, 2025
45f8876
test
alinpahontu2912 Apr 11, 2025
25b53f1
fix path
alinpahontu2912 Apr 11, 2025
1c9901e
add step for creating artifact name
alinpahontu2912 Apr 11, 2025
52f32bc
use right name for artifact
alinpahontu2912 Apr 11, 2025
8e42569
try fix src_dir
alinpahontu2912 Apr 11, 2025
f3dd438
attempt use pre_script
alinpahontu2912 Apr 30, 2025
72736db
update paths
alinpahontu2912 Apr 30, 2025
1cc9885
attempt fix path
alinpahontu2912 Apr 30, 2025
5310010
add print debugs
alinpahontu2912 Apr 30, 2025
bac66e6
call python installation in the right env
alinpahontu2912 Apr 30, 2025
98efcd6
separate pre-script and build steps
alinpahontu2912 Apr 30, 2025
6633c0d
enable smoke test
alinpahontu2912 Apr 30, 2025
55ab2a2
fix lint and try to fix failing tests
alinpahontu2912 May 2, 2025
71de782
disable smoke test
alinpahontu2912 May 2, 2025
e3de81f
attempt fix artifact name
alinpahontu2912 May 2, 2025
e9c8706
add echo step for architecture
alinpahontu2912 May 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions .github/scripts/winx64test/bootstrap_buildtools.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
@echo off

echo Dependency MSVC Build Tools with C++ with ARM64/ARM64EC components installation started.

:: Pre-check for downloads and dependencies folders
if not exist "%DOWNLOADS_DIR%" mkdir "%DOWNLOADS_DIR%"
if not exist "%DEPENDENCIES_DIR%" mkdir "%DEPENDENCIES_DIR%"

:: Set download URL for the Visual Studio Installer
set DOWNLOAD_URL=https://aka.ms/vs/17/release/vs_BuildTools.exe
set INSTALLER_FILE=%DOWNLOADS_DIR%\vs_BuildTools.exe

:: Download installer
echo Downloading Visual Studio Build Tools with C++ installer...
curl -L -o "%INSTALLER_FILE%" %DOWNLOAD_URL%

:: Install the Visual Studio Build Tools with C++ components
echo Installing Visual Studio Build Tools with C++ components...
echo Installing MSVC %MSVC_VERSION%
if "%MSVC_VERSION%" == "latest" (
"%INSTALLER_FILE%" --norestart --quiet --wait --installPath "%DEPENDENCIES_DIR%\VSBuildTools" ^
--add Microsoft.VisualStudio.Workload.VCTools ^
--add Microsoft.VisualStudio.Component.Windows10SDK ^
--add Microsoft.VisualStudio.Component.Windows11SDK.22621 ^
--add Microsoft.VisualStudio.Component.VC.ASAN ^
--add Microsoft.VisualStudio.Component.VC.CMake.Project ^
--add Microsoft.VisualStudio.Component.VC.CoreBuildTools ^
--add Microsoft.VisualStudio.Component.VC.CoreIde ^
--add Microsoft.VisualStudio.Component.VC.Redist.14.Latest ^
--add Microsoft.VisualStudio.Component.VC.Tools.ARM64EC ^
--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ^
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64
) else if "%MSVC_VERSION%" == "14.40" (
"%INSTALLER_FILE%" --norestart --nocache --quiet --wait --fix --installPath "%DEPENDENCIES_DIR%\VSBuildTools" ^
--add Microsoft.VisualStudio.Workload.VCTools ^
--add Microsoft.VisualStudio.Component.Windows10SDK ^
--add Microsoft.VisualStudio.Component.Windows11SDK.22621 ^
--add Microsoft.VisualStudio.Component.VC.ASAN ^
--add Microsoft.VisualStudio.Component.VC.CMake.Project ^
--add Microsoft.VisualStudio.Component.VC.CoreBuildTools ^
--add Microsoft.VisualStudio.Component.VC.CoreIde ^
--add Microsoft.VisualStudio.Component.VC.Redist.14.Latest ^
--add Microsoft.VisualStudio.Component.VC.14.40.17.10.ARM64 ^
--add Microsoft.VisualStudio.Component.VC.14.40.17.10.x86.x64
) else if "%MSVC_VERSION%" == "14.36" (
"%INSTALLER_FILE%" --norestart --nocache --quiet --wait --fix --installPath "%DEPENDENCIES_DIR%\VSBuildTools" ^
--add Microsoft.VisualStudio.Workload.VCTools ^
--add Microsoft.VisualStudio.Component.Windows10SDK ^
--add Microsoft.VisualStudio.Component.Windows11SDK.22621 ^
--add Microsoft.VisualStudio.Component.VC.ASAN ^
--add Microsoft.VisualStudio.Component.VC.CMake.Project ^
--add Microsoft.VisualStudio.Component.VC.CoreBuildTools ^
--add Microsoft.VisualStudio.Component.VC.CoreIde ^
--add Microsoft.VisualStudio.Component.VC.Redist.14.Latest ^
--add Microsoft.VisualStudio.Component.VC.14.36.17.6.ARM64 ^
--add Microsoft.VisualStudio.Component.VC.14.36.17.6.x86.x64
)

echo exitcode = %errorlevel%

:: Check if installation was successful
if %errorlevel% neq 0 (
echo Failed to install Visual Studio Build Tools with C++ components.
exit /b 1
)

echo Dependency Visual Studio Build Tools with C++ installation finished.
39 changes: 39 additions & 0 deletions .github/scripts/winx64test/bootstrap_buildtools.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

echo "Dependency MSVC Build Tools with C++ with ARM64/ARM64EC components installation started."

# Pre-check for downloads and dependencies folders
mkdir -p "$DOWNLOADS_DIR"
mkdir -p "$DEPENDENCIES_DIR"

# Set download URL for the Visual Studio Installer
DOWNLOAD_URL="https://aka.ms/vs/17/release/vs_BuildTools.exe"
INSTALLER_FILE="$DOWNLOADS_DIR/vs_BuildTools.exe"

# Download installer
echo "Downloading Visual Studio Build Tools with C++ installer..."
curl -L -o "$INSTALLER_FILE" "$DOWNLOAD_URL"

# Install the Visual Studio Build Tools with C++ components
echo "Installing Visual Studio Build Tools with C++ components..."
echo "Installing MSVC $MSVC_VERSION"
"$INSTALLER_FILE" --norestart --quiet --wait --installPath "$DEPENDENCIES_DIR/VSBuildTools" \
--add Microsoft.VisualStudio.Workload.VCTools \
--add Microsoft.VisualStudio.Component.Windows10SDK \
--add Microsoft.VisualStudio.Component.Windows11SDK.22621 \
--add Microsoft.VisualStudio.Component.VC.ASAN \
--add Microsoft.VisualStudio.Component.VC.CMake.Project \
--add Microsoft.VisualStudio.Component.VC.CoreBuildTools \
--add Microsoft.VisualStudio.Component.VC.CoreIde \
--add Microsoft.VisualStudio.Component.VC.Redist.14.Latest \
--add Microsoft.VisualStudio.Component.VC.Tools.ARM64EC \
--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 \
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64

# Check if installation was successful
if [[ $? -ne 0 ]]; then
echo "Failed to install Visual Studio Build Tools with C++ components."
exit 1
fi

echo "Dependency Visual Studio Build Tools with C++ installation finished."
44 changes: 44 additions & 0 deletions .github/scripts/winx64test/bootstrap_git.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
@echo off
setlocal enabledelayedexpansion

echo Dependency Git installation started.

:: Pre-check for downloads and dependencies folders
set "DOWNLOADS_DIR=c:\temp\downloads"
set "DEPENDENCIES_DIR=c:\temp\dependencies"

if not exist "%DOWNLOADS_DIR%" mkdir "%DOWNLOADS_DIR%"
if not exist "%DEPENDENCIES_DIR%" mkdir "%DEPENDENCIES_DIR%"

:: Set download URL for the Git
set "DOWNLOAD_URL=https://github.com/git-for-windows/git/releases/download/v2.48.1.windows.1/Git-2.48.1-64-bit.exe"
set "INSTALLER_FILE=%DOWNLOADS_DIR%\Git-2.48.1-64-bit.exe"

:: Download installer
echo Downloading Git...
curl -L -o "%INSTALLER_FILE%" "%DOWNLOAD_URL%"

:: Verify download success
if not exist "%INSTALLER_FILE%" (
echo Failed to download Git!
exit /b 1
)

:: Install Git
echo Installing Git...
"%INSTALLER_FILE%" /VERYSILENT /DIR="%DEPENDENCIES_DIR%\git"

:: Verify installation success
if %errorlevel% neq 0 (
echo Failed to install Git. (exitcode = %errorlevel%)
exit /b 1
)

:: Enable long paths
call "%DEPENDENCIES_DIR%\git\cmd\git.exe" config --system core.longpaths true

:: Add Git to PATH (temporary for this session)
set "PATH=%DEPENDENCIES_DIR%\git\cmd\;%DEPENDENCIES_DIR%\git\bin\;%PATH%"

echo Dependency Git installation finished.
exit /b 0
47 changes: 47 additions & 0 deletions .github/scripts/winx64test/bootstrap_python.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
@echo off

echo Dependency Python installation started.

:: Pre-check for downloads and dependencies folders
if not exist "%DOWNLOADS_DIR%" mkdir %DOWNLOADS_DIR%
if not exist "%DEPENDENCIES_DIR%" mkdir %DEPENDENCIES_DIR%

echo PYTHON_VERSION is %PYTHON_VERSION%

if "%PYTHON_VERSION%" == "3.13" (
echo Python version is set to 3.13
set DOWNLOAD_URL=https://www.python.org/ftp/python/3.13.2/python-3.13.2-amd64.exe
)
else if "%PYTHON_VERSION%" == "3.12" (
echo Python version is set to 3.12
set DOWNLOAD_URL=https://www.python.org/ftp/python/3.12.7/python-3.12.7-amd64.exe
) else if "%PYTHON_VERSION%" == "3.11" (
echo Python version is set to 3.11
set DOWNLOAD_URL=https://www.python.org/ftp/python/3.11.9/python-3.11.9-amd64.exe
) else (
echo PYTHON_VERSION not defined, Python version is set to 3.12
set DOWNLOAD_URL=https://www.python.org/ftp/python/3.12.7/python-3.12.7-amd64.exe
)

set INSTALLER_FILE=%DOWNLOADS_DIR%\python-installer.exe

:: Download installer
echo Downloading Python...
curl -L -o "%INSTALLER_FILE%" "%DOWNLOAD_URL%"

:: Install Python
echo Installing Python...
"%INSTALLER_FILE%" /quiet Include_debug=1 TargetDir="%DEPENDENCIES_DIR%\Python"

:: Check if installation was successful
if %errorlevel% neq 0 (
echo "Failed to install Python. (exitcode = %errorlevel%)"
exit /b 1
)

:: Add to PATH
echo %DEPENDENCIES_DIR%\Python\>> %GITHUB_PATH%
echo %DEPENDENCIES_DIR%\Python\scripts\>> %GITHUB_PATH%
echo %DEPENDENCIES_DIR%\Python\libs\>> %GITHUB_PATH%

echo Dependency Python installation finished.
60 changes: 60 additions & 0 deletions .github/scripts/winx64test/build_audio.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
@echo on
set SRC_PATH=%GITHUB_WORKSPACE%\%SRC_DIR%
set CMAKE_BUILD_TYPE=%BUILD_TYPE%
set VCVARSALL_PATH=%DEPENDENCIES_DIR%\VSBuildTools\VC\Auxiliary\Build\vcvarsall.bat
set CONDA_PREFIX=%DEPENDENCIES_DIR%
set PATH=%PATH%;%CONDA_PREFIX%\Library\bin
set DISTUTILS_USE_SDK=1
set USE_FFMPEG=1
set FFMPEG_ROOT=%DEPENDENCIES_DIR%\Library

:: find torch file name by searching
for /f "delims=" %%f in ('dir /b "%DOWNLOADS_DIR%" ^| findstr "torch-"') do set "PYTORCH_PATH=%DOWNLOADS_DIR%\%%f"

:: Dependencies
if not exist "%DOWNLOADS_DIR%" mkdir %DOWNLOADS_DIR%
if not exist "%DEPENDENCIES_DIR%" mkdir %DEPENDENCIES_DIR%
echo * > %DOWNLOADS_DIR%\.gitignore
echo * > %DEPENDENCIES_DIR%\.gitignore

:: install vcpkg
cd %DOWNLOADS_DIR%
:: for ffmpeg 6.1.1 - pinning the version of vcpkg
:: https://pytorch.org/audio/stable/installation.html
git clone https://github.com/microsoft/vcpkg.git -b 2024.07.12
cd vcpkg
call bootstrap-vcpkg.bat

:: install dependencies
vcpkg install ffmpeg[ffmpeg]:x64-windows --x-install-root=%DEPENDENCIES_DIR%
robocopy /E %DEPENDENCIES_DIR%\x64-windows %DEPENDENCIES_DIR%\Library
robocopy /E %DEPENDENCIES_DIR%\Library\tools\ffmpeg %DEPENDENCIES_DIR%\Library\bin
robocopy /E %DEPENDENCIES_DIR%\Library\bin %SRC_PATH%\src\torio\lib

:: test ffmpeg
echo %FFMPEG_ROOT%
ffmpeg -version

:: Source directory
cd %SRC_PATH%

:: Virtual environment
python -m pip install --upgrade pip
python -m venv .venv
echo * > .venv\.gitignore
call .\.venv\Scripts\activate

:: Install dependencies
pip install %PYTORCH_PATH%

:: Activate visual studio
call "%VCVARSALL_PATH%" x64

:: Creates wheel under dist folder
python setup.py bdist_wheel

:: Check if installation was successful
if %errorlevel% neq 0 (
echo "Failed on build_audio. (exitcode = %errorlevel%)"
exit /b 1
)
69 changes: 69 additions & 0 deletions .github/scripts/winx64test/build_audio.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash

echo "Building audio dependencies and wheel started."

# Set environment variables
export SRC_PATH="$GITHUB_WORKSPACE/$SRC_DIR"
export VCVARSALL_PATH="$DEPENDENCIES_DIR/VSBuildTools/VC/Auxiliary/Build/vcvarsall.bat"
export CONDA_PREFIX="$DEPENDENCIES_DIR"
export PATH="$PATH:$CONDA_PREFIX/Library/bin"
export DISTUTILS_USE_SDK=1
export USE_FFMPEG=1
export FFMPEG_ROOT="$DEPENDENCIES_DIR/Library"
export TRIPLET_FILE="triplets/x64-windows.cmake"

echo "CONDA_PREFIX: $CONDA_PREFIX"
echo "SRC_PATH: $SRC_PATH"
echo "VCVARSALL_PATH: $VCVARSALL_PATH"
echo "PATH: $PATH"

# Dependencies
mkdir -p "$DOWNLOADS_DIR"
mkdir -p "$DEPENDENCIES_DIR"
echo "*" > "$DOWNLOADS_DIR/.gitignore"
echo "*" > "$DEPENDENCIES_DIR/.gitignore"

# Install vcpkg
cd "$DOWNLOADS_DIR" || exit
git clone https://github.com/microsoft/vcpkg.git -b 2024.07.12
cd vcpkg || exit
./bootstrap-vcpkg.sh

# Set vcpkg to only build release packages
echo "set(VCPKG_BUILD_TYPE release)" >> "$TRIPLET_FILE"

# Install dependencies using vcpkg
./vcpkg install ffmpeg[ffmpeg]:x64-windows --x-install-root="$DEPENDENCIES_DIR"

# Copy files using cp (replace robocopy)
mkdir -p "$DEPENDENCIES_DIR/Library/"
cp -r "$DEPENDENCIES_DIR/x64-windows/"* "$DEPENDENCIES_DIR/Library"
cp -r "$DEPENDENCIES_DIR/Library/tools/ffmpeg/"* "$DEPENDENCIES_DIR/Library/bin"
cp -r "$DEPENDENCIES_DIR/Library/bin/"* "$SRC_PATH/src/torio/lib"

# Test ffmpeg installation
echo "$FFMPEG_ROOT"
ffmpeg -version

# Source directory
cd "$SRC_PATH" || exit

# Create virtual environment
python -m pip install --upgrade pip
python -m venv .venv
echo "*" > .venv/.gitignore
source .venv/Scripts/activate

# Install dependencies
pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu

# Create wheel under dist folder
python setup.py bdist_wheel

# Check if build was successful
if [[ $? -ne 0 ]]; then
echo "Failed on build_audio. (exitcode = $?)"
exit 1
fi

echo "Build finished successfully."
Loading