Skip to content

Build

Build #1175

Workflow file for this run

name: Build
on:
schedule:
- cron: "13 23 * * *"
push:
branches:
- main
pull_request:
branches: [ main ]
workflow_dispatch:
inputs:
override:
description: 'Version Number'
required: true
default: '0.0.0'
jobs:
waitOld:
name: Wait For Older Runs To Complete
runs-on: ubuntu-latest
steps:
- name: Wait
id: wait
shell: pwsh
run: |
$runID = ${{ github.run_id }}
$endPoint = "https://api.github.com/repos/${{github.repository}}/actions/runs"
$timeout = New-TimeSpan -Minutes 60
$stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
do {
$result = Invoke-RestMethod -Uri $endPoint
$builds = $result.workflow_runs | Where-Object {$_.name -eq "Build" -and ($_.status -eq "in_progress" -or $_.status -eq "queued") -and $_.id -lt $runID}
# Check if there were any older build runs still going, if not we waited long enough
if (!$builds)
{
Write-Host "Are now top of the run queue"
return
}
Start-Sleep -s 60
Write-Host "Waited so far $($stopwatch.elapsed)"
} while ($stopwatch.elapsed -lt $timeout)
Write-Host "Waited more than an hour for earlier runs to complete, continuing action pipeline"
draftRelease:
name: Draft release
needs: waitOld
runs-on: ubuntu-latest
steps:
# Drafts your next Release notes as Pull Requests are merged into "main"
- uses: release-drafter/release-drafter@v5
if: github.event_name == 'push'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
getVersion:
name: Get package version
runs-on: ubuntu-latest
needs: draftRelease
outputs:
buildNumber: ${{ steps.ver.outputs.BUILD_NUMBER }}
steps:
- name: GetVersion
id: ver
shell: pwsh
run: |
if ("${{github.event.inputs.override}}")
{
Write-Host "Using manually entered override version"
$version = "${{ github.event.inputs.override}}"
}
else
{
$header = @{Authorization = 'Bearer ${{ secrets.GITHUB_TOKEN }}' }
$endPoint = "https://api.github.com/repos/${{github.repository}}/releases"
$info = Invoke-RestMethod -Uri $endPoint -Headers $header
$version = $info.name[0].Trim("v")
}
Write-Host "::set-output name=BUILD_NUMBER::$($version)"
test-untils:
name: Utils
needs: waitOld
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: builder
env:
GlobalMaqs:ConfigJsonEnvRunOverride: ENV
GlobalMaqs:ConfigJsonEnvRun: ENV
GlobalMaqs:ConfigJsonEnv: ENV
GlobalMaqs:EnvOnly: ENV
uses: ./.github/workflows/buildtest-action
with:
bt-param: 'Framework/UtilitiesUnitTests/UtilitiesUnitTests.csproj --settings Framework/Parallel.RunSettings --logger trx --results-directory "${{github.workspace}}/artifactTests/untils/testResults/" /p:CoverletOutput="${{github.workspace}}/artifactTests/untils/" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover'
- uses: actions/upload-artifact@v2
if: always()
name: "Upload test artifact"
with:
name: untilResults
path: |
artifactTests/untils/**/*.xml
artifactTests/untils/testResults/
test-winapp:
name: WinApp
needs: waitOld
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- name: Install Appium
run: npm install -g appium
- name: Run Appium
run: invoke-expression 'cmd /c start appium'
shell: pwsh
- id: builder
uses: ./.github/workflows/buildtest-action
with:
bt-param: 'Framework/AppiumUnitTests/AppiumUnitTests.csproj --settings Framework/Parallel.RunSettings --filter FullyQualifiedName~AppiumWinAppUnitTests --logger trx --results-directory "${{github.workspace}}/artifactTests/winapp/testResults/" /p:CoverletOutput="${{github.workspace}}/artifactTests/winapp/" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover'
- uses: actions/upload-artifact@v2
if: always()
name: "Upload test artifact"
with:
name: winappResults
path: |
artifactTests/winapp/**/*.xml
artifactTests/winapp/testResults/
test-appium:
name: Appium
# Skip when dependabot PR - Dependabot PRs cannot access action secrets
if: github.actor != 'dependabot[bot]'
needs: waitOld
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: builder
uses: ./.github/workflows/buildtest-action
with:
bt-param: 'Framework/AppiumUnitTests/AppiumUnitTests.csproj --settings Framework/SauceLabs.RunSettings --filter FullyQualifiedName!~AppiumWinAppUnitTests --logger trx --results-directory "${{github.workspace}}/artifactTests/appium/testResults/" /p:CoverletOutput="${{github.workspace}}/artifactTests/appium/" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover -- ''TestRunParameters.Parameter(name=\"AppiumCapsMaqs:sauce:options:accessKey\",value=\"${{ secrets.SAUCE }}\")'''
- uses: actions/upload-artifact@v2
if: always()
name: "Upload test artifact"
with:
name: appiumResults
path: |
artifactTests/appium/**/*.xml
artifactTests/appium/testResults/
test-base:
name: Base
needs: waitOld
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: builder
uses: ./.github/workflows/buildtest-action
with:
bt-param: 'Framework/BaseTestUnitTests/BaseTestUnitTests.csproj --settings Framework/Parallel.RunSettings --logger trx --results-directory "${{github.workspace}}/artifactTests/base/testResults/" /p:CoverletOutput="${{github.workspace}}/artifactTests/base/" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover'
- uses: actions/upload-artifact@v2
if: always()
name: "Upload test artifact"
with:
name: baseResults
path: |
artifactTests/base/**/*.xml
artifactTests/base/testResults/
test-webservice:
name: WebService
needs: waitOld
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: |
3.1.x
6.x.x
- name: Start test service
run: Start-Process -FilePath "dotnet" -ArgumentList "run --project Docker/MAQSService/MainTestService/MainTestService.csproj"
shell: pwsh
- id: builder
uses: ./.github/workflows/buildtest-action
with:
bt-param: 'Framework/WebServiceUnitTests/WebServiceUnitTests.csproj --settings Framework/Parallel.RunSettings --logger trx --results-directory "${{github.workspace}}/artifactTests/webservice/testResults/" /p:CoverletOutput="${{github.workspace}}/artifactTests/webservice/" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover'
- uses: actions/upload-artifact@v2
if: always()
name: "Upload test artifact"
with:
name: webserviceResults
path: |
artifactTests/webservice/**/*.xml
artifactTests/webservice/testResults/
test-playwright:
name: Playwright
needs: waitOld
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install Playwright
run: |
npx playwright install --with-deps
dotnet build Framework/PlaywrightTests/PlaywrightTests.csproj -o Framework/PlaywrightTests/build
pwsh Framework/PlaywrightTests/build/playwright.ps1 install
- id: builder
uses: ./.github/workflows/buildtest-action
with:
bt-param: 'Framework/PlaywrightTests/PlaywrightTests.csproj --settings Framework/Parallel.RunSettings --logger trx --results-directory "${{github.workspace}}/artifactTests/Playwright/testResults/" /p:CoverletOutput="${{github.workspace}}/artifactTests/Playwright/" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover'
artifact-name: 'playwright'
- uses: actions/upload-artifact@v2
if: always()
name: "Upload test artifact"
with:
name: playwrightResults
path: |
artifactTests/Playwright/**/*.xml
artifactTests/Playwright/testResults/
test-mongo:
name: Mongo
needs: waitOld
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the docker-compose stack
run: docker-compose -f Docker/MAQSMongoDB/docker-compose.yml -p CognizantOpenSource/maqs-dotnet up -d
- id: builder
uses: ./.github/workflows/buildtest-action
with:
bt-param: 'Framework/MongoDBUnitTests/MongoDBUnitTests.csproj --settings Framework/Parallel.RunSettings --logger trx --results-directory "${{github.workspace}}/artifactTests/mongo/testResults/" /p:CoverletOutput="${{github.workspace}}/artifactTests/mongo/" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover'
artifact-name: 'mongo'
- uses: actions/upload-artifact@v2
if: always()
name: "Upload test artifact"
with:
name: mongoResults
path: |
artifactTests/mongo/**/*.xml
artifactTests/mongo/testResults/
test-database:
name: Database
needs: waitOld
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the docker-compose stack
run: docker-compose -f Docker/MAQSSQLServer/docker-compose.yml -p CognizantOpenSource/maqs-dotnet up -d
- id: builder
uses: ./.github/workflows/buildtest-action
with:
bt-param: 'Framework/DatabaseUnitTests/DatabaseUnitTests.csproj --settings Framework/Parallel.RunSettings --logger trx --results-directory "${{github.workspace}}/artifactTests/database/testResults/" /p:CoverletOutput="${{github.workspace}}/artifactTests/database/" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover'
artifact-name: 'database'
- uses: actions/upload-artifact@v2
if: always()
name: "Upload test artifact"
with:
name: databaseResults
path: |
artifactTests/database/**/*.xml
artifactTests/database/testResults/
test-email:
name: Email
needs: waitOld
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the docker-compose stack
run: docker-compose -f Docker/MAQSEmail/docker-compose.yml -p CognizantOpenSource/maqs-dotnet up -d
- id: builder
uses: ./.github/workflows/buildtest-action
with:
bt-param: 'Framework/EmailUnitTests/EmailUnitTests.csproj --settings Framework/Parallel.RunSettings --logger trx --results-directory "${{github.workspace}}/artifactTests/email/testResults/" /p:CoverletOutput="${{github.workspace}}/artifactTests/email/" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover'
artifact-name: 'email'
- uses: actions/upload-artifact@v2
if: always()
name: "Upload test artifact"
with:
name: emailResults
path: |
artifactTests/email/**/*.xml
artifactTests/email/testResults/
test-framework:
name: Framework
needs: waitOld
runs-on: windows-2019
steps:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: |
3.1.x
6.x.x
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install Playwright
run: |
npx playwright install --with-deps
dotnet build Framework/FrameworkUnitTests/FrameworkUnitTests.csproj -o Framework/FrameworkUnitTests/build
pwsh Framework/FrameworkUnitTests/build/playwright.ps1 install
- run: dotnet restore Framework/FrameworkUnitTests/FrameworkUnitTests.csproj
shell: pwsh
- id: browserupdate
uses: ./.github/workflows/setupwinbrowser-action
- id: testframework
uses: ./.github/workflows/buildtest-action
with:
bt-param: 'Framework/FrameworkUnitTests/FrameworkUnitTests.csproj -f net471 --settings Framework/Parallel.RunSettings --logger trx --results-directory "${{github.workspace}}/artifactTests/framework/testResults/"'
- id: testcore
uses: ./.github/workflows/buildtest-action
with:
bt-param: 'Framework/FrameworkUnitTests/FrameworkUnitTests.csproj -f netcoreapp3.1 --settings Framework/Parallel.RunSettings --logger trx --results-directory "${{github.workspace}}/artifactTests/framework/testResults/" /p:CoverletOutput="${{github.workspace}}/artifactTests/framework/" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover'
- uses: actions/upload-artifact@v2
if: always()
name: "Upload test artifact"
with:
name: frameworkResults
path: |
artifactTests/framework/**/*.xml
artifactTests/framework/testResults/
test-specflow:
name: SpecFlow
needs: waitOld
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: browserupdate
uses: ./.github/workflows/setuplinbrowser-action
- id: builder
uses: ./.github/workflows/buildtest-action
with:
bt-param: 'Framework/SpecFlowExtensionUnitTests/SpecFlowExtensionUnitTests.csproj --settings Framework/Parallel.RunSettings --logger trx --results-directory "${{github.workspace}}/artifactTests/specflow/testResults/" /p:CoverletOutput="${{github.workspace}}/artifactTests/specflow/" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover'
- uses: actions/upload-artifact@v2
if: always()
name: "Upload test artifact"
with:
name: specflowResults
path: |
artifactTests/specflow/**/*.xml
artifactTests/specflow/testResults/
test-composite:
name: Composite
needs: waitOld
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: browserupdate
uses: ./.github/workflows/setuplinbrowser-action
- name: Build the docker-compose mongo stack
run: docker-compose -f Docker/MAQSMongoDB/docker-compose.yml -p CognizantOpenSource/maqs-dotnet up -d
- name: Build the docker-compose email stack
run: docker-compose -f Docker/MAQSEmail/docker-compose.yml -p CognizantOpenSource/maqs-dotnet up -d
- id: builder
uses: ./.github/workflows/buildtest-action
with:
bt-param: 'Framework/CompositeUnitTests/CompositeUnitTests.csproj --settings Framework/Parallel.RunSettings --logger trx --results-directory "${{github.workspace}}/artifactTests/composite/testResults/" /p:CoverletOutput="${{github.workspace}}/artifactTests/composite/" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover'
- uses: actions/upload-artifact@v2
if: always()
name: "Upload test artifact"
with:
name: compositeResults
path: |
artifactTests/composite/**/*.xml
artifactTests/composite/testResults/
test-specflownunit:
name: SpecFlow NUnit
needs: waitOld
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: browserupdate
uses: ./.github/workflows/setuplinbrowser-action
- id: builder
uses: ./.github/workflows/buildtest-action
with:
bt-param: 'Framework/SpecFlowExtensionNUnitTests/SpecFlowExtensionNUnitTests.csproj --settings Framework/Parallel.RunSettings --logger trx --results-directory "${{github.workspace}}/artifactTests/specflownunit/testResults/" /p:CoverletOutput="${{github.workspace}}/artifactTests/specflownunit/" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover'
- uses: actions/upload-artifact@v2
if: always()
name: "Upload test artifact"
with:
name: specflownunitResults
path: |
artifactTests/specflownunit/**/*.xml
artifactTests/specflownunit/testResults/
test-selenpomlazy:
name: Selenium POM and Lazy
needs: waitOld
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: browserupdate
uses: ./.github/workflows/setuplinbrowser-action
- id: builder
uses: ./.github/workflows/buildtest-action
with:
bt-param: 'Framework/SeleniumUnitTests/SeleniumUnitTests.csproj --settings Framework/Parallel.RunSettings --filter "(FullyQualifiedName~SeleniumUnitTests.LazyElementUnitTests)|(FullyQualifiedName~SeleniumPageObjectUnitTest)|(FullyQualifiedName~SeleniumWebElementTest)|(FullyQualifiedName~Proxy)" --logger trx --results-directory "${{github.workspace}}/artifactTests/selenpomlazy/testResults/" /p:CoverletOutput="${{github.workspace}}/artifactTests/selenpomlazy/" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover'
- uses: actions/upload-artifact@v2
if: always()
name: "Upload test artifact"
with:
name: pomlazyResults
path: |
artifactTests/selenpomlazy/**/*.xml
artifactTests/selenpomlazy/testResults/
test-selenutil:
name: Selenium Utils
needs: waitOld
runs-on: windows-2019
steps:
- uses: actions/checkout@v2
- run: dotnet restore Framework/Base.sln
shell: pwsh
- run: choco upgrade firefox
shell: pwsh
- id: browserupdate
uses: ./.github/workflows/setupwinbrowser-action
- id: builder
uses: ./.github/workflows/buildtest-action
with:
bt-param: 'Framework/SeleniumUnitTests/SeleniumUnitTests.csproj --settings Framework/Parallel.RunSettings --filter "(FullyQualifiedName~SeleniumUnitTests.SeleniumNUnitTest)|(FullyQualifiedName~SeleniumUnitTests.SeleniumUnitTest)|(FullyQualifiedName~SeleniumUnitTests.SeleniumUtilsTest)|(FullyQualifiedName~SeleniumUnitTests.SeleniumConfigTests)" --logger trx --results-directory "${{github.workspace}}/artifactTests/selenutil/testResults/" /p:CoverletOutput="${{github.workspace}}/artifactTests/selenutil/" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover'
- uses: actions/upload-artifact@v2
if: always()
name: "Upload test artifact"
with:
name: selenutilResults
path: |
artifactTests/selenutil/**/*.xml
artifactTests/selenutil/testResults/
test-selengen:
name: Selenium General
# Skip when dependabot PR - Dependabot PRs cannot access action secrets
if: github.actor != 'dependabot[bot]'
needs: waitOld
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: browserupdate
uses: ./.github/workflows/setuplinbrowser-action
- run: |
Write-Host "Installing/Updating Firefox"
sudo apt-get --only-upgrade install firefox
shell: pwsh
- id: builder
uses: ./.github/workflows/buildtest-action
with:
bt-param: 'Framework/SeleniumUnitTests/SeleniumUnitTests.csproj --settings Framework/SauceLabs.RunSettings --filter "(FullyQualifiedName!~SeleniumNUnitTest)&(FullyQualifiedName!~Proxy)&(FullyQualifiedName!~SeleniumConfigTests)&(FullyQualifiedName!~SeleniumPageObjectUnitTest)&(FullyQualifiedName!~LazyElementUnitTests)&(FullyQualifiedName!~SeleniumUnitTests.SeleniumUnitTest)&(FullyQualifiedName!~SeleniumWebElementTest)&(FullyQualifiedName!~SeleniumUtilsTest)" --logger trx --results-directory "${{github.workspace}}/artifactTests/selengen/testResults/" /p:CoverletOutput="${{github.workspace}}/artifactTests/selengen/" /p:CollectCoverage=true /p:CoverletOutputFormat=opencover -- ''TestRunParameters.Parameter(name=\"RemoteSeleniumCapsMaqs:sauce:options:accessKey\",value=\"${{ secrets.SAUCE }}\")'' ''TestRunParameters.Parameter(name=\"SeleniumMaqs:RunOnSauceLabs\",value=\"YES\")'''
- uses: actions/upload-artifact@v2
if: always()
name: "Upload test artifact"
with:
name: selengenResults
path: |
artifactTests/selengen/**/*.xml
artifactTests/selengen/testResults/
sonar:
name: Sonar
# Skip when dependabot PR - Dependabot PRs cannot access action secrets
if: github.actor != 'dependabot[bot]'
runs-on: windows-2019
needs: [test-appium, test-winapp, test-untils, test-mongo, test-database, test-webservice, test-base, test-playwright, test-email, test-framework, test-specflow, test-specflownunit, test-composite, test-selenpomlazy, test-selenutil, test-selengen, getVersion]
steps:
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 1.11
- uses: actions/checkout@v2
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- uses: actions/download-artifact@v2
with:
path: ${{ github.workspace }}/Results
- name: Update coverage mappings
shell: pwsh
run: |
$rootPath = "${{ github.workspace }}/Results"
$sourcePath = "${{ github.workspace }}"
Write-Host "Start updating relative paths"
Function Replace($path, $pattern, $replace)
{
$text = (Get-Content $path) -join "`n"
[System.Text.RegularExpressions.Regex]::Replace($text, $pattern, $replace) | Out-File -encoding ASCII $path
}
$files = Get-ChildItem -Path $rootPath -Recurse -Include *.xml
foreach ($file in $files)
{
Write-Host "Updating" $file
Replace $file.FullName '(?<=fullPath=")(([-\w\d\s/\\:]+)(?=[\\/][Ff]ramework))' $sourcePath
Replace $file.FullName '(?<=fullPath="[-\w\d\s/.\\:]+)((/)(?=[-\w\d\s/.]+"))' "\"
}
$files = Get-ChildItem -Path $rootPath -Recurse -Include *.trx
foreach ($file in $files)
{
Write-Host "Updating" $file
Replace $file.FullName '(?<=codeBase=")(([-\w\d\s/\\:]+)(?=[\\/][Ff]ramework))' $sourcePath
Replace $file.FullName '(?<=codeBase="[-\w\d\s/.\\:]+)((/)(?=[-\w\d\s/.]+"))' "\"
Replace $file.FullName '(?<=storage=")(([-\w\d\s/\\:]+)(?=[\\/][Ff]ramework))' $sourcePath.ToLower()
Replace $file.FullName '(?<=storage="[-\w\d\s/.\\:]+)((/)(?=[-\w\d\s/.]+"))' "\"
}
Write-Host "Finished updating relative paths"
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~\sonar\cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache SonarCloud scanner
id: cache-sonar-scanner
uses: actions/cache@v1
with:
path: .\.sonar\scanner
key: ${{ runner.os }}-sonar-scanner
restore-keys: ${{ runner.os }}-sonar-scanner
- name: Install SonarCloud scanner
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
shell: powershell
run: |
New-Item -Path .\.sonar\scanner -ItemType Directory
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
shell: powershell
run: |
.\.sonar\scanner\dotnet-sonarscanner begin /k:"CognizantOpenSource_maqs-dotnet" /o:"cognizantopensource" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:projectVersion="${{ needs.getVersion.outputs.buildNumber }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths=${{ github.workspace }}\Results\**\coverage*.opencover.xml /d:sonar.cs.dotcover.reportsPaths=${{ github.workspace }}\Results\**\*.coverage
dotnet build Framework/Base.sln -p:Version=${{ needs.getVersion.outputs.buildNumber }}
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}"
report:
name: Report
runs-on: ubuntu-latest
needs: [test-appium, test-winapp, test-untils, test-mongo, test-database, test-webservice, test-base, test-email, test-playwright, test-framework, test-specflow, test-specflownunit, test-composite, test-selenpomlazy, test-selenutil, test-selengen]
if: always()
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
path: ${{ github.workspace }}/Results
- name: Test Report
# Skip because dependabot cannot access the associated resources
if: github.actor != 'dependabot[bot]'
uses: dorny/test-reporter@v1
continue-on-error: true
with:
name: ReportResults
path: ${{ github.workspace }}/Results/**/*.trx # Path to test results
reporter: dotnet-trx
createNugetPacakges:
name: Create NuGet pacakges
runs-on: windows-2019
needs: [getVersion]
steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.101
- name: Install dependencies
run: dotnet restore Framework/Base.sln
- name: Build
run: |
dotnet build Framework/Base.sln --no-restore --configuration Release -p:Version=${{needs.getVersion.outputs.buildNumber}} -p:BaseOutputPath="${{github.workspace}}/artifactTests/packages/"
- uses: actions/upload-artifact@v2
if: always()
name: "Upload NuGet packages artifact"
with:
name: packages
path: |
artifactTests/packages/**/*.nupkg
artifactTests/packages/**/*.snupkg
publish:
name: Publish NuGet - v${{ needs.getVersion.outputs.buildNumber }}
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.event_name != 'schedule'
needs: [getVersion, createNugetPacakges, sonar]
runs-on: windows-2019
environment: nuget
steps:
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.101
- uses: actions/download-artifact@v2
with:
name: 'packages'
path: ${{ github.workspace }}/packages
- name: Deploy to nuget
run: dotnet nuget push ${{ github.workspace }}/packages/**/*.nupkg --api-key ${{ secrets.APIKEY }} --source https://api.nuget.org/v3/index.json
- name: Publish GitHub release v${{ needs.getVersion.outputs.buildNumber }}
uses: actions/github-script@v4
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const result = await github.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo
})
var id = "NA"
var data = result.data
for(var key in data){
if(data[key].tag_name == "v${{ needs.getVersion.outputs.buildNumber }}" && data[key].draft == true)
{
github.repos.updateRelease({
release_id: data[key].id,
"draft": false,
owner: context.repo.owner,
repo: context.repo.repo });
return;
}
}
console.error("Failed to find related draft release");