Skip to content

build-test

build-test #17

Workflow file for this run

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. 1.2.3
type: string
default: '1.2.3'
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: Build
working-directory: ${{env.SOLUTION_FILE_PATH}}
run: >-
dotnet build -c ${{env.BUILD_CONFIGURATION}}
-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}} --no-build --no-restore
- name: Cache build
uses: actions/[email protected]
if: ${{ inputs.cache-build }}
with:
path: src/ServiceBusExplorer/bin/Release
key: cached-output-${{ github.sha }}