build-test #13
Workflow file for this run
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: | |
inputs: | |
release-version: | |
required: true | |
type: string | |
cache-build: | |
required: false | |
type: boolean | |
default: false | |
workflow_dispatch: | |
inputs: | |
release-version: | |
required: false | |
description: A version number to test manual builds. e.g. 2.1.1 | |
type: string | |
default: '0.0.0' | |
env: | |
SOLUTION_FILE_PATH: .\src | |
BUILD_CONFIGURATION: Release | |
jobs: | |
build_test_publish: | |
name: Build and run unit tests | |
runs-on: windows-2022 | |
steps: | |
- name: Git configuration | |
run: git config --global core.autocrlf false | |
- uses: actions/checkout@v4 | |
- name: Restore NuGet packages | |
working-directory: ${{env.SOLUTION_FILE_PATH}} | |
run: dotnet restore | |
- name: Show version | |
run: echo "Building version ${{ inputs.release-version }}" | |
- name: Get number version | |
env: | |
ReleaseVersion: ${{ inputs.release-version }} | |
run: | | |
Write-Host "Using release version: $env:ReleaseVersion" | |
$numberVersion = .\GetNumberVersion -Version $env:ReleaseVersion | |
echo "Setting numberVersion to $numberVersion" | |
echo "NUMBER_VERSION=$numberVersion" >> $env:GITHUB_ENV | |
- name: Build | |
working-directory: ${{env.SOLUTION_FILE_PATH}} | |
run: >- | |
dotnet build -c ${{env.BUILD_CONFIGURATION}} | |
-p:GenerateAssemblyInfo=true | |
-p:AssemblyVersion=${{env.NUMBER_VERSION}} | |
-p:InformationalVersion=${{inputs.release-version}} | |
-p:FileVersion=${{inputs.release-version}} | |
- name: Run tests | |
env: | |
FILE_VERSION: ${{inputs.release-version}} | |
working-directory: ${{env.SOLUTION_FILE_PATH}} | |
run: dotnet test -c ${{env.BUILD_CONFIGURATION}} | |
- name: Cache build | |
uses: actions/[email protected] | |
if: ${{ inputs.cache-build }} | |
with: | |
path: src/ServiceBusExplorer/bin/Release | |
key: cached-output-${{ github.sha }} |