Skip to content

Add Windows runner to bsdtar wf#2813

Merged
ChanTsune merged 1 commit into
mainfrom
ci/bsdtar-compat/add-windows
Mar 8, 2026
Merged

Add Windows runner to bsdtar wf#2813
ChanTsune merged 1 commit into
mainfrom
ci/bsdtar-compat/add-windows

Conversation

@ChanTsune
Copy link
Copy Markdown
Owner

@ChanTsune ChanTsune commented Mar 7, 2026

Summary by CodeRabbit

  • Chores
    • Extended test infrastructure to support Windows platform alongside Linux runners
    • Refactored automated testing workflows using matrix strategy for consistent multi-platform coverage

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 7, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The GitHub Actions workflow .github/workflows/bsdtar-compat.yml is refactored to support multi-platform CI/CD via matrix strategies. Both the bsdtar-reference and pna-stdio jobs are converted to use platform matrices (Ubuntu and Windows) with platform-specific shells, dependencies, binary paths, and artifact naming conventions.

Changes

Cohort / File(s) Summary
Matrix Strategy & Platform Configuration
.github/workflows/bsdtar-compat.yml
Both bsdtar-reference and pna-stdio jobs converted to use matrix strategies with platform-specific configurations: Ubuntu runners paired with bash shells and Windows runners paired with PowerShell. Added exe_suffix matrix field for Windows binary naming and extended job timeout.
Platform-Specific Dependencies & Setup
.github/workflows/bsdtar-compat.yml
Introduced Windows-specific dependency installation (pacman, MinGW toolchain), separate build and test execution paths for Windows vs non-Windows platforms, and Git configuration steps per matrix. Added temporary build directories for Windows builds.
Binary Path & Environment Propagation
.github/workflows/bsdtar-compat.yml
Updated binary discovery and environment variable propagation to be matrix-aware: BSDTAR_BIN, BSDTAR_TEST_BIN, PNA_BIN, and XTASK_BIN are now recorded per matrix. Introduced matrix-scoped binary path references and pnatar wrapper creation per platform. Converted reference file directories (LIBARCHIVE_REFDIR, PNA_REFDIR) to matrix-aware workspace paths.
Artifact Naming & Summary Updates
.github/workflows/bsdtar-compat.yml
Artifact uploads and summary headers now include matrix name for clarity (e.g., bsdtar-test-artifacts-${{ matrix.name }}), enabling per-platform artifact tracking and result reporting.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 Hops through workflows with glee,
Matrix magic, now on Windows and Linux spree,
Binaries dancing on each OS stage,
Multi-platform tests now engage!
Cross-platform dreams, no more delay,
This workflow's ready to play! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Add Windows runner to bsdtar wf' clearly and specifically describes the main change: adding Windows runner support to the bsdtar workflow.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ci/bsdtar-compat/add-windows

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/bsdtar-compat.yml:
- Line 69: The workflow uses step-level "shell: ${{ matrix.shell }}" and similar
uses of "matrix.shell" (and "defaults.run.shell") which GitHub Actions disallows
because "shell" cannot contain expressions; fix by removing expression
interpolation from all "shell:" keys (instances referencing matrix.shell at
lines reported) and instead implement per-shell behavior by either (a) splitting
into separate jobs per shell value in the strategy matrix and hardcoding a
literal shell in each job, or (b) keep a single concrete shell (e.g., bash) and
drive platform-specific commands via environment variables or conditional logic
inside the "run:" script; update all affected "shell:" occurrences and any
defaults.run.shell usage to one of these patterns and ensure any conditional
gating uses "if:" or separate jobs rather than interpolated "shell:" values.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9f393895-137e-4e5a-aeaa-74fb693157d1

📥 Commits

Reviewing files that changed from the base of the PR and between 6ff4344 and 7b5f03c.

📒 Files selected for processing (1)
  • .github/workflows/bsdtar-compat.yml

Comment thread .github/workflows/bsdtar-compat.yml Outdated
@github-actions github-actions Bot added the CI Pull requests that update CI config label Mar 7, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/bsdtar-compat.yml:
- Around line 70-83: The Windows dependency installation step named "Install
build dependencies (Windows)" is missing autotools; update the pacman install
list in that step to include autoconf, automake, and libtool so the subsequent
libarchive build commands (./build/autogen.sh and ./configure) can run
successfully.
- Around line 160-175: The Windows dependency install step "Install dependencies
(Windows)" (runs when matrix.windows is true) is missing autotools needed to
build libarchive; update the pacman package list in that step to include
autoconf, automake, and libtool so the libarchive build can run successfully.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5171243e-4f4c-42f7-b39c-0e16e0929678

📥 Commits

Reviewing files that changed from the base of the PR and between 7b5f03c and a9ac723.

📒 Files selected for processing (1)
  • .github/workflows/bsdtar-compat.yml

Comment thread .github/workflows/bsdtar-compat.yml Outdated
Comment thread .github/workflows/bsdtar-compat.yml Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
.github/workflows/bsdtar-compat.yml (1)

56-58: ⚠️ Potential issue | 🔴 Critical

The defaults.run.shell does not support expression interpolation.

GitHub Actions docs explicitly state: "You cannot use contexts or expressions in this keyword." This pattern will fail workflow validation.

The same issue applies to the pna-stdio job at lines 148-150.

Consider either:

  • Using separate jobs per platform with hardcoded shell values
  • Using a fixed shell (e.g., bash) and handling platform differences via environment variables or conditional logic within run scripts
  • Using step-level if conditions with separate steps per platform that have hardcoded shells

,

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/bsdtar-compat.yml around lines 56 - 58, The workflow uses
expression interpolation in defaults.run.shell (and similarly in the pna-stdio
job) which is invalid; remove the expression usage and replace it by either (a)
hardcoding the shell per job (create separate jobs per platform and set
run.shell to the concrete value), (b) set a fixed cross-platform shell (e.g.,
bash) in defaults.run.shell and handle platform differences inside run scripts,
or (c) move the conditional logic down to step-level and create separate steps
with hardcoded shell values; update references to defaults.run.shell and the
pna-stdio job accordingly so no expression interpolation remains.
🧹 Nitpick comments (1)
.github/workflows/bsdtar-compat.yml (1)

337-348: Consider grep -oP availability on Windows MSYS2.

The grep -oP (Perl regex) is used throughout the summary generation. While MSYS2's default grep package typically supports PCRE, this could fail if the pcre package is not installed.

Consider adding pcre to the Windows dependencies, or use POSIX-compatible alternatives like sed or awk for extraction.

Alternative using awk for better portability
-          LAST_TEST=$(grep -oP '^\s+\d+: \K\S+' bsdtar_test_output.txt | tail -1 || echo "unknown")
+          LAST_TEST=$(awk '/^[[:space:]]+[0-9]+:/ {sub(/^[[:space:]]+[0-9]+: /, ""); print $1}' bsdtar_test_output.txt | tail -1)
+          LAST_TEST=${LAST_TEST:-unknown}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/bsdtar-compat.yml around lines 337 - 348, The summary
generation uses grep -oP (Perl regex), which can fail on Windows/MSYS2 if PCRE
support is missing; update the aggregation loops that read from
bsdtar_test_output.txt (the blocks populating TOTAL, FAILED, ASSERTIONS,
ASSERT_FAIL, SKIPS) to avoid grep -oP. Replace each grep -oP invocation with a
POSIX-friendly extraction (e.g., use awk or sed to match the label like "Tests
run:", "Tests failed:", "Assertions checked:", "Assertions failed:", "Skips
reported:" and print the numeric field) or alternatively ensure the Windows job
installs the pcre-enabled grep by adding the pcre/pcregrep dependency to the
Windows setup; pick one approach and apply it consistently to the loops that
feed TOTAL, FAILED, ASSERTIONS, ASSERT_FAIL, and SKIPS.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In @.github/workflows/bsdtar-compat.yml:
- Around line 56-58: The workflow uses expression interpolation in
defaults.run.shell (and similarly in the pna-stdio job) which is invalid; remove
the expression usage and replace it by either (a) hardcoding the shell per job
(create separate jobs per platform and set run.shell to the concrete value), (b)
set a fixed cross-platform shell (e.g., bash) in defaults.run.shell and handle
platform differences inside run scripts, or (c) move the conditional logic down
to step-level and create separate steps with hardcoded shell values; update
references to defaults.run.shell and the pna-stdio job accordingly so no
expression interpolation remains.

---

Nitpick comments:
In @.github/workflows/bsdtar-compat.yml:
- Around line 337-348: The summary generation uses grep -oP (Perl regex), which
can fail on Windows/MSYS2 if PCRE support is missing; update the aggregation
loops that read from bsdtar_test_output.txt (the blocks populating TOTAL,
FAILED, ASSERTIONS, ASSERT_FAIL, SKIPS) to avoid grep -oP. Replace each grep -oP
invocation with a POSIX-friendly extraction (e.g., use awk or sed to match the
label like "Tests run:", "Tests failed:", "Assertions checked:", "Assertions
failed:", "Skips reported:" and print the numeric field) or alternatively ensure
the Windows job installs the pcre-enabled grep by adding the pcre/pcregrep
dependency to the Windows setup; pick one approach and apply it consistently to
the loops that feed TOTAL, FAILED, ASSERTIONS, ASSERT_FAIL, and SKIPS.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b465a91f-a678-4afd-9aa7-3e3b4e9cdc66

📥 Commits

Reviewing files that changed from the base of the PR and between a9ac723 and 143dd6c.

📒 Files selected for processing (5)
  • .github/workflows/bsdtar-compat.yml
  • cli/src/command/core.rs
  • cli/src/command/diff.rs
  • cli/src/utils/fs/file_id.rs
  • cli/src/utils/fs/owner.rs
💤 Files with no reviewable changes (1)
  • cli/src/utils/fs/file_id.rs

@github-actions github-actions Bot added the cli This issue is about cli application label Mar 8, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
.github/workflows/bsdtar-compat.yml (2)

250-252: Inconsistent shell handling compared to "Build pna" step.

The "Build pna" step (lines 214-219) explicitly uses shell: pwsh for Windows, but this step relies on the default shell. For consistency and reliability, consider adding a Windows-specific step with shell: pwsh override.

♻️ Proposed fix for consistent Windows handling
       - name: Build tar2pna
+        if: ${{ !matrix.windows }}
         run: cargo build --locked --release -p xtask
         working-directory: pna
+
+      - name: Build tar2pna (Windows)
+        if: ${{ matrix.windows }}
+        shell: pwsh
+        run: cargo build --locked --release -p xtask
+        working-directory: pna
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/bsdtar-compat.yml around lines 250 - 252, The "Build
tar2pna" job step named "Build tar2pna" is missing an explicit Windows shell
override and is inconsistent with the "Build pna" step; update the workflow to
add a Windows-specific variant or conditional for this step that sets shell:
pwsh (matching the "Build pna" behavior) when running on windows-latest, or
include a matrix/if conditional that uses shell: pwsh for runner.os == 'Windows'
so the cargo build --locked --release -p xtask command in the pna
working-directory runs under PowerShell on Windows.

267-271: Consider creating platform-specific wrappers for robust cross-platform execution.

The pnatar wrapper is a Unix shell script with #!/bin/sh shebang. While the workflow runs within an MSYS2 bash environment on Windows (which provides POSIX compatibility), relying on this context is fragile. When bsdtar_test (a MinGW64-compiled binary) invokes the script via its -p flag, Windows may not properly interpret the shebang depending on how the executable spawns processes.

Creating platform-appropriate wrappers ensures the solution works consistently regardless of MSYS2 implementation details:

Suggested approach: Platform-specific wrappers
      - name: Create pnatar wrapper
+       if: ${{ !matrix.windows }}
        run: |
          WORKSPACE="$(pwd)"
          printf '#!/bin/sh\nexec "%s" --log-level error experimental stdio --unstable "$@"\n' "${PNA_BIN}" > "${WORKSPACE}/pnatar"
          chmod +x "${WORKSPACE}/pnatar"
+
+     - name: Create pnatar wrapper (Windows)
+       if: ${{ matrix.windows }}
+       shell: pwsh
+       run: |
+         $pnaBin = "$env:PNA_BIN" -replace '\\', '/'
+         @"
+         `@echo` off
+         "$pnaBin" --log-level error experimental stdio --unstable %*
+         "@ | Set-Content -Path "pnatar.cmd" -Encoding ASCII
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/bsdtar-compat.yml around lines 267 - 271, The current
pnatar wrapper created by the workflow is a Unix shell script (pnatar) which can
be fragile on Windows; update the workflow step that creates pnatar to emit
platform-specific wrappers: when on Unix produce the existing shell script using
PNA_BIN and chmod +x it, and when on Windows produce a .bat wrapper (e.g.,
pnatar.bat) that forwards arguments to "%PNA_BIN%" /p or the equivalent
invocation so MinGW/bsdtar_test's use of the -p flag will work; ensure the
workflow uses the appropriate wrapper name (pnatar on Unix, pnatar.bat on
Windows) where bsdtar_test invokes the helper and set the file names/permissions
accordingly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/bsdtar-compat.yml:
- Line 346: The current artifact copy step only targets /tmp (cp -rf
/tmp/bsdtar* artifact-staging/) and will miss Windows temp files; update the
workflow to also copy from the Windows temp location by adding a platform-aware
copy: keep the existing cp line for Linux/macOS and add a Windows-specific
command that copies from the %TEMP% (or $env:TEMP in PowerShell) path (e.g.,
copy %TEMP%\bsdtar* to artifact-staging or use PowerShell Copy-Item -Recurse),
gated by the runner/os or conditional step so both bsdtar_test.exe artifacts are
picked up on Windows and the existing behavior remains for Unix runners.

---

Nitpick comments:
In @.github/workflows/bsdtar-compat.yml:
- Around line 250-252: The "Build tar2pna" job step named "Build tar2pna" is
missing an explicit Windows shell override and is inconsistent with the "Build
pna" step; update the workflow to add a Windows-specific variant or conditional
for this step that sets shell: pwsh (matching the "Build pna" behavior) when
running on windows-latest, or include a matrix/if conditional that uses shell:
pwsh for runner.os == 'Windows' so the cargo build --locked --release -p xtask
command in the pna working-directory runs under PowerShell on Windows.
- Around line 267-271: The current pnatar wrapper created by the workflow is a
Unix shell script (pnatar) which can be fragile on Windows; update the workflow
step that creates pnatar to emit platform-specific wrappers: when on Unix
produce the existing shell script using PNA_BIN and chmod +x it, and when on
Windows produce a .bat wrapper (e.g., pnatar.bat) that forwards arguments to
"%PNA_BIN%" /p or the equivalent invocation so MinGW/bsdtar_test's use of the -p
flag will work; ensure the workflow uses the appropriate wrapper name (pnatar on
Unix, pnatar.bat on Windows) where bsdtar_test invokes the helper and set the
file names/permissions accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c7125fc6-099f-4c36-82d6-61c688976582

📥 Commits

Reviewing files that changed from the base of the PR and between 143dd6c and 3aa7fe9.

📒 Files selected for processing (2)
  • .github/workflows/bsdtar-compat.yml
  • cli/src/command/core.rs

Comment thread .github/workflows/bsdtar-compat.yml
@ChanTsune ChanTsune force-pushed the ci/bsdtar-compat/add-windows branch 2 times, most recently from 7099d86 to 09eba70 Compare March 8, 2026 07:54
Extend .github/workflows/bsdtar-compat.yml to run the bsdtar reference and pna stdio compatibility jobs on Windows in addition to Ubuntu.

Use the libarchive Windows build flow for bsdtar and bsdtar_test, add a native pnatar.cmd wrapper for bsdtar_test.exe, keep pna stdio summaries, and skip summary output for the reference-only jobs while still failing on abnormal termination.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI Pull requests that update CI config cli This issue is about cli application

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant