Skip to content

Merge branch 'master' of https://github.com/DavideWiest/ContextFlow #11

Merge branch 'master' of https://github.com/DavideWiest/ContextFlow

Merge branch 'master' of https://github.com/DavideWiest/ContextFlow #11

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: Build & Test
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build-and-test:
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: 7.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Run NUnit Tests
run: |
docker run --rm `
--workdir /app `
-v "$(pwd)/Tests:/app" `
-v "$(pwd)/testresults:/results" `
nunit/nunit3-reporting `
nunit3-console ContextFlow/bin/Debug/ContextFlow.dll --result=/results/test-results.xml
- name: Upload Test Results
uses: actions/upload-artifact@v2
with:
name: test-results
path: TestResults
- name: Check Test Results
run: |
$xml = [xml](Get-Content ./TestResults/test-results.xml)
$totalTests = [int]$xml.SelectSingleNode('//test-run').GetAttribute('total')
$passedTests = [int]$xml.SelectSingleNode('//test-run').GetAttribute('passed')
$failedTests = $totalTests - $passedTests
if ($failedTests -gt 0) {
Write-Host "Some tests failed."
exit 1
} else {
Write-Host "All tests passed."
}
- name: Set Workflow Status
if: failure()
run: echo "Tests failed"