Skip to content

Commit f8a339c

Browse files
TimOliverfacebook-github-bot
authored andcommitted
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
1 parent 9875d7e commit f8a339c

File tree

4 files changed

+32
-7
lines changed

4 files changed

+32
-7
lines changed

.github/workflows/CI.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,3 +244,30 @@ jobs:
244244
run: |
245245
set -o pipefail
246246
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
247+
248+
Danger:
249+
name: Run Danger
250+
if: github.event_name == 'pull_request'
251+
runs-on: macos-12
252+
env:
253+
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
254+
steps:
255+
- name: Checkout
256+
uses: actions/checkout@v2
257+
with:
258+
fetch-depth: 0
259+
260+
- name: Cache RubyGems
261+
uses: actions/cache@v2
262+
with:
263+
path: vendor/bundle
264+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
265+
restore-keys: |
266+
${{ runner.os }}-gems-
267+
268+
- name: Install ruby gems.
269+
run: bundle install
270+
271+
- name: Run Danger
272+
run: bundle exec danger --verbose
273+

Examples/.swiftlint.yml renamed to .swiftlint.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
included:
2-
- IGListKitExamples
3-
- IGListKitMessageExample
4-
- IGListKitTodayExample
2+
- Examples
3+
- Source/IGListSwiftKit
54

65
excluded:
76
- Pods
@@ -18,7 +17,6 @@ disabled_rules:
1817
- force_unwrapping
1918
- comma
2019
- line_length
21-
- force_cast
2220

2321
force_cast: warning
2422
force_try: warning

Dangerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ if (added_source_files || deleted_source_files) && (ios_pods_not_updated || maco
3838
end
3939

4040
swiftlint.verbose = true
41-
swiftlint.config_file = './Examples/.swiftlint.yml'
41+
swiftlint.config_file = '.swiftlint.yml'
4242
swiftlint.lint_files(inline_mode: true)

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
source 'https://rubygems.org'
22

33
gem 'cocoapods', '~> 1.8.0'
4-
gem 'danger', '~> 5.0'
5-
gem 'danger-swiftlint', '~> 0.12.1'
4+
gem 'danger', '~> 9.2.0'
5+
gem 'danger-swiftlint', git: 'https://github.com/ashfurrow/danger-ruby-swiftlint.git', branch: 'master'
66
gem 'slather', '~> 2.7.4'
77
gem 'xcpretty', '~> 0.2.8'

0 commit comments

Comments
 (0)