Skip to content

Versioning

Versioning #40

Workflow file for this run

name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
inputs:
configuration:
description: 'Build Configuration'
required: true
default: 'Debug'
type: choice
options:
- Debug
- Release
permissions:
checks: write
env:
SPECS_FILTER: "" # use for testing CI: "&Category=basicExecution"
jobs:
build:
runs-on: ubuntu-latest
outputs:
product_version_suffix: ${{ steps.versions.outputs.product_version_suffix }}
product_configuration: ${{ steps.versions.outputs.product_configuration }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- id: versions
name: Calculate versions
shell: pwsh
run: |
$date = [datetime]::Today
$dateString = $date.ToString('yyyyMMdd')
Write-Output "product_version_suffix=ci$dateString-${env:GITHUB_RUN_NUMBER}" >> $env:GITHUB_OUTPUT
$productConfig = "${{ inputs.configuration }}"
if ($productConfig -eq "")
$productConfig = "Debug"
Write-Output "product_configuration=$productConfig" >> $env:GITHUB_OUTPUT
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore -p:VersionSuffix=${{ steps.versions.outputs.product_version_suffix }} -c ${{ steps.versions.outputs.product_configuration }}
- name: Runtime Tests
run: dotnet test ./Tests/Reqnroll.RuntimeTests/Reqnroll.RuntimeTests.csproj --no-build --verbosity normal -f net6.0
- name: Plugin Tests
run: dotnet test ./Tests/Reqnroll.PluginTests/Reqnroll.PluginTests.csproj --no-build --verbosity normal -f net6.0
- name: Generator Tests
run: dotnet test ./Tests/Reqnroll.GeneratorTests/Reqnroll.GeneratorTests.csproj --no-build --verbosity normal -f net6.0
- name: ExternalData Plugin Tests
run: dotnet test ./Plugins/Reqnroll.ExternalData/Reqnroll.ExternalData.ReqnrollPlugin.UnitTests/Reqnroll.ExternalData.ReqnrollPlugin.UnitTests.csproj --no-build --verbosity normal -f net6.0
specs-xunit:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore -p:VersionSuffix=${{ needs.build.outputs.product_version_suffix }} -c ${{ needs.build.outputs.product_configuration }}
- name: Set .NET 6 SDK
run: dotnet new globaljson --sdk-version 6.0.418
- name: xUnit Specs
shell: pwsh
run: dotnet test ./Tests/Reqnroll.Specs/Reqnroll.Specs.csproj --no-build --verbosity normal -f net6.0 --filter "Category=xUnit&Category=Net60&Category!=requiresMsBuild$env:SPECS_FILTER" --logger "trx;LogFileName=specs-xunit-results.trx"
- uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: specs-results
path: "**/specs-xunit-results.trx"
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: xUnit Specs
path: "**/specs-xunit-results.trx"
reporter: dotnet-trx
specs-nunit:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore -p:VersionSuffix=${{ needs.build.outputs.product_version_suffix }} -c ${{ needs.build.outputs.product_configuration }}
- name: Set .NET 6 SDK
run: dotnet new globaljson --sdk-version 6.0.418
- name: NUnit Specs
shell: pwsh
run: dotnet test ./Tests/Reqnroll.Specs/Reqnroll.Specs.csproj --no-build --verbosity normal -f net6.0 --filter "Category=NUnit3&Category=Net60&Category!=requiresMsBuild$env:SPECS_FILTER" --logger "trx;LogFileName=specs-nunit-results.trx"
- uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: specs-results
path: "**/specs-nunit-results.trx"
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: NUnit Specs
path: "**/specs-nunit-results.trx"
reporter: dotnet-trx
specs-mstest:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore -p:VersionSuffix=${{ needs.build.outputs.product_version_suffix }} -c ${{ needs.build.outputs.product_configuration }}
- name: Set .NET 6 SDK
run: dotnet new globaljson --sdk-version 6.0.418
- name: MsTest Specs
shell: pwsh
run: dotnet test ./Tests/Reqnroll.Specs/Reqnroll.Specs.csproj --no-build --verbosity normal -f net6.0 --filter "Category=MsTest&Category=Net60&Category!=requiresMsBuild$env:SPECS_FILTER" --logger "trx;LogFileName=specs-mstest-results.trx"
- uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: specs-results
path: "**/specs-mstest-results.trx"
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: MsTest Specs
path: "**/specs-mstest-results.trx"
reporter: dotnet-trx