Add Linux support to local-ci scripts#1080
Conversation
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.
There was a problem hiding this comment.
💡 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".
scripts/local-ci/lib/ci-env.sh
Outdated
| 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" |
There was a problem hiding this comment.
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
Enable local-ci scripts to run on Linux by gracefully skipping macOS-only
components while keeping available functionality working.
Changes:
Tested on Linux:
All scripts now complete successfully on Linux with appropriate
warnings about skipped components.