Skip to content
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
34 changes: 34 additions & 0 deletions .github/workflows/release-zip.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release zip

# Attaches the install zip (the main script plus Modules\, nothing else) to a
# release when it is published. Re-run by hand for an existing tag if needed.
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: Existing release tag to build the zip for (e.g. v1.1)
required: true

permissions:
contents: write

jobs:
zip:
name: Build and attach install zip
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name || inputs.tag }}

- name: Build and upload
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.event.release.tag_name || inputs.tag }}
run: |
zip="Manga-Conversion-Script-${TAG}.zip"
git archive --format=zip --prefix="Manga Conversion Script/" -o "$zip" HEAD "Conversion Script Main.ps1" Modules
unzip -l "$zip"
gh release upload "$TAG" "$zip" --clobber
42 changes: 42 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Tests

on:
pull_request:
push:
branches: [main]
workflow_dispatch:

permissions:
contents: read

jobs:
harnesses:
name: Harnesses
runs-on: windows-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4

# Windows PowerShell 5.1 (shell: powershell), the version the script targets.
# The harnesses build their own stand-in cjxl/magick, so no real tools are needed.
- name: Run every harness
shell: powershell
run: |
$failed = @()
foreach ($harness in Get-ChildItem -Path .\_Harness -Filter *.Harness.ps1 | Sort-Object Name) {
Write-Host ("::group::" + $harness.BaseName)
& powershell.exe -NoProfile -ExecutionPolicy Bypass -File $harness.FullName
$code = $LASTEXITCODE
Write-Host "::endgroup::"
if ($code -eq 0) {
Write-Host ("PASS " + $harness.BaseName)
} else {
Write-Host ("::error title=" + $harness.BaseName + "::exited with code " + $code)
$failed += $harness.BaseName
}
}
if ($failed.Count -gt 0) {
Write-Host ("Failed: " + ($failed -join ", "))
exit 1
}
Write-Host "All harnesses passed."
11 changes: 9 additions & 2 deletions _Harness/FileDeletion.Harness.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,15 @@ Write-Host "=== Scenario G: Move-ToRecycleBin target actually lands in the Recyc
$uniqueNameG = "filedeletion-harness-" + [guid]::NewGuid().ToString("N") + ".txt"
$fileG = New-ScratchFile -Name $uniqueNameG
$null = Move-ToRecycleBin -ItemPath $fileG
$foundInBinG = Test-ItemInRecycleBin -FileName $uniqueNameG
Test-Assert $foundInBinG "Move-ToRecycleBin's target is found in the real Windows Recycle Bin (genuinely recoverable, not just deleted)"
if ($env:GITHUB_ACTIONS -eq 'true') {
# GitHub's Windows runners run as a service with no interactive shell, so
# the Recycle Bin can't be browsed there. Check only that the file left.
Test-Assert (-not (Test-Path -LiteralPath $fileG)) "Move-ToRecycleBin's target is gone from its original location"
Write-Host " [SKIP] Recycle Bin lookup - not available on GitHub Actions runners" -ForegroundColor Yellow
} else {
$foundInBinG = Test-ItemInRecycleBin -FileName $uniqueNameG
Test-Assert $foundInBinG "Move-ToRecycleBin's target is found in the real Windows Recycle Bin (genuinely recoverable, not just deleted)"
}
Write-Host ""

# ==============================================================================
Expand Down
Loading