diff --git a/.github/workflows/build-test-installer-release.yml b/.github/workflows/build-test-installer-release.yml new file mode 100644 index 00000000..4a07ed76 --- /dev/null +++ b/.github/workflows/build-test-installer-release.yml @@ -0,0 +1,116 @@ +name: Build and Run Tests. Build installer and create release on v tag + +on: + push: + +env: + # Path to the solution file relative to the root of the project. + SOLUTION_FILE_PATH: . + + BUILD_CONFIGURATION: Release + PLATFORM: Win32 + +jobs: + build: + runs-on: windows-2022 + + steps: + - uses: actions/checkout@v4 + + - name: Add MSBuild to PATH + uses: microsoft/setup-msbuild@v2 + + # TODO cache NuGet packages + - name: NuGet Restore + run: nuget restore ${{env.SOLUTION_FILE_PATH}} + + - name: Build + working-directory: ${{env.GITHUB_WORKSPACE}} + run: msbuild /m /p:Configuration="${{env.BUILD_CONFIGURATION}}" ${{env.SOLUTION_FILE_PATH}} + + - name: Setup VSTest and add to PATH + uses: darenm/Setup-VSTest@v1.2 + + - name: Run Unit Tests + working-directory: .\${{env.BUILD_CONFIGURATION}} + run: vstest.console.exe ElanUtilsTest.dll LiftUtilsTest.dll URIParserTest.dll WaveUtilsTest.dll + + # This currently fails on github actions due to requiring the Speech Analyzer program to load up for scripting and testing + #- name: Run Integration Tests + # working-directory: .\Release + # run: vstest.console.exe SAScriptingTest.dll + + - name: Upload Release/ for installer job + if: startsWith(github.ref, 'refs/tags/v') + uses: actions/upload-artifact@v4 + with: + name: Release + path: Release/ + retention-days: 3 + + build-installer: + name: Build installer + needs: build + if: startsWith(github.ref, 'refs/tags/v') + runs-on: windows-latest + outputs: + installer: ${{steps.getfilename.outputs.installer}} + steps: + - uses: actions/checkout@v4 + + - name: Download Release/ + uses: actions/download-artifact@v4 + with: + name: Release + path: Release/ + + # Copy iso639.txt to DistFiles + - name: Copy iso639.txt file + run: copy DistFiles/iso639.txt Release/ + + # Create Installer exe + - name: Run InnoSetup + working-directory: Install/ + run: iscc SpeechAnalyzer.iss + + - name: list files + run: dir Install/Output/ + + - name: get filename + id: getfilename + run: Write-Output ("installer="+(Get-ChildItem -Filter Install/Output/SpeechAnalyzerInstaller*.exe -Name)) >> $ENV:GITHUB_OUTPUT + + - name: Upload installer + uses: actions/upload-artifact@v4 + with: + name: SpeechAnalyzerInstaller + path: Install/Output/ + + sign-installer: + name: Sign installer + needs: build-installer + if: startsWith(github.ref, 'refs/tags/v') + uses: sillsdev/codesign/.github/workflows/sign.yml@v1 + with: + target: ${{needs.build-installer.outputs.installer}} + secrets: + certificate: ${{ secrets.CODESIGN_LSDEVSECTIGOEV }} + + create-release: + name: Create Release + needs: sign-installer + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + + steps: + - uses: actions/download-artifact@v4 + with: + name: SpeechAnalyzerInstaller.exe + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + files: SpeechAnalyzerInstaller.exe + body: | + Release for version ${{ github.ref }} + draft: true diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml deleted file mode 100644 index 99b92985..00000000 --- a/.github/workflows/msbuild.yml +++ /dev/null @@ -1,98 +0,0 @@ -name: Build and Run Tests. Compile and Upload Installer for Releases - -on: - workflow_dispatch: - push: - branches: - - master - pull_request: - branches: - - master - release: - types: - # Doesn't trigger for draft releases - - published - -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 - PLATFORM: Win32 - -jobs: - build: - runs-on: windows-2022 - - steps: - - uses: actions/checkout@v3 - - - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v1.1 - - - name: NuGet Restore - run: nuget restore ${{env.SOLUTION_FILE_PATH}} - - - name: Build - working-directory: ${{env.GITHUB_WORKSPACE}} - # Add additional options to the MSBuild command line here (like platform or verbosity level). - # See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference - run: msbuild /m /p:Configuration="${{env.BUILD_CONFIGURATION}}" ${{env.SOLUTION_FILE_PATH}} - - - name: Setup VSTest and add to PATH - uses: darenm/Setup-VSTest@v1 - - - name: Run Unit Tests - working-directory: .\${{env.BUILD_CONFIGURATION}} - run: vstest.console.exe ElanUtilsTest.dll LiftUtilsTest.dll URIParserTest.dll WaveUtilsTest.dll - - # This currently fails on github actions due to requiring the Speech Analyzer program to load up for scripting and testing - #- name: Run Integration Tests - # working-directory: .\Release - # run: vstest.console.exe SAScriptingTest.dll - - - name: Upload Release/ for installer job - if: github.event_name == 'release' - uses: actions/upload-artifact@v3 - with: - name: Release - path: Release/ - retention-days: 3 - - installer: - name: Compile installer and upload asset to release - if: github.event_name == 'release' - needs: build - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - - name: Download Release/ - uses: actions/download-artifact@v3 - with: - name: Release - path: Release/ - - # Copy iso639.txt to DistFiles - - name: Copy iso639.txt file - run: copy DistFiles/iso639.txt Release/ - - # Create Installer exe - - name: Run InnoSetup - working-directory: Install/ - run: iscc SpeechAnalyzer.iss - - - name: Upload the Artifact - uses: actions/upload-artifact@v3 - with: - name: SpeechAnalyzerInstaller - path: Install/Output/ - - # Upload installer to release tag which triggered this build - - uses: softprops/action-gh-release@v1 - with: - files: Install/Output/SpeechAnalyzer.exe - tag_name: ${{ github.event.release.tag_name }}