ci: setup checks and tests workflows #9
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ✅ Swift Formatting Check | |
# Separated from checks.yml since it takes longer to build swift-format from source | |
on: | |
push: | |
branches: [main] | |
paths: | |
- quill_native_bridge_ios/ios/quill_native_bridge_ios/**/*.swift | |
- quill_native_bridge_macos/macos/quill_native_bridge_macos/**/*.swift | |
- .github/workflows/swift-format-check.yml | |
pull_request: | |
paths: | |
- quill_native_bridge_ios/ios/quill_native_bridge_ios/**/*.swift | |
- quill_native_bridge_macos/macos/quill_native_bridge_macos/**/*.swift | |
- .github/workflows/swift-format-check.yml | |
jobs: | |
format-check: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
env: | |
SWIFT_FORMAT_VERSION: 600.0.0 | |
steps: | |
- name: 📥 Checkout Repository | |
uses: actions/checkout@v4 | |
- name: 🛠️ Setup Swift | |
uses: swift-actions/setup-swift@v2 | |
- name: 📦 Cache Swift Format | |
id: swift-format-cache | |
uses: actions/cache@v4 | |
with: | |
path: .build/release/swift-format | |
key: swift-format-${{ runner.os }}-v${{ env.SWIFT_FORMAT_VERSION }} | |
restore-keys: | | |
swift-format-${{ runner.os }}- | |
- name: 📦 Restore Cached Swift Format | |
if: steps.swift-format-cache.outputs.cache-hit == 'true' | |
run: | | |
if [ -f ".build/release/swift-format" ]; then | |
sudo cp .build/release/swift-format /usr/local/bin/swift-format | |
else | |
echo "The cached swift-format was not found in the .build directory." >&2 | |
exit 1 | |
fi | |
- name: 📦 Install Swift Format if not cached | |
if: steps.swift-format-cache.outputs.cache-hit != 'true' | |
run: | | |
git clone --branch $SWIFT_FORMAT_VERSION --depth 1 https://github.com/swiftlang/swift-format.git | |
cd swift-format | |
swift build -c release | |
sudo cp .build/release/swift-format /usr/local/bin/swift-format | |
- name: 🔍 Verify Swift Format installation | |
run: swift-format --version | |
- name: ℹ️ Print the default configuration | |
run: swift-format dump-configuration | |
- name: 🔎 Validate Swift Code Formatting | |
run: | | |
swift-format lint -r quill_native_bridge_ios/ios/quill_native_bridge_ios --strict | |
swift-format lint -r quill_native_bridge_macos/macos/quill_native_bridge_macos --strict | |
# SwiftLint: https://github.com/realm/SwiftLint | |
# - name: 🎨 Verify Swift Code Style with SwiftLint | |
# uses: norio-nomura/[email protected] |