Merge pull request #93 from ChristianGalla/dependabot/github_actions/… #206
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 & Test | |
on: | |
workflow_call: | |
outputs: | |
version_number: | |
description: "Build version number" | |
value: ${{ jobs.build.outputs.version_number }} | |
push: | |
branches: [ master ] | |
paths: | |
- 'AutoStartConfirm/**' | |
- 'AutoStartConfirmLib/**' | |
- 'AutoStartConfirmSetup/**' | |
- 'AutoStartConfirmTests/**' | |
- '.github/workflows/**' | |
pull_request: | |
branches: [ master ] | |
paths: | |
- 'AutoStartConfirm/**' | |
- 'AutoStartConfirmLib/**' | |
- 'AutoStartConfirmSetup/**' | |
- 'AutoStartConfirmTests/**' | |
- '.github/workflows/**' | |
jobs: | |
build: | |
runs-on: windows-latest | |
outputs: | |
version_number: ${{ steps.get-version-number.outputs.version_number }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup MSBuild | |
uses: microsoft/setup-msbuild@v1 | |
- name: Setup VSTest | |
uses: darenm/Setup-VSTest@v1 | |
- name: Setup NuGet | |
uses: NuGet/setup-nuget@v2 | |
- name: Setup Wix | |
run: dotnet tool install --global wix | |
- uses: actions/cache@v3 | |
name: Restore NuGet cache | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-nuget- | |
- name: Restore NuGet packages | |
run: nuget restore AutoStartConfirm.sln | |
- name: Build product | |
run: msbuild build/Daily.targets /property:Configuration=Release | |
- name: Get version number | |
id: get-version-number | |
working-directory: .\build\publish\Release_FrameworkDependent_win-x64 | |
run: | | |
$versionNumber=(Get-Item ".\AutoStartConfirm.exe" | Select-Object -ExpandProperty VersionInfo).FileVersion | |
"version_number=$versionNumber" >> $env:GITHUB_OUTPUT | |
shell: pwsh | |
- name: Restore tests | |
run: dotnet restore AutoStartConfirmTests\AutoStartConfirmTests.csproj | |
- name: Build tests | |
run: msbuild AutoStartConfirmTests\AutoStartConfirmTests.csproj -p:Configuration=Release -p:Platform=x64 -p:PublishReadyToRun=false | |
- name: Test solution | |
run: vstest.console.exe /Platform:x64 "AutoStartConfirmTests\bin\x64\Release\net8.0-windows10.0.18362.0\win-x64\AutoStartConfirmTests.dll" | |
- uses: actions/upload-artifact@v3 | |
name: Upload artifacts | |
with: | |
name: AutoStartConfirmSetup | |
path: build\publish\*.msi | |
if-no-files-found: error |