Skip to content

Commit

Permalink
Setup SwiftFormat Linting CI
Browse files Browse the repository at this point in the history
  • Loading branch information
nuno-vieira committed Mar 11, 2021
1 parent 4ed3322 commit 391eae2
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 19 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Expand Up @@ -17,7 +17,7 @@ env:

jobs:
run-danger:
name: Run Danger
name: Run Automated Code Review
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
Expand All @@ -43,7 +43,9 @@ jobs:
run: bundle exec danger
env:
GITHUB_TOKEN: ${{ secrets.DANGER_GITHUB_API_TOKEN }}

- name: Run Linting
run: ./Scripts/run-linter.sh

build-and-test-debug:
name: Run Tests (Debug)
runs-on: macos-latest
Expand Down
5 changes: 1 addition & 4 deletions Dangerfile
Expand Up @@ -45,7 +45,4 @@ end

# Check all commits have correct format. Disable the length rule, since it's hardcoded
# to 50 and GitHub has the limit 80.
commit_lint.check disable: [:subject_length]

swiftlint.lint_files inline_mode: true

commit_lint.check disable: [:subject_length]
1 change: 0 additions & 1 deletion Gemfile
Expand Up @@ -7,7 +7,6 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem "fastlane"
gem "cocoapods"
gem "danger"
gem "danger-swiftlint"
gem "danger-commit_lint"
gem "jazzy"
gem "xcode-install"
Expand Down
8 changes: 1 addition & 7 deletions Gemfile.lock
Expand Up @@ -96,10 +96,6 @@ GEM
danger-plugin-api (~> 1.0)
danger-plugin-api (1.0.0)
danger (> 2.0)
danger-swiftlint (0.24.5)
danger
rake (> 10)
thor (~> 0.19)
declarative (0.0.20)
declarative-option (0.1.0)
digest-crc (0.6.1)
Expand Down Expand Up @@ -270,7 +266,6 @@ GEM
terminal-notifier (2.0.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thor (0.20.3)
thread_safe (0.3.6)
tty-cursor (0.7.1)
tty-screen (0.8.1)
Expand Down Expand Up @@ -309,7 +304,6 @@ DEPENDENCIES
cocoapods
danger
danger-commit_lint
danger-swiftlint
fastlane
fastlane-plugin-firebase_app_distribution
fastlane-plugin-versioning
Expand All @@ -318,4 +312,4 @@ DEPENDENCIES
xcode-install

BUNDLED WITH
2.1.4
2.2.4
17 changes: 17 additions & 0 deletions Scripts/run-linter.sh
@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -euo pipefail

echo -e "馃憠 Running SwiftFormat Linting"

echo -e "馃憠 Linting Sources..."
mint run swiftformat --lint --config .swiftformat Sources --exclude **/Generated
echo -e "馃憠 Linting Tests..."
mint run swiftformat --lint --config .swiftformat Tests
echo -e "馃憠 Linting Sample..."
mint run swiftformat --lint --config .swiftformat Sample
echo -e "馃憠 Linting DemoApp..."
mint run swiftformat --lint --config .swiftformat DemoApp
echo -e "馃憠 Linting Integration..."
mint run swiftformat --lint --config .swiftformat Integration
echo -e "馃憠 Linting DocsSnippets..."
mint run swiftformat --lint --config .swiftformat-snippets DocsSnippets
5 changes: 0 additions & 5 deletions bootstrap.sh
Expand Up @@ -31,12 +31,7 @@ ln -sf ../../hooks/pre-commit.sh .git/hooks/post-rewrite
chmod +x .git/hooks/pre-commit
chmod +x ./hooks/git-format-staged

# Get SwiftLint version from Mintfile to be used by danger-swiftlint too
SWIFTLINT_VERSION=$(cat Mintfile | grep SwiftLint | awk -F@ '{print $2}')

# Install gems
echo
echo -e "馃憠 Install bundle dependencies"
echo "SwiftLint version: " $SWIFTLINT_VERSION
bundle config SWIFTLINT_VERSION "$SWIFTLINT_VERSION"
bundle install

0 comments on commit 391eae2

Please sign in to comment.