Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 17 additions & 44 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
push:
branches:
- main
- dev
pull_request:
paths:
- '.swiftlint.yml'
Expand All @@ -13,18 +12,18 @@ on:
- "Source/**"
- "Tests/**"

permissions:
contents: read

concurrency:
group: transitions-${{ github.head_ref }}
cancel-in-progress: true

env:
SCHEME_NAME: "transitions"

jobs:
SwiftLint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: GitHub Action for SwiftLint
uses: norio-nomura/action-swiftlint@3.2.1
with:
args: --strict
env:
DIFF_BASE: ${{ github.base_ref }}
iOS:
test-apple-platforms:
name: ${{ matrix.name }}
runs-on: ${{ matrix.runsOn }}
env:
Expand All @@ -34,37 +33,11 @@ jobs:
fail-fast: false
matrix:
include:
- destination: "OS=18.1,name=iPhone 16 Pro"
name: "iOS 18.1"
xcode: "Xcode_16.1"
runsOn: macOS-14
- destination: "OS=17.5,name=iPhone 15 Pro"
name: "iOS 17.5"
xcode: "Xcode_15.4"
runsOn: macOS-14
- destination: "OS=17.0.1,name=iPhone 14 Pro"
name: "iOS 17.0.1"
xcode: "Xcode_15.0"
runsOn: macos-13
- destination: "OS=16.4,name=iPhone 14 Pro"
name: "iOS 16.4"
xcode: "Xcode_14.3.1"
runsOn: macos-13
# iOS
- { platform: iOS, name: "iOS 26.0, Xcode 26.0, Swift 6.2.0", xcode: "Xcode_26.0.1", runsOn: macOS-26, destination: "OS=26.0.1,name=iPhone 17 Pro" }
- { platform: iOS, name: "iOS 18.1", xcode: "Xcode_16.1", runsOn: macOS-14, destination: "OS=18.1,name=iPhone 16 Pro" }
- { platform: iOS, name: "iOS 17.4", xcode: "Xcode_15.3", runsOn: macOS-14, destination: "OS=17.4,name=iPhone 15 Pro" }
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: ${{ matrix.name }}
run: xcodebuild test -scheme "transitions" -destination "${{ matrix.destination }}" clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1

discover-typos:
name: Discover Typos
runs-on: macOS-13
env:
DEVELOPER_DIR: /Applications/Xcode_14.1.app/Contents/Developer
steps:
- uses: actions/checkout@v4
- name: Discover typos
run: |
export PATH="$PATH:/Library/Frameworks/Python.framework/Versions/3.11/bin"
python3 -m pip install --upgrade pip
python3 -m pip install codespell
codespell --ignore-words-list="hart,inout,msdos,sur" --skip="./.build/*,./.git/*"
run: xcodebuild test -scheme "$SCHEME_NAME" -destination "${{ matrix.destination }}" clean -enableCodeCoverage YES -resultBundlePath "test_output/${{ matrix.name }}.xcresult" || exit 1
16 changes: 10 additions & 6 deletions .github/workflows/danger.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Danger
name: danger

on:
pull_request:
Expand All @@ -8,24 +8,28 @@ env:
LC_CTYPE: en_US.UTF-8
LANG: en_US.UTF-8

permissions:
contents: read
pull-requests: write

jobs:
run-danger:
runs-on: ubuntu-latest
steps:
- name: ruby setup
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.4
ruby-version: 4.0.0
bundler-cache: true
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Setup gems
run: |
gem install bundler
bundle install --clean --path vendor/bundle
bundle config set clean true
bundle config set path 'vendor/bundle'
bundle install
- name: danger
env:

DANGER_GITHUB_API_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }}

run: bundle exec danger --verbose
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,4 @@ fastlane/test_output
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/
.swiftpm/
7 changes: 0 additions & 7 deletions .swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata

This file was deleted.

19 changes: 0 additions & 19 deletions Makefile

This file was deleted.

2 changes: 0 additions & 2 deletions Mintfile

This file was deleted.

16 changes: 0 additions & 16 deletions Package@swift-5.7.swift

This file was deleted.

16 changes: 0 additions & 16 deletions Package@swift-5.8.swift

This file was deleted.

16 changes: 0 additions & 16 deletions Package@swift-5.9.swift

This file was deleted.

38 changes: 0 additions & 38 deletions hooks/pre-commit

This file was deleted.

10 changes: 10 additions & 0 deletions mise.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[tools]
git-cliff = "2.9.1"
swiftlint = "0.62.2"
swiftformat = "0.58.7"

[settings]
experimental = true

[hooks]
postinstall = "mise run install"
57 changes: 57 additions & 0 deletions mise/tasks/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

set -e

echo "🔧 Installing git hooks..."

# Find git repository root
GIT_ROOT=$(git rev-parse --show-toplevel 2>/dev/null)

if [ -z "$GIT_ROOT" ]; then
echo "❌ Error: Not a git repository"
exit 1
fi

echo "📁 Git root: $GIT_ROOT"

# Create hooks directory if it doesn't exist
mkdir -p "$GIT_ROOT/.git/hooks"

# Create pre-commit hook
cat > "$GIT_ROOT/.git/hooks/pre-commit" <<'HOOK_EOF'
#!/bin/bash

echo "🔍 Running linters..."

echo "📝 Formatting staged Swift files..."
git diff --diff-filter=d --staged --name-only | grep -e '\.swift$' | while read line; do
if [[ $line == *"/Generated"* ]]; then
echo "⏭️ Skipping generated file: $line"
else
echo "✨ Formatting: $line"
mise exec swiftformat -- swiftformat "${line}"
git add "$line"
fi
done

if ! mise run lint; then
echo "❌ Lint failed. Please fix the issues before committing."
echo "💡 Tip: Run 'mise run format' to auto-fix some issues"
echo "⚠️ To skip this hook, use: git commit --no-verify"
exit 1
fi

echo "✅ All checks passed!"
exit 0
HOOK_EOF

chmod +x "$GIT_ROOT/.git/hooks/pre-commit"

echo "✅ Git hooks installed successfully!"
echo "📍 Hook location: $GIT_ROOT/.git/hooks/pre-commit"
echo ""
echo "Pre-commit hook will:"
echo " 1. Format staged Swift files (except /Generated)"
echo " 2. Run mise lint"
echo ""
echo "To skip the hook, use: git commit --no-verify"
13 changes: 13 additions & 0 deletions mise/tasks/lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
#MISE description="Lint the transitions package using SwiftLint and SwiftFormat"
#MISE usage flag "-f --fix" help="Fix the fixable issues"

set -eo pipefail

if [ "$usage_fix" = "true" ]; then
swiftformat Sources Tests
swiftlint lint --fix --strict --config .swiftlint.yml Sources Tests
else
swiftformat Sources Tests --lint
swiftlint lint --strict --config .swiftlint.yml Sources Tests
fi