Need VS command prompt. #1994
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build FreeDV (Windows) | |
on: | |
push: | |
branches-ignore: | |
- 'dr-render-manual' | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Debug | |
jobs: | |
build: | |
# The CMake configure and build commands are platform agnostic and should work equally | |
# well on Windows or Mac. You can convert this to a matrix build if you need | |
# cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install WINE | |
run: | | |
sudo dpkg --add-architecture i386 | |
sudo sh -c "curl https://dl.winehq.org/wine-builds/winehq.key | gpg --dearmor > /etc/apt/trusted.gpg.d/winehq.gpg" | |
sudo sh -c "apt-add-repository \"https://dl.winehq.org/wine-builds/ubuntu\"" | |
sudo apt-get update | |
echo "/opt/wine-staging/bin" >> $GITHUB_PATH | |
sudo apt install -y --install-recommends wine-staging | |
#sudo apt install -y --install-recommends wine64 wine32 | |
- name: Install required packages | |
shell: bash | |
working-directory: ${{github.workspace}} | |
run: sudo apt-get install nsis | |
- name: Configure WINE | |
shell: bash | |
working-directory: ${{github.workspace}} | |
run: | | |
WINEPREFIX=`pwd`/wine-env WINEARCH=win64 DISPLAY= winecfg /v win10 | |
- name: Create Windows Python environment for build | |
shell: bash | |
working-directory: ${{github.workspace}} | |
run: | | |
export WINEPREFIX=`pwd`/wine-env | |
wget https://www.python.org/ftp/python/3.12.7/python-3.12.7-amd64.exe | |
Xvfb :99 -screen 0 1024x768x16 & | |
sleep 5 | |
export DISPLAY=:99.0 | |
wine ./python-3.12.7-amd64.exe /quiet /log c:\\python.log InstallAllUsers=1 Include_doc=0 Include_tcltk=0 || : | |
cat $WINEPREFIX/drive_c/python.log | |
wine c:\\Program\ Files\\Python312\\Scripts\\pip.exe install numpy | |
- name: Download MinGW LLVM | |
shell: bash | |
working-directory: ${{github.workspace}} | |
run: | | |
wget https://github.com/mstorsjo/llvm-mingw/releases/download/20230320/llvm-mingw-20230320-ucrt-ubuntu-18.04-x86_64.tar.xz | |
tar xvf llvm-mingw-20230320-ucrt-ubuntu-18.04-x86_64.tar.xz | |
- name: Configure freedv-gui | |
shell: bash | |
working-directory: ${{github.workspace}} | |
run: | | |
export WINEPREFIX=`pwd`/wine-env | |
export PATH=${{github.workspace}}/llvm-mingw-20230320-ucrt-ubuntu-18.04-x86_64/bin:$PATH | |
mkdir build_windows | |
cd build_windows | |
cmake -DLPCNET_DISABLE=1 -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/cross-compile/freedv-mingw-llvm-x86_64.cmake -DPython3_ROOT_DIR=$WINEPREFIX/drive_c/Program\ Files/Python312 .. | |
- name: Build freedv-gui | |
shell: bash | |
working-directory: ${{github.workspace}}/build_windows | |
run: | | |
export PATH=${{github.workspace}}/llvm-mingw-20230320-ucrt-ubuntu-18.04-x86_64/bin:$PATH | |
make -j6 package | |
- name: Rename installer | |
shell: bash | |
working-directory: ${{github.workspace}}/build_windows | |
run: | | |
mv FreeDV*.exe FreeDV.exe | |
- name: Stash for next step | |
uses: actions/upload-artifact@v4 | |
with: | |
name: FreeDVSetupProgram | |
path: ${{github.workspace}}/build_windows/FreeDV.exe | |
test: | |
runs-on: windows-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: FreeDVSetupProgram | |
path: ${{github.workspace}} | |
- uses: ilammy/msvc-dev-cmd@v1 | |
- name: Install FreeDV on hard drive | |
shell: pwsh | |
run: | | |
.\FreeDV.exe /S /D=${{github.workspace}}\FreeDV-Install-Location | |
- name: Copy test script to install folder | |
shell: pwsh | |
run: | | |
Copy-Item -Path ${{github.workspace}}/test/TestFreeDVFullDuplex.ps1 -Destination ${{github.workspace}}\FreeDV-Install-Location\bin | |
Copy-Item -Path ${{github.workspace}}/test/freedv-ctest-fullduplex.conf.tmpl -Destination ${{github.workspace}}\FreeDV-Install-Location\bin | |
- name: Install VB-Cable ("Radio" sound device) | |
uses: LABSN/sound-ci-helpers@v1 | |
- run: 'Invoke-WebRequest https://github.com/duncanthrax/scream/releases/download/4.0/Scream4.0.zip -OutFile Scream4.0.zip' | |
- run: 'Expand-Archive -Path Scream4.0.zip -DestinationPath Scream' | |
# To work around https://github.com/duncanthrax/scream/issues/215, create our own self-signed certificate for the Scream driver. | |
# makecert.exe insists on interactively asking the user for a password (sigh...), so use OpenSSL instead. | |
# `-extensions v3_req` is a trick to make sure the resulting cert has basic constraint CA:FALSE (the default is CA:TRUE which is problematic here) without having to create an OpenSSL config file. | |
- run: 'openssl req -batch -verbose -x509 -newkey rsa -keyout ScreamCertificate.pvk -out ScreamCertificate.cer -nodes -extensions v3_req' | |
- run: 'openssl pkcs12 -export -nodes -in ScreamCertificate.cer -inkey ScreamCertificate.pvk -out ScreamCertificate.pfx -passout pass:' | |
# Sign the driver with the self-signed certificate we just made. | |
- run: 'signtool sign /v /fd SHA256 /f ScreamCertificate.pfx Scream\Install\driver\x64\Scream.cat' | |
# Tell Windows to trust the self-signed certificate we just made. | |
# (For some reason it has to be added to both stores for it to work.) | |
- run: 'Import-Certificate -FilePath ScreamCertificate.cer -CertStoreLocation Cert:\LocalMachine\root' | |
- run: 'Import-Certificate -FilePath ScreamCertificate.cer -CertStoreLocation Cert:\LocalMachine\TrustedPublisher' | |
# Finally, install the driver. | |
- run: 'Scream\Install\helpers\devcon-x64.exe install Scream\Install\driver\x64\Scream.inf *Scream' | |
# For convenience, make sure we fail fast if for whatever reason the install gets blocked on some GUI prompt. | |
timeout-minutes: 5 | |
- name: Start Windows Audio Service | |
run: net start audiosrv | |
- name: Test RADE | |
shell: pwsh | |
run: | | |
cd ${{github.workspace}}\FreeDV-Install-Location\bin | |
.\TestFreeDVFullDuplex.ps1 -RadioToComputerDevice "CABLE Input (VB-Audio Virtual Cable)" -ComputerToRadioDevice "CABLE Output (VB-Audio Virtual Cable)" -MicrophoneToComputerDevice "Microsoft Sound Mapper - Input" -ComputerToSpeakerDevice "Speakers (Scream (WDM))" -ModeToTest RADE -NumberOfRuns 1 | |
timeout-minutes: 3 |