Files
runner-images-sangeeth/.github/workflows/swiftlintcrash.yml
2025-04-22 11:45:22 +05:30

54 lines
1.7 KiB
YAML

name: Reproduce SwiftLint Crash (0.59.0)
on:
workflow_dispatch: # manual trigger
jobs:
swiftlint-crash-test:
runs-on: macos-15
name: SwiftLint 0.59.0 Crash Check on macOS 15
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup test files with invalid .swiftlint.yml
run: |
mkdir -p subdir
echo -e "opt_in_rules:\n - closure_body_length\n\nopt_in_rules:\n - closure_body_length" > subdir/.swiftlint.yml
echo "let a = 1" > subdir/a.swift
- name: Install dependencies
run: brew install swift
- name: Build SwiftLint 0.59.0 from source
run: |
git clone https://github.com/realm/SwiftLint.git
cd SwiftLint
git checkout 0.59.0
swift build -c release
sudo cp .build/release/swiftlint /usr/local/bin/swiftlint
- name: Print SwiftLint Version
run: swiftlint --version
- name: Run SwiftLint with crash detection
run: |
echo "🧪 Running SwiftLint..."
cd subdir
set +e
swiftlint > ../swiftlint-output.txt 2>&1
EXIT_CODE=$?
cat ../swiftlint-output.txt
echo "::group::🔍 SwiftLint Result Analysis"
if grep -q "Could not read configuration" ../swiftlint-output.txt; then
echo "::error ::💥 SwiftLint crashed due to malformed config"
echo "Crash detected in SwiftLint 0.59.0"
elif [ $EXIT_CODE -ne 0 ]; then
echo "::warning ::⚠️ SwiftLint exited with lint violations"
else
echo "✅ SwiftLint ran successfully without crash or violations"
fi
echo "::endgroup::"