Skip to content

Multi-platform CI findings across x-cmd-action/* (catalog) #7

Description

@edwinjhlee

This is an umbrella issue tracking multi-platform CI work across all x-cmd-action/* repos. x-cmd/action is the overall-design repo for this org; findings collected here should propagate into per-repo issues as needed.

Per-repo tracking issues

Repo Tracking issue
x-cmd-action/x-cmd x-cmd-action/x-cmd#1
x-cmd-action/this-repo x-cmd-action/this-repo#2
x-cmd-action/checkout x-cmd-action/checkout#2
x-cmd-action/ssh x-cmd-action/ssh#1
x-cmd-action/docker x-cmd-action/docker#1
x-cmd-action/gitconfig x-cmd-action/gitconfig#1

Findings (cross-action)

Each finding applies to multiple repos. Track fixes here, link to per-repo PRs.

1. Windows backslash path issue (affects 5 actions)

Symptom: On windows-latest runners, bash ${{ github.action_path }}/lib/foo.sh fails with bash: D:a_actions...repo_libfoo.sh: No such file or directory. The Windows backslash path gets eaten by bash's escape handling.

Fix: wrap in cygpath -u:

run: |
  if command -v cygpath >/dev/null 2>&1; then
    ACTION_PATH=$(cygpath -u "$GITHUB_ACTION_PATH")
  else
    ACTION_PATH="$GITHUB_ACTION_PATH"
  fi
  bash "$ACTION_PATH/lib/foo.sh"

Applied to: checkout, ssh, docker, gitconfig. (x-cmd uses eval \"\$(curl ...)\" directly, no local script path — not affected.)

2. macOS bash 3.2 / BSD du + awk incompatibility (affects workflows)

Symptom: du -sb is GNU-only; BSD du (macOS) rejects -b with exit 64. awk 'BEGIN {getline s < file; ...}' similarly fails on BSD awk with exit 64.

Fix: POSIX-portable replacements:

# Time delta
S=$(cat /tmp/start); E=$(cat /tmp/end)
MS=$(( (E - S) / 1000000 ))

# Byte count
BYTES=$(find "$DIR" -type f -exec wc -c {} + 2>/dev/null | tail -1 | awk '{print $1}')

Applied to: all 6 multi-platform workflows.

3. peter-evans/create-issue@v4 does not exist (affects workflows)

Symptom: Workflow fails with Unable to resolve action peter-evans/create-issue, repository not found. The action simply doesn't exist as a public repo.

Fix: Use the gh CLI (built into the runner). For create:

gh issue create --title "..." --body "..." --label "multi-platform"

For close:

gh issue list --state open --label multi-platform \
  --search "Multi-platform test in:title" \
  --json number,title --jq '.[] | "\(.number)|\(.title)"'

Applied to: all 6 multi-platform workflows.

4. gh CLI needs a git repo context (affects report jobs)

Symptom: gh issue list in a job fails with failed to run git: fatal: not a git repository. The CLI wraps git rev-parse to determine the current repo.

Fix: add an actions/checkout@v4 step at the start of the report job.

Applied to: all 6 multi-platform workflows.

5. Docker buildx not installed on windows/macos runners (affects docker action)

Symptom: docker buildx version on windows-latest / macos-latest returns "unknown command". The action's docker buildx create --use then fails with exit 125.

Fix in lib: make docker buildx create --use best-effort — try with --use, fall back to without, warn and continue:

if ! docker buildx create --use 2>/dev/null; then
  echo "WARN: buildx create --use failed (older Docker?) — retrying"
  if ! docker buildx create 2>/dev/null; then
    echo "WARN: buildx init skipped (existing builder may suffice)"
  fi
fi

Fix in workflow: make verify informational — docker --version is sufficient (the action itself is best-effort).

Applied to: docker action only.

6. macOS-hosted runners don't have docker installed (affects docker test)

Symptom: docker --version on macos-latest fails with "command not found".

Fix: verify step records not installed and passes (informational). The action itself just no-ops gracefully.

Applied to: docker workflow only.

7. SSH_AUTH_SOCK doesn't persist across shell: bash steps (affects ssh workflow)

Symptom: test -n "$SSH_AUTH_SOCK" in a verify step always fails, because each shell: bash step is a fresh shell.

Fix: verify the disk artifacts instead (which DO persist across steps): ~/.ssh/known_hosts, ~/.ssh/ directory, file content.

Applied to: ssh workflow only.

8. multi-platform label must exist on each repo (affects all workflows)

Symptom: gh issue create ... --label multi-platform fails with could not add label: 'multi-platform' not found.

Fix: Create the label on each repo before the workflow runs. Single command per repo:

gh label create multi-platform --repo x-cmd-action/<repo> \
  --color "0E8A16" --description "Multi-platform CI test failures"

Applied to: all 6 repos.

9. peter-evans/close-issue@v3 also unnecessary (affects workflows)

The same way create-issue doesn't exist as expected, the peter-evans/close-issue@v3 could be replaced with gh issue close <num> --comment "..." for consistency. We replaced both with gh CLI in all workflows.

Status

All 6 repos have multi-platform CI workflows (test-multiplatform.yml) running on ubuntu-latest, windows-latest, macos-latest. Each workflow:

  • Triggers on push, schedule (daily 06:00 UTC), and workflow_dispatch
  • Reports time, size (where applicable), and bash version per platform
  • Auto-opens a multi-platform issue on failure
  • Auto-closes previously-opened issues when all platforms pass

All 6 repos currently pass on all 3 platforms. v1 tags point to the latest commits.

Workflow template

Each repo's .github/workflows/test-multiplatform.yml follows the same structure. To replicate in a new repo:

name: test-multiplatform
on:
  push: { branches: [main] }
  workflow_dispatch:
  schedule: [{ cron: "0 6 * * *" }]
permissions: { contents: read }
jobs:
  test-{ubuntu,windows,macos}:
    runs-on: <os>-latest
    steps:
      - uses: actions/checkout@v4
      - name: bench start
        shell: bash
        run: date +%s%N > /tmp/bench_start
      - name: action step (uses: x-cmd-action/<repo>@v1 with inputs)
      - name: bench end
        shell: bash
        run: date +%s%N > /tmp/bench_end
      - name: verify + report
        shell: bash
        run: |
          # action-specific checks
          ...
          # POSIX-portable timing
          S=$(cat /tmp/bench_start); E=$(cat /tmp/bench_end)
          COLD_MS=$(( (E - S) / 1000000 ))
          ...
  report:
    needs: [test-ubuntu, test-windows, test-macos]
    if: always()
    runs-on: ubuntu-latest
    permissions: { issues: write, contents: read }
    steps:
      - uses: actions/checkout@v4
      - name: close resolved multi-platform issues
        if: steps.decide.outputs.all_pass == 'true'
        env: { GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} }
        run: gh issue list ... | xargs gh issue close ...
      - name: open issue on failure
        if: steps.decide.outputs.all_pass == 'false'
        env: { GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} }
        run: gh issue create ...

Related

  • x-cmd-action/checkout issue Art test Wednesday, April 27th #1 — plumbing alignment with actions/checkout (extraheader + isolated HOME + cleanups). Deferred, separate from multi-platform work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions