Add GitHub Actions workflow for MSBuild #10
Workflow file for this run
This file contains hidden or 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: MSBuild | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| tags: ["v[0-9]**"] | |
| pull_request: | |
| branches: [ "master" ] | |
| workflow_dispatch: | |
| env: | |
| # Path to the solution file relative to the root of the project. | |
| SOLUTION_FILE_PATH: . | |
| # Configuration type to build. | |
| # You can convert this to a build matrix if you need coverage of multiple configuration types. | |
| # https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
| BUILD_CONFIGURATION: Release | |
| jobs: | |
| build-utilities: | |
| name: Build submodules | |
| runs-on: windows-latest | |
| permissions: | |
| contents: read | |
| strategy: | |
| matrix: | |
| platform: [x86, x64, ARM64] | |
| steps: | |
| - name: Checkout submodules | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: recursive | |
| - name: Add MSBuild to PATH | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Build AzureSpeechSDKShim | |
| if: matrix.platform != 'ARM64' | |
| working-directory: ${{github.workspace}} | |
| run: | | |
| nuget restore AzureSpeechSDKShim | |
| msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=${{matrix.platform}} /p:OutDir=${{github.workspace}}\out\ AzureSpeechSDKShim | |
| - name: Build TtsApplication (non Win32) | |
| if: matrix.platform != 'x86' | |
| working-directory: ${{github.workspace}} | |
| run: | | |
| nuget restore TtsApplication | |
| msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=${{matrix.platform}} /p:OutDir=${{github.workspace}}\out\ TtsApplication\TtsApplication.sln | |
| - name: Build TtsApplication (Win32) | |
| # We have to use Win32 instead of x86 for this project. | |
| if: matrix.platform == 'x86' | |
| working-directory: ${{github.workspace}} | |
| run: | | |
| nuget restore TtsApplication | |
| msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=Win32 /p:OutDir=${{github.workspace}}\out\ TtsApplication\TtsApplication.sln | |
| - name: Build Arm64XForwarder (ARM64 only) | |
| if: matrix.platform == 'ARM64' | |
| working-directory: ${{github.workspace}} | |
| run: | | |
| nuget restore Arm64XForwarder -SolutionDirectory . | |
| msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=ARM64EC /p:OutDir=${{github.workspace}}\out\ Arm64XForwarder | |
| - name: Build Installer (x86 only) | |
| if: matrix.platform == 'x86' | |
| working-directory: ${{github.workspace}} | |
| run: | | |
| nuget restore Installer -SolutionDirectory . | |
| msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=${{matrix.platform}} /p:OutDir=${{github.workspace}}\out\ Installer | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: utilities-${{matrix.platform}} | |
| path: out | |
| build-main: | |
| name: Build NaturalVoiceSAPIAdapter | |
| runs-on: windows-latest | |
| permissions: | |
| contents: read | |
| strategy: | |
| matrix: | |
| platform: [x86, x64, ARM64] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Add MSBuild to PATH | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Restore NuGet packages | |
| working-directory: ${{github.workspace}} | |
| run: nuget restore NaturalVoiceSAPIAdapter -SolutionDirectory . | |
| - name: Build | |
| working-directory: ${{github.workspace}} | |
| run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform=${{matrix.platform}} /p:OutDir=${{github.workspace}}\out\ . /t:NaturalVoiceSAPIAdapter | |
| - name: Remove MFC DLLs | |
| working-directory: ${{github.workspace}} | |
| shell: pwsh | |
| run: Remove-Item out\mfc*.dll | |
| - name: Copy ucrtbase.dll (x64) | |
| if: matrix.platform == 'x64' | |
| working-directory: ${{github.workspace}} | |
| shell: pwsh | |
| run: Copy-Item -Path "$env:SystemRoot\System32\ucrtbase.dll" -Destination out\ | |
| - name: Copy ucrtbase.dll (x86) | |
| if: matrix.platform == 'x86' | |
| working-directory: ${{github.workspace}} | |
| shell: pwsh | |
| run: Copy-Item -Path "$env:SystemRoot\SysWOW64\ucrtbase.dll" -Destination out\ | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: main-${{matrix.platform}} | |
| path: out | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: [build-utilities, build-main] | |
| # if: github.ref_type == 'tag' | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v7 | |
| with: | |
| path: ${{github.workspace}}/artifacts | |
| - name: Create ZIP files | |
| working-directory: ${{github.workspace}}/artifacts | |
| run: | | |
| ver="${{github.ref_name}}" | |
| ver="${ver//\//_}" | |
| mkdir x86 | |
| cp utilities-x86/* x86/ | |
| cp main-x86/* x86/ | |
| mv utilities-x86/Installer.exe ./ | |
| mkdir x64 | |
| cp utilities-x64/* x64/ | |
| cp main-x64/* x64/ | |
| zip -r NaturalVoiceSAPIAdapter_${ver}_x86_x64.zip x86 x64 Installer.exe -i "*.exe" "*.dll" | |
| mkdir ARM64 | |
| cp utilities-ARM64/* ARM64/ | |
| cp main-ARM64/* ARM64/ | |
| zip -r NaturalVoiceSAPIAdapter_${ver}_ARM64.zip x86 x64 ARM64 Installer.exe -i "*.exe" "*.dll" | |
| zip -r debug_symbols.zip x86 x64 ARM64 -i "*.pdb" | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| draft: true | |
| body_path: ${{github.workspace}}/release_notes.md | |
| files: | | |
| ${{github.workspace}}/artifacts/*.zip | |