ci: test workflows, labelers, other CI related #11
Workflow file for this run
This file contains hidden or 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: | |
- macos/native_image_picker_macos/**/*.swift | |
- example/macos/Runner/**/*.swift | |
- example/macos/RunnerTests/**/*.swift | |
- example/macos/RunnerUITests/**/*.swift | |
- .github/workflows/swift-format-check.yml | |
pull_request: | |
paths: | |
- macos/native_image_picker_macos/**/*.swift | |
- example/macos/Runner/**/*.swift | |
- example/macos/RunnerTests/**/*.swift | |
- example/macos/RunnerUITests/**/*.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 | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/swift-format | |
key: swift-format-${{ runner.os }}-${{ env.SWIFT_FORMAT_VERSION }}-${{ hashFiles('**/Package.resolved') }} | |
restore-keys: | | |
swift-format-${{ runner.os }}-${{ env.SWIFT_FORMAT_VERSION }}- | |
- name: 📦 Install Swift Format | |
run: | | |
if [ -f ~/.cache/swift-format ]; then | |
echo "Using the cached Swift Format." | |
sudo cp -f ~/.cache/swift-format /usr/local/bin/swift-format | |
else | |
echo "Swift Format is not cached, building and installing..." | |
git clone --branch $SWIFT_FORMAT_VERSION --depth 1 https://github.com/swiftlang/swift-format.git | |
cd swift-format | |
swift build --disable-sandbox -c release | |
sudo cp -f .build/release/swift-format /usr/local/bin/ | |
echo "Caching the built swift-format" | |
cp -f .build/release/swift-format ~/.cache/swift-format | |
fi | |
- 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 --strict -r macos/native_image_picker_macos/Sources/native_image_picker_macos example/macos/Runner example/macos/RunnerTests example/macos/RunnerUITests | |
# SwiftLint: https://github.com/realm/SwiftLint | |
# - name: 🎨 Verify Swift Code Style with SwiftLint | |
# uses: norio-nomura/action-swiftlint@3.2.1 |