Skip to content
Draft
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
42 changes: 21 additions & 21 deletions scripts/release-crate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ $script:TypeGroupMapping = @{

# Maps the final group key to a user-friendly header in the changelog.
$script:HeaderNameMapping = @{

@sandersaares Sander Saares (sandersaares) Sep 1, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is fundamentally wrong. We have no need to support PowerShell 5. If some infrastructure requires PowerShell 5 dependency, that infrastructure needs to be fixed. This limitation of being PowerShell 5 compatible is not acceptable to me without some extremely strong rationale.

'breaking' = '⚠️ Breaking';
'build' = 'πŸ—οΈ Build System';
'ci' = 'πŸ”„ Continuous Integration';
'docs' = 'πŸ“š Documentation';
'feat' = '✨ Features';
'fix' = 'πŸ› Bug Fixes';
'miscellaneous' = '🧩 Miscellaneous';
'perf' = '⚑ Performance';
'refactor' = '♻️ Code Refactoring';
'style' = '🎨 Styling';
'task' = 'βœ”οΈ Tasks';
'breaking' = 'Breaking';
'build' = 'Build System';
Comment thread
Vaiz marked this conversation as resolved.
'ci' = 'Continuous Integration';
'docs' = 'Documentation';
'feat' = 'Features';
'fix' = 'Bug Fixes';
'miscellaneous' = 'Miscellaneous';
'perf' = 'Performance';
'refactor' = 'Code Refactoring';
'style' = 'Styling';
'task' = 'Tasks';
}

# Defines the preferred order for commit type sections in the changelog.
Expand Down Expand Up @@ -422,17 +422,17 @@ function Update-CrateVersion {
}

$newVersion = $versionParts -join '.'
Write-Host "βœ… Incrementing $bumpType version from $currentVersion to $newVersion."
Write-Host "Incrementing $bumpType version from $currentVersion to $newVersion."
}
else {
$newVersion = $version
Write-Host "βœ… Using specified version: $newVersion."
Write-Host "Using specified version: $newVersion."
}

Write-Host "πŸ“ Updating '$crateCargoToml'..."
Write-Host "Updating '$crateCargoToml'..."
(Get-Content $crateCargoToml -Raw) -replace '(?<=version\s*=\s*")[^"]+', $newVersion | Set-Content $crateCargoToml -NoNewline

Write-Host "πŸ“ Updating '$rootCargoToml'..."
Write-Host "Updating '$rootCargoToml'..."

function Get-EscapedRegexSpecialChars($str) {
# Escape all regex metacharacters: . $ ^ { [ ( | ) * + ? \ /
Expand Down Expand Up @@ -516,7 +516,7 @@ function Write-Changelog {
($newVersionSection -join "`n") + "`n" +
$existingContent.Substring($insertPosition)
$newContent | Set-Content $changelogFile -NoNewline
Write-Host "βœ… Changelog updated at '$changelogFile'."
Write-Host "Changelog updated at '$changelogFile'."
return
}
}
Expand All @@ -526,7 +526,7 @@ function Write-Changelog {
$changelogContent = @("# Changelog", "")
$changelogContent += $newVersionSection
$changelogContent | Out-File -FilePath $changelogFile -Encoding utf8
Write-Host "βœ… Changelog created at '$changelogFile'."
Write-Host "Changelog created at '$changelogFile'."
}

function Update-Readme {
Expand All @@ -546,14 +546,14 @@ function Update-Readme {
return
}

Write-Host "πŸ“ Updating README.md..."
Write-Host "Updating README.md..."
Push-Location $crateFolder
try {
$result = cargo doc2readme --lib --template ../README.j2 2>&1
if ($LASTEXITCODE -ne 0) {
Write-Warning "Failed to generate README: $result"
} else {
Write-Host "βœ… README.md updated."
Write-Host "README.md updated."
}
}
finally {
Expand All @@ -575,7 +575,7 @@ function Show-DependentCratesWarning {
)

Write-Host ""
Write-Host "⚠️ SEMVER-INCOMPATIBLE RELEASE DETECTED" -ForegroundColor Yellow
Write-Host "WARNING: SEMVER-INCOMPATIBLE RELEASE DETECTED" -ForegroundColor Yellow
Write-Host "The version bump from $oldVersion to $newVersion is semver-incompatible." -ForegroundColor Yellow
Write-Host ""
Write-Host "The following workspace crates have a direct dependency on '$crateName'" -ForegroundColor Yellow
Expand All @@ -601,7 +601,7 @@ function Show-FinalMessage {
)

Write-Host "---" -ForegroundColor Green
Write-Host "πŸŽ‰ Success! Next steps:" -ForegroundColor Green
Write-Host "Success! Next steps:" -ForegroundColor Green
Write-Host "1. Review the changes in the updated files." -ForegroundColor Green
Write-Host "2. Commit the changes and push the changes:" -ForegroundColor Green
Write-Host " git add ." -ForegroundColor DarkGray
Expand Down
16 changes: 8 additions & 8 deletions scripts/run-examples.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ foreach ($pkg in $packages_to_process) {
$output = $result[0..($result.Length - 2)] -join "`n" # All output except exit code

if ($exit_code -eq 0) {
Write-Host "βœ“ Example '$example_name' in package '$pkg' completed successfully" -ForegroundColor Green
Write-Host "PASS: Example '$example_name' in package '$pkg' completed successfully" -ForegroundColor Green
$success_count++
}
else {
Write-Host "βœ— Example '$example_name' in package '$pkg' failed with exit code $exit_code" -ForegroundColor Red
Write-Host "FAIL: Example '$example_name' in package '$pkg' failed with exit code $exit_code" -ForegroundColor Red
if ($output.Trim() -ne "") {
Write-Host "Output:" -ForegroundColor Yellow
Write-Host $output -ForegroundColor DarkYellow
Expand All @@ -110,7 +110,7 @@ foreach ($pkg in $packages_to_process) {
}
}
else {
Write-Host "βœ— Example '$example_name' in package '$pkg' timed out after $timeout_seconds seconds" -ForegroundColor Red
Write-Host "FAIL: Example '$example_name' in package '$pkg' timed out after $timeout_seconds seconds" -ForegroundColor Red
$failures += "$pkg::$example_name (timeout)"
Stop-Job -Job $job
}
Expand All @@ -119,7 +119,7 @@ foreach ($pkg in $packages_to_process) {

}
catch {
Write-Host "βœ— Example '$example_name' in package '$pkg' failed with exception: $($_.Exception.Message)" -ForegroundColor Red
Write-Host "FAIL: Example '$example_name' in package '$pkg' failed with exception: $($_.Exception.Message)" -ForegroundColor Red
$failures += "$pkg::$example_name (exception: $($_.Exception.Message))"
}
}
Expand Down Expand Up @@ -155,11 +155,11 @@ foreach ($pkg in $packages_to_process) {
$output = $result[0..($result.Length - 2)] -join "`n" # All output except exit code

if ($exit_code -eq 0) {
Write-Host "βœ“ Example '$example_name' in package '$pkg' completed successfully" -ForegroundColor Green
Write-Host "PASS: Example '$example_name' in package '$pkg' completed successfully" -ForegroundColor Green
$success_count++
}
else {
Write-Host "βœ— Example '$example_name' in package '$pkg' failed with exit code $exit_code" -ForegroundColor Red
Write-Host "FAIL: Example '$example_name' in package '$pkg' failed with exit code $exit_code" -ForegroundColor Red
if ($output.Trim() -ne "") {
Write-Host "Output:" -ForegroundColor Yellow
Write-Host $output -ForegroundColor DarkYellow
Expand All @@ -168,7 +168,7 @@ foreach ($pkg in $packages_to_process) {
}
}
else {
Write-Host "βœ— Example '$example_name' in package '$pkg' timed out after $timeout_seconds seconds" -ForegroundColor Red
Write-Host "FAIL: Example '$example_name' in package '$pkg' timed out after $timeout_seconds seconds" -ForegroundColor Red
$failures += "$pkg::$example_name (timeout)"
Stop-Job -Job $job
}
Expand All @@ -177,7 +177,7 @@ foreach ($pkg in $packages_to_process) {

}
catch {
Write-Host "βœ— Example '$example_name' in package '$pkg' failed with exception: $($_.Exception.Message)" -ForegroundColor Red
Write-Host "FAIL: Example '$example_name' in package '$pkg' failed with exception: $($_.Exception.Message)" -ForegroundColor Red
$failures += "$pkg::$example_name (exception: $($_.Exception.Message))"
}
}
Expand Down
12 changes: 6 additions & 6 deletions scripts/test-anvil-container.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
.DESCRIPTION
Creates a throwaway repository in a temp directory, generates the anvil tree
into it with the locally-built cargo-anvil, and then does only what a
developer would do: run `just anvil-container <command…>` and observe what
developer would do: run `just anvil-container <command...>` and observe what
happens.

The setup phase is held to that standard deliberately. If this script has to
Expand All @@ -22,7 +22,7 @@
2. The first run builds an image and runs the recipe inside it.
3. A second run reuses the image (the tag resolves, nothing is built),
no cache volume masks the tools the image installed, and a host
GITHUB_TOKEN is forwarded β€” from the environment, or from the gh CLI
GITHUB_TOKEN is forwarded -- from the environment, or from the gh CLI
when the environment has none.
3b. A recipe run from a linked worktree can still reach git history.
4. Changing a hashed input (the pinned toolchain) selects a new tag.
Expand Down Expand Up @@ -123,8 +123,8 @@ function Invoke-Native {
-RedirectStandardOutput $stdoutFile -RedirectStandardError $stderrFile
$result = [pscustomobject]@{
ExitCode = $process.ExitCode
StdOut = (Get-Content -LiteralPath $stdoutFile -Raw -ErrorAction SilentlyContinue) ?? ''
StdErr = (Get-Content -LiteralPath $stderrFile -Raw -ErrorAction SilentlyContinue) ?? ''
StdOut = [string](Get-Content -LiteralPath $stdoutFile -Raw -ErrorAction SilentlyContinue)
StdErr = [string](Get-Content -LiteralPath $stderrFile -Raw -ErrorAction SilentlyContinue)
}
} finally {
Remove-Item -LiteralPath $stdoutFile, $stderrFile -Force -ErrorAction SilentlyContinue
Expand Down Expand Up @@ -217,7 +217,7 @@ function Test-ImagePresent([string]$Reference) {

function Remove-AnvilImages([string]$Prefix) {
$images = Invoke-Engine -Arguments @('images', '--format', '{{.Repository}}:{{.Tag}}') -AllowFailure
# Podman reports images fully qualified (`localhost/anvil-…`), docker does
# Podman reports images fully qualified (`localhost/anvil-...`), docker does
# not, so match anywhere in the reference rather than at the start.
$matching = ($images.StdOut -split "`r?`n") | Where-Object { $_ -like "*$Prefix*" }
foreach ($image in $matching) {
Expand Down Expand Up @@ -579,7 +579,7 @@ Assert-That 'content in a gap survives regeneration' ($afterRegen -match 'a repo
Assert-Equal 'the composed tag is unchanged by regeneration' $editedReference (Get-ImageReference -Repo $repo)

# Anvil never overwrites repository content, and a region body is no exception:
# an edit inside one is preserved, exactly as `updates.md` Β§2 preserves an
# an edit inside one is preserved, exactly as `updates.md` section 2 preserves an
# edited owned file. That is why the gaps matter -- editing inside a region
Comment thread
Vaiz marked this conversation as resolved.
# silently freezes the base digest and the tool pins at today's values while
# the tag keeps resolving, so the layout has to make the gaps the obvious place
Expand Down
4 changes: 2 additions & 2 deletions scripts/test-anvil-dogfood.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,8 @@ function Invoke-Native {
-RedirectStandardOutput $stdoutFile -RedirectStandardError $stderrFile
$result = [pscustomobject]@{
ExitCode = $process.ExitCode
StdOut = (Get-Content -LiteralPath $stdoutFile -Raw -ErrorAction SilentlyContinue) ?? ''
StdErr = (Get-Content -LiteralPath $stderrFile -Raw -ErrorAction SilentlyContinue) ?? ''
StdOut = [string](Get-Content -LiteralPath $stdoutFile -Raw -ErrorAction SilentlyContinue)
StdErr = [string](Get-Content -LiteralPath $stderrFile -Raw -ErrorAction SilentlyContinue)
}
} finally {
Remove-Item -LiteralPath $stdoutFile, $stderrFile -Force -ErrorAction SilentlyContinue
Expand Down
Loading