diff --git a/.github/fix-issue-6276/check-report.ps1 b/.github/fix-issue-6276/check-report.ps1 new file mode 100644 index 000000000..e5f371891 --- /dev/null +++ b/.github/fix-issue-6276/check-report.ps1 @@ -0,0 +1,59 @@ +# CI-only check for the #6276 follow-ups. Every #6276 spec must have run and passed: it fails on +# any missing, skipped or failed spec in the groups below, and writes a summary to the job. +param( + [Parameter(Mandatory)][string]$TestOutcome, + [Parameter(Mandatory)][string[]]$Reports +) +$ErrorActionPreference = 'Stop' + +# group (container text, or a spec name) = expected number of specs +$groups = [ordered]@{ + 'PlaylistsPathPatterns' = 19 # conf: Windows/Unix pattern conversion + 'PlaylistsPath validation' = 7 # conf: conf.LoadFromFile + 'InPath' = 35 # core/playlists: PR #6281 specs + scanner-built folders + 'Scanner - PlaylistsPath' = 22 # scanner: real folders, phase 1 + phase 4, recovery + "produces different hash when PlaylistsPath starts including the folder's playlists" = 1 + 'keeps the hash of a folder without playlists when PlaylistsPath changes' = 1 +} + +$specs = @() +$skipped = @() +foreach ($r in $Reports) { + if (-not (Test-Path $r)) { throw "Missing Ginkgo report: $r" } + foreach ($suite in (Get-Content $r -Raw | ConvertFrom-Json)) { + foreach ($spec in $suite.SpecReports) { + if ($spec.LeafNodeType -ne 'It') { continue } + $specs += $spec + if ($spec.State -eq 'skipped') { $skipped += "$($spec.ContainerHierarchyTexts -join ' > ') > $($spec.LeafNodeText)" } + } + } +} + +$problems = @() +$rows = @('| Group | Expected | Ran | Passed |', '|---|---|---|---|') +foreach ($g in $groups.Keys) { + $inGroup = @($specs | Where-Object { $_.ContainerHierarchyTexts -contains $g -or $_.LeafNodeText -eq $g }) + $passed = @($inGroup | Where-Object { $_.State -eq 'passed' }) + foreach ($s in ($inGroup | Where-Object { $_.State -ne 'passed' })) { + $problems += "$g > $($s.LeafNodeText): $($s.State)" + } + if ($inGroup.Count -ne $groups[$g]) { $problems += "$g : expected $($groups[$g]) specs, found $($inGroup.Count)" } + $rows += "| $g | $($groups[$g]) | $($inGroup.Count) | $($passed.Count) |" +} +if ($TestOutcome -ne 'success') { $problems += "Test step outcome: $TestOutcome" } + +$total = @($specs).Count +$summary = @("## #6276 follow-ups on $([System.Environment]::OSVersion.VersionString)", '', + "All specs in conf, core/playlists, scanner: $total ($(@($specs | Where-Object State -eq 'passed').Count) passed, $($skipped.Count) skipped). Test step: **$TestOutcome**", '') + $rows +if ($skipped.Count -gt 0) { + $summary += '', 'Skipped (pre-existing Windows skips, outside the #6276 groups):' + $summary += @($skipped | ForEach-Object { "- $_" }) +} +if ($problems.Count -eq 0) { + $summary += '', '**Result: every #6276 spec ran and passed.**' +} else { + $summary += '', '**Result: FAILED**' + $summary += @($problems | ForEach-Object { "- $_" }) +} +$summary -join "`n" | Tee-Object -Append -FilePath $env:GITHUB_STEP_SUMMARY +if ($problems.Count -gt 0) { exit 1 } diff --git a/.github/workflows/fix-issue-6276-windows.yml b/.github/workflows/fix-issue-6276-windows.yml new file mode 100644 index 000000000..651ba0863 --- /dev/null +++ b/.github/workflows/fix-issue-6276-windows.yml @@ -0,0 +1,65 @@ +# CI-only validation of the #6276 follow-ups to PR #6281 on a native Windows runner. Runs the full +# conf, core/playlists and scanner packages, then checks every #6276 spec ran and passed. +name: "Fix #6276: Windows PlaylistsPath" + +on: + push: + branches: + - t3code/fix-issue-6276-pr6281-followups + workflow_dispatch: + +permissions: + contents: read + +jobs: + windows: + name: Windows + runs-on: windows-2022 + timeout-minutes: 45 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 + with: + persist-credentials: false + + - uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6 + with: + go-version-file: go.mod + + - uses: msys2/setup-msys2@ec48f7c5447b3140e2b088413ae3a55687bccb6e # v2 + with: + msystem: MINGW64 + install: mingw-w64-x86_64-gcc + update: false + + - name: Add mingw64 to PATH + shell: bash + run: echo "C:/msys64/mingw64/bin" >> $GITHUB_PATH + + - name: Build test binaries + shell: bash + env: + CGO_ENABLED: "1" + run: | + go version + go test -count=1 -tags netgo,sqlite_fts5 -run '^$' ./conf/ ./core/playlists/ ./scanner/ + + - name: Test conf, core/playlists, scanner + id: test + shell: bash + env: + CGO_ENABLED: "1" + # Some suites change to the repo root, so use absolute report paths. All packages always run. + run: | + rc=0 + for pkg in conf:./conf/ playlists:./core/playlists/ scanner:./scanner/; do + go test -v -count=1 -timeout 15m -tags netgo,sqlite_fts5 "${pkg#*:}" -ginkgo.no-color \ + -ginkgo.json-report="$GITHUB_WORKSPACE/report-${pkg%%:*}.json" || rc=1 + done + exit $rc + + - name: Check every #6276 spec ran and passed + if: always() && steps.test.outcome != 'skipped' + shell: pwsh + run: > + ./.github/fix-issue-6276/check-report.ps1 -TestOutcome ${{ steps.test.outcome }} + -Reports report-conf.json, report-playlists.json, report-scanner.json