Updated and reintegrated Danger into GitHub Actions CI

Summary:
Danger is the build tool we've been using to proof-check incoming PRs, including making sure the incoming change is properly documented, and if needed, running SwiftLint on incoming Swift code.

Danger was originally running in our Travis CI implementation, but it wasn't integrated when we switched to GitHub Actions.

This diff updates our Danger dependencies to the latest versions, and integrates Danger into our CI system as a separate build step. I've also modified its SwiftLint setup so it will now lint Swift files in both our sample apps, and the Swift source files in `IGListSwiftKit` itself.

Reviewed By: candance

Differential Revision: D43265158

fbshipit-source-id: 8939b821af36b544fe4d66662b6ce0f99a8f768c
This commit is contained in:
Tim Oliver 2023-02-28 18:53:02 -08:00 committed by Facebook GitHub Bot
parent 9875d7e15b
commit f8a339ce16
4 changed files with 32 additions and 7 deletions

View file

@ -244,3 +244,30 @@ jobs:
run: |
set -o pipefail
xcodebuild build -workspace "${{ env.MACOS_EXAMPLE_WORKSPACE }}" -scheme "${{ env.EXAMPLE_SCHEME }}" -destination "${{ matrix.macOSDestination }}" ONLY_ACTIVE_ARCH=NO CODE_SIGNING_REQUIRED=NO | bundle exec xcpretty -c
Danger:
name: Run Danger
if: github.event_name == 'pull_request'
runs-on: macos-12
env:
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Cache RubyGems
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install ruby gems.
run: bundle install
- name: Run Danger
run: bundle exec danger --verbose

View file

@ -1,7 +1,6 @@
included:
- IGListKitExamples
- IGListKitMessageExample
- IGListKitTodayExample
- Examples
- Source/IGListSwiftKit
excluded:
- Pods
@ -18,7 +17,6 @@ disabled_rules:
- force_unwrapping
- comma
- line_length
- force_cast
force_cast: warning
force_try: warning

View file

@ -38,5 +38,5 @@ if (added_source_files || deleted_source_files) && (ios_pods_not_updated || maco
end
swiftlint.verbose = true
swiftlint.config_file = './Examples/.swiftlint.yml'
swiftlint.config_file = '.swiftlint.yml'
swiftlint.lint_files(inline_mode: true)

View file

@ -1,7 +1,7 @@
source 'https://rubygems.org'
gem 'cocoapods', '~> 1.8.0'
gem 'danger', '~> 5.0'
gem 'danger-swiftlint', '~> 0.12.1'
gem 'danger', '~> 9.2.0'
gem 'danger-swiftlint', git: 'https://github.com/ashfurrow/danger-ruby-swiftlint.git', branch: 'master'
gem 'slather', '~> 2.7.4'
gem 'xcpretty', '~> 0.2.8'