Skip to content

Commit

Permalink
Lint podspec on all pull requests
Browse files Browse the repository at this point in the history
- We recently let a couple of issues slip through code review becase we don't lint our podspec on pull requests since the task takes too long (about half an hour). To prevent this from happening again, this PR adds 2 new CI jobs that lint default and other subspecs on all PRs. By splitting into 2 tasks, the impact on total CI time should be mitigated somewhat. There is still a master-only task that lint all subspecs as the last line of defense in case the 2 new tasks miss any.
  • Loading branch information
nguyenhuy committed Jan 3, 2020
1 parent cfaa55c commit 3e4c283
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 1 deletion.
26 changes: 26 additions & 0 deletions .github/workflows/ci-pull-requests-only.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: CI (pull-requests-only jobs)

on:
pull_request:
branches:
- master

jobs:
buildsh:
env:
DEVELOPER_DIR: /Applications/Xcode_11.app/Contents/Developer
strategy:
matrix:
mode: [cocoapods-lint-default-subspecs, cocoapods-lint-other-subspecs]
include:
- mode: cocoapods-lint-default-subspecs
name: Verify that default subspecs lint
- mode: cocoapods-lint-other-subspecs
name: Verify that other subspecs lint
name: ${{ matrix.name }}
runs-on: macOS-latest
steps:
- name: Checkout the Git repository
uses: actions/checkout@v1
- name: Run build script
run: ./build.sh ${{ matrix.mode }}
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:
- name: Checkout the Git repository
uses: actions/checkout@v1
- name: Run build script
run: ./build.sh ${{ matrix.mode }}
run: ./build.sh ${{ matrix.mode }}
27 changes: 27 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ function build_example {
fi
}

# Lint subspec
function lint_subspec {
set -o pipefail && pod env && pod lib lint --allow-warnings --subspec="$1"
}

function cleanup {
# remove all Pods directories
find . -name Pods -type d -exec rm -rf {} +
Expand Down Expand Up @@ -216,6 +221,28 @@ cocoapods-lint|all)
success="1"
;;

cocoapods-lint-default-subspecs)
echo "Verifying that default subspecs lint."

for subspec in 'Core' 'PINRemoteImage' 'Video' 'MapKit' 'AssetsLibrary' 'Photos'; do
echo "Verifying that $subspec subspec lints."

lint_subspec $subspec
done
success="1"
;;

cocoapods-lint-other-subspecs)
echo "Verifying that other subspecs lint."

for subspec in 'IGListKit' 'Yoga' 'TextNode2'; do
echo "Verifying that $subspec subspec lints."

lint_subspec $subspec
done
success="1"
;;

carthage|all)
echo "Verifying carthage works."

Expand Down

0 comments on commit 3e4c283

Please sign in to comment.