-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7b86438
commit d7c4d7a
Showing
4 changed files
with
123 additions
and
3 deletions.
There are no files selected for viewing
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
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 | ||
|
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
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
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