Skip to content

Commit

Permalink
CI: remove junit logger
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikSchierboom committed Jan 29, 2025
1 parent 83284a2 commit 2d71b51
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 22 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,3 @@ jobs:

- name: Run tests
run: pwsh bin/test.ps1

- name: Create test summary
uses: test-summary/action@31493c76ec9e7aa675f1585d3ed6f1da69269a86
with:
paths: build/**/results/**/*.xml
if: always()
23 changes: 7 additions & 16 deletions bin/test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -82,41 +82,32 @@ function Use-ExampleImplementation {
}
}

function Test-ExerciseImplementation($Exercise, $BuildDir, $ConceptExercisesDir, $PracticeExercisesDir, $IsCI) {
function Test-ExerciseImplementation($Exercise, $BuildDir, $ConceptExercisesDir, $PracticeExercisesDir) {
Write-Output "Running tests"

if (-Not $Exercise) {
Invoke-Tests -Path $BuildDir -IsCI $IsCI
Invoke-Tests -Path $BuildDir
}
elseif (Test-Path "${ConceptExercisesDir}/${Exercise}") {
Invoke-Tests -Path "${ConceptExercisesDir}/${Exercise}" -IsCI $IsCI
Invoke-Tests -Path "${ConceptExercisesDir}/${Exercise}"
}
elseif (Test-Path "${PracticeExercisesDir}/${Exercise}") {
Invoke-Tests -Path "${PracticeExercisesDir}/${Exercise}" -IsCI $IsCI
Invoke-Tests -Path "${PracticeExercisesDir}/${Exercise}"
}
else {
throw "Could not find exercise '${Exercise}'"
}
}

function Invoke-Tests($Path, $IsCI) {
if ($IsCI) {
Get-ChildItem -Path $Path -Include "*.csproj" -Recurse | ForEach-Object {
& dotnet add $_.FullName package JunitXml.TestLogger -v 4.1.0
}
& dotnet test $Path --logger "junit;LogFilePath=results/test.xml"
}
else {
& dotnet test $Path
}
function Invoke-Tests($Path) {
& dotnet test $Path
}


$buildDir = "${PSScriptRoot}/build"
$practiceExercisesDir = "${buildDir}/practice"
$conceptExercisesDir = "${buildDir}/concept"
$sourceDir = Resolve-Path "exercises"
$isCi = [System.Convert]::ToBoolean($env:CI)

Clean $buildDir
Copy-Exercise $sourceDir $buildDir
Expand All @@ -128,4 +119,4 @@ if (!$Exercise) {
}

Use-ExampleImplementation $conceptExercisesDir $practiceExercisesDir
Test-ExerciseImplementation -Exercise $Exercise -BuildDir $buildDir -ConceptExercisesDir $conceptExercisesDir -PracticeExercisesDir $practiceExercisesDir -IsCI $isCi
Test-ExerciseImplementation -Exercise $Exercise -BuildDir $buildDir -ConceptExercisesDir $conceptExercisesDir -PracticeExercisesDir $practiceExercisesDir

0 comments on commit 2d71b51

Please sign in to comment.