Skip to content

Commit

Permalink
Add CI build
Browse files Browse the repository at this point in the history
  • Loading branch information
gasparnagy committed Jan 22, 2024
1 parent 7b86438 commit d7c4d7a
Show file tree
Hide file tree
Showing 4 changed files with 123 additions and 3 deletions.
120 changes: 120 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
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
version_suffix:
description: 'Suffix for the NuGet packages (without leading -). Build ID will be appended.'
required: false


permissions:
checks: write


jobs:
build:

runs-on: windows-latest

outputs:
product_version_suffix: ${{ steps.versions.outputs.product_version_suffix }}
product_configuration: ${{ steps.versions.outputs.product_configuration }}
build_params: ${{ steps.versions.outputs.build_params }}
test_params: ${{ steps.versions.outputs.test_params }}

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: |
$versionSuffix = "${{ inputs.version_suffix }}"
if ($versionSuffix -eq "") {
$date = [datetime]::Today
$dateString = $date.ToString('yyyyMMdd')
$versionSuffix = "ci$dateString-${env:GITHUB_RUN_NUMBER}"
}
else {
$versionSuffix = "$versionSuffix-${env:GITHUB_RUN_NUMBER}"
}
Write-Output "product_version_suffix=$versionSuffix" >> $env:GITHUB_OUTPUT
Write-Output "Product Suffix: $versionSuffix"
$productConfig = "${{ inputs.configuration }}"
if ($productConfig -eq "") {
$productConfig = "Debug"
}
Write-Output "product_configuration=$productConfig" >> $env:GITHUB_OUTPUT
Write-Output "Product Configuration: $productConfig"
$buildParams = "-p:VersionSuffix=$versionSuffix -c $productConfig"
Write-Output "build_params=$buildParams" >> $env:GITHUB_OUTPUT
Write-Output "Build Params: $buildParams"
$testParams = "--no-build --verbosity normal -c $productConfig"
Write-Output "test_params=$testParams" >> $env:GITHUB_OUTPUT
Write-Output "Test Params: $testParams"
- name: Restore dependencies
run: dotnet restore
- name: Build Connectors
shell: pwsh
run: |
cd Connectors
.\build.ps1 -configuration ${{ steps.versions.outputs.product_configuration }}
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
- name: Build
run: msbuild -property:DeployExtension=false -property:Configuration=${{ steps.versions.outputs.product_configuration }}
- name: Unit Tests
run: dotnet test ./Tests/Reqnroll.VisualStudio.Tests/Reqnroll.VisualStudio.Tests.csproj ${{ steps.versions.outputs.test_params }}
- name: Upload vsix
uses: actions/upload-artifact@v3
with:
name: packages
path: "Reqnroll.VisualStudio.Package/**/*.vsix"
- name: Connector Tests
shell: pwsh
run: |
cd Tests/ExternalPackages
./buildExternalPackages.ps1
dotnet test ./Tests/Connector/Reqnroll.VisualStudio.ReqnrollConnector.Tests/Reqnroll.VisualStudio.ReqnrollConnector.Tests.csproj ${{ steps.versions.outputs.test_params }}
dotnet test ./Tests/Connector/Reqnroll.VisualStudio.ReqnrollConnector.V1.Tests/Reqnroll.VisualStudio.ReqnrollConnector.V1.Tests.csproj ${{ steps.versions.outputs.test_params }}
- name: Specs Tests
run: dotnet test ./Tests/Reqnroll.VisualStudio.Specs/Reqnroll.VisualStudio.Specs.csproj ${{ steps.versions.outputs.test_params }} --logger "trx;LogFileName=specs-results.trx"
- uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: specs-results
path: "**/specs-mstest-results.trx"
- uses: actions/upload-artifact@v3
if: success() || failure()
with:
name: specs-results
path: "**/specs-results.trx"
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Specs
path: "**/specs-results.trx"
reporter: dotnet-trx

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<ItemGroup>
<PackageReference Include="dnlib" Version="3.3.5" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Reqnroll.CustomPlugin" Version="1.0.0-pre20240124-54" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.7" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<ItemGroup>
<PackageReference Include="dnlib" Version="3.3.5" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="SpecFlow.CustomPlugin" Version="3.9.40" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.7" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public static void LogException(this IDeveroomLogger logger, IMonitoringService
public static void LogException(this IDeveroomLogger logger, Exception ex, string message = "Exception",
[CallerMemberName] string callerName = "???")
{
Debug.Fail(ex.ToString());
//Debug.Fail(ex.ToString());
var msg = new LogMessage(TraceLevel.Error, message, callerName, ex);
logger.Log(msg);
}
Expand Down

0 comments on commit d7c4d7a

Please sign in to comment.