Skip to content

fix order to print env var #96

fix order to print env var

fix order to print env var #96

Workflow file for this run

name: Build and Compile
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: windows-latest
steps:
# Checkout the code
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install CMake
uses: jwlawson/actions-setup-cmake@v1
- name: Install vcpkg
run: |
git clone https://github.com/microsoft/vcpkg.git
.\vcpkg\bootstrap-vcpkg.bat
.\vcpkg\vcpkg integrate install
.\vcpkg\vcpkg integrate project
- name: Build JSONCPP
run: |
git clone https://github.com/open-source-parsers/jsoncpp.git
cd jsoncpp
mkdir build
cd build
cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release
- name: Set up JSONCPP paths
run: |
echo "JSONCPP_INCLUDE_DIR=${{ github.workspace }}/jsoncpp/include" >> $GITHUB_ENV
echo "JSONCPP_LIB_DIR=${{ github.workspace }}/jsoncpp/build/lib/Release" >> $GITHUB_ENV
echo "JSONCPP_DLL_DIR=${{ github.workspace }}/jsoncpp/build/bin/Release" >> $GITHUB_ENV
- name: Verify JSONCPP Build Output
run: |
dir ${{ env.JSONCPP_DLL_DIR }}
- name: Build pysapittsengine
run: |
cd engine
mkdir build
cd build
cmake .. -G "Visual Studio 17 2022" -A x64 -DCMAKE_PREFIX_PATH=${{ env.VCPKG_ROOT }} -DCMAKE_INCLUDE_PATH=${{ env.JSONCPP_INCLUDE_DIR }} -DCMAKE_LIBRARY_PATH=${{ env.JSONCPP_LIB_DIR }}
cmake --build . --config Release
copy ${{ env.JSONCPP_DLL_DIR }}\jsoncpp.dll . # Copy DLL to output directory
- name: Print contents of build/bin directory
run: |
dir engine/build
dir engine/build/Release
# Move the DLL to VoiceServer directory
- name: Move DLL and other bits to VoiceServer directory
run: |
Move-Item -Force engine/build/Release/* VoiceServer/_libs/
- name: Set up UV
uses: yezz123/setup-uv@v4
- name: Sync UV dependencies
run: |
cd VoiceServer
uv sync
- name: Compile RegisterVoice.py with PyInstaller inside UV virtual environment
run: |
cd VoiceServer
$site_packages = uv run python -c "import site; print(site.getsitepackages()[0])" | Out-String
$site_packages = $site_packages.Trim() -replace "`r`n", "" # Remove any newlines
uv run python -m PyInstaller RegisterVoice.py --noupx --onedir --name "RegisterVoice" -i .\icon.ico --clean --add-binary "$site_packages/Lib/site-packages/azure/cognitiveservices/speech/Microsoft.CognitiveServices.Speech.core.dll;." --collect-all comtypes -y
- name: Compile VoiceServer.py with PyInstaller inside UV virtual environment
run: |
cd VoiceServer
$site_packages = uv run python -c "import site; print(site.getsitepackages()[0])" | Out-String
$site_packages = $site_packages.Trim() -replace "`r`n", "" # Remove any newlines
uv run python -m PyInstaller VoiceServer.py --noupx --onedir --noconsole --name "VoiceServer" -i .\icon.ico --clean --add-binary "$site_packages/Lib/site-packages/azure/cognitiveservices/speech/Microsoft.CognitiveServices.Speech.core.dll;." --collect-all comtypes --uac-admin -y
- name: Build Installer with Inno Setup
run: |
cd VoiceServer
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" ".\buildinstaller.iss"
- name: Zip the executables and _libs directory
run: |
cd VoiceServer
dir .
if ((Test-Path "dist/VoiceServer") -and (Test-Path "dist/RegisterVoice") -and (Test-Path "_libs")) {
# Compress the contents
powershell -Command "Compress-Archive -Path 'dist/VoiceServer','dist/RegisterVoice','_libs' -DestinationPath 'VoiceServer_Uninstalled.zip'"
} else {
Write-Host "One or more directories are missing. Compression aborted."
}
# Add this after the compression to verify the zip file exists
if (Test-Path "VoiceServer_Uninstalled.zip") {
Write-Host "Zip file created successfully."
dir VoiceServer_Uninstalled.zip
} else {
Write-Host "Zip file creation failed."
}
- name: Archive the zip of uninstalled version
uses: actions/upload-artifact@v4
with:
name: uninstalled-version
path: VoiceServer/VoiceServer_Uninstalled.zip
# Archive the compiled executables
- name: Archive the output
uses: actions/upload-artifact@v4
with:
name: compiled-executables
path: |
VoiceServer/output/VoiceServerInstaller.exe