Skip to content

Add Linux support to local-ci scripts#1080

Merged
SoundBlaster merged 3 commits intomainfrom
claude/test-local-ci-scripts-017oTmPpqMcTR8LB1MVUeMhh
Nov 28, 2025
Merged

Add Linux support to local-ci scripts#1080
SoundBlaster merged 3 commits intomainfrom
claude/test-local-ci-scripts-017oTmPpqMcTR8LB1MVUeMhh

Conversation

@SoundBlaster
Copy link
Owner

Enable local-ci scripts to run on Linux by gracefully skipping macOS-only
components while keeping available functionality working.

Changes:

  • Add OS detection (macOS/Linux) to common.sh
  • Skip macOS version validation on Linux
  • Skip Xcode validation and builds on Linux
  • Skip Swift Package Manager operations when Swift is not installed
  • Skip Tuist workspace generation on Linux (macOS-only tool)
  • Add SwiftLint support for Linux:
    • Auto-detect and use Docker if available
    • Fall back to building from source if Swift is installed
    • Skip SwiftLint checks if neither option is available
  • Keep Python script tests working on all platforms

Tested on Linux:

  • JSON validation: ✅ Works
  • Swift format checks: Skipped (Swift not installed)
  • SwiftLint checks: Skipped (can use Docker mode)
  • SPM builds: Skipped (Swift not installed)
  • Xcode builds: Skipped (macOS only)
  • Python tests: ✅ All 23 tests passed

All scripts now complete successfully on Linux with appropriate
warnings about skipped components.

Enable local-ci scripts to run on Linux by gracefully skipping macOS-only
components while keeping available functionality working.

Changes:
- Add OS detection (macOS/Linux) to common.sh
- Skip macOS version validation on Linux
- Skip Xcode validation and builds on Linux
- Skip Swift Package Manager operations when Swift is not installed
- Skip Tuist workspace generation on Linux (macOS-only tool)
- Add SwiftLint support for Linux:
  * Auto-detect and use Docker if available
  * Fall back to building from source if Swift is installed
  * Skip SwiftLint checks if neither option is available
- Keep Python script tests working on all platforms

Tested on Linux:
- JSON validation: ✅ Works
- Swift format checks: Skipped (Swift not installed)
- SwiftLint checks: Skipped (can use Docker mode)
- SPM builds: Skipped (Swift not installed)
- Xcode builds: Skipped (macOS only)
- Python tests: ✅ All 23 tests passed

All scripts now complete successfully on Linux with appropriate
warnings about skipped components.
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +145 to +149
cd "$temp_dir/SwiftLint" &&
swift build -c release 2>/dev/null; then
mkdir -p "$install_dir"
cp "$temp_dir/SwiftLint/.build/release/swiftlint" "$install_dir/"
export PATH="$install_dir:$PATH"

Choose a reason for hiding this comment

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

P1 Badge Restore cwd after SwiftLint source build

When SwiftLint is missing on Linux and Docker isn’t available, this branch builds SwiftLint from source but cds into the temp checkout and never returns to the original working directory before continuing. Subsequent steps in the calling scripts still expect to run from the repo root, so after taking this path they will execute from the temp folder (and later from a deleted folder) and fail to find relative paths like scripts/validate_json.py. Wrap the build in a pushd/popd or subshell so the working directory is restored.

Useful? React with 👍 / 👎.

Swift is a mandatory requirement for ISOInspector development on Linux.
Scripts should fail fast and early when Swift is not installed, with
clear instructions pointing to installation guide.

Changes:
- validate_swift() now fails with error on Linux if Swift missing
- Points to DOCS/RULES/12_Swift_Installation_Linux.md
- Provides quick install command (swiftly)
- Remove all Swift skip logic from run-build.sh
- Remove all Swift skip logic from run-tests.sh
- Remove all Swift skip logic from run-lint.sh

Behavior:
- All scripts now fail immediately during environment validation
- Clear error message with installation instructions
- Exit code 1 (failure) instead of 0 (success with warnings)

This ensures developers catch the missing dependency early rather than
encountering confusing errors later in the build process.
Wrap cd and swift build in a subshell to ensure the working directory
is automatically restored after the build completes. This prevents
breaking subsequent operations that rely on relative paths.

Bug: cd "$temp_dir/SwiftLint" changed directory without popd
Fix: Use subshell (cd ... && swift build) to isolate directory change
@SoundBlaster SoundBlaster merged commit c1dcf96 into main Nov 28, 2025
21 checks passed
@SoundBlaster SoundBlaster deleted the claude/test-local-ci-scripts-017oTmPpqMcTR8LB1MVUeMhh branch November 28, 2025 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants