Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: remove junit logger #2351

Merged
merged 1 commit into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading