Skip to content

Commit 47fcae4

Browse files
committed
Nicer approach to podspec validations
1 parent 5b2b010 commit 47fcae4

File tree

2 files changed

+24
-72
lines changed

2 files changed

+24
-72
lines changed

.github/workflows/podspecs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
- name: Select Xcode 12
2020
run: sudo xcode-select -s /Applications/Xcode_12.app
2121
- name: Test Specs
22-
run: CI=1 TARGET=${{ matrix.target }} SWIFT_VERSION=5.3 ./scripts/validate-podspec.sh
22+
run: CI=1 TARGET=${{ matrix.target }} SWIFT_VERSION=5.1 ./scripts/validate-podspec.sh

scripts/validate-podspec.sh

Lines changed: 23 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,26 @@
1-
# This is kind of naughty, I know,
2-
# but we need to know what will the state be once RxSwift is deployed.
1+
#!/bin/sh
32

43
set -e
54

6-
BRANCH=$(git rev-parse HEAD)
7-
ESCAPED_SOURCE=$(pwd | sed -E "s/\//\\\\\//g")
8-
9-
function cleanup {
10-
pushd ~/.cocoapods/repos/master
11-
git clean -d -f
12-
git reset main --hard
13-
popd
14-
}
15-
16-
trap cleanup EXIT
17-
18-
if [[ ! -z "${CI}" ]]; then
19-
bundle install
20-
COCOAPODS_REPO_COUNT=`bundle exec pod repo list --count-only | cut -c 1`
21-
22-
if [[ $COCOAPODS_REPO_COUNT == "0" ]]; then
23-
# No repo spec yet, we have to set it up
24-
bundle exec pod setup
25-
else
26-
# We have some remote repo (cached or otherwise), so we can simply update it
27-
bundle exec pod repo update
28-
fi
29-
fi
30-
31-
VERSION=`cat RxSwift.podspec | grep -E "s.version\s+=" | cut -d '"' -f 2`
32-
ROOTS=(8/5/5 3/c/1 9/2/4 a/b/1 2/e/c)
33-
TARGETS=(RxTest RxCocoa RxRelay RxBlocking RxSwift)
34-
35-
SWIFT_VERSION="--swift-version=${SWIFT_VERSION}"
36-
37-
SOURCE_DIR=`pwd`
38-
39-
pushd ~/.cocoapods/repos/master/Specs
40-
for ROOT in ${ROOTS[@]} ; do
41-
for TARGET_ITERATOR in ${TARGETS[@]}
42-
do
43-
if [ ! -d "${ROOT}/${TARGET_ITERATOR}" ]
44-
then
45-
continue
46-
fi
47-
48-
mkdir -p ${ROOT}/${TARGET_ITERATOR}/${VERSION}
49-
rm ${ROOT}/${TARGET_ITERATOR}/${VERSION}/* || echo
50-
cat "${SOURCE_DIR}/$TARGET_ITERATOR.podspec" |
51-
sed -E "s/s.source [^\}]+\}/s.source = { :git => 'file:\/\/${ESCAPED_SOURCE}' }/" > ${ROOT}/${TARGET_ITERATOR}/${VERSION}/${TARGET_ITERATOR}.podspec
52-
done
53-
done
54-
popd
55-
56-
function validate() {
57-
local PODSPEC=$1
58-
59-
validate=(pod lib lint $PODSPEC --verbose --no-clean ${arg} "${SWIFT_VERSION}")
60-
if [ $TARGET = "RxCocoa" ]; then
61-
validate+=(--allow-warnings)
62-
fi
63-
echo "${validate[@]}"
64-
}
65-
66-
for TARGET_ITERATOR in ${TARGETS[@]}
67-
do
68-
if [[ "${TARGET}" != "" ]] && [[ "${TARGET}" != "${TARGET_ITERATOR}" ]]
69-
then
70-
continue
71-
fi
72-
73-
validate ${TARGET_ITERATOR}.podspec
74-
done
5+
# EXTRA_FLAGS="--include-podspecs='RxSwift.podspec'"
6+
7+
case $TARGET in
8+
"RxSwift"*)
9+
pod lib lint --verbose --no-clean --swift-version=$SWIFT_VERSION --allow-warnings RxSwift.podspec
10+
;;
11+
"RxCocoa"*)
12+
pod lib lint --verbose --no-clean --swift-version=$SWIFT_VERSION --allow-warnings --include-podspecs='{RxSwift, RxRelay}.podspec' RxCocoa.podspec
13+
;;
14+
"RxRelay"*)
15+
pod lib lint --verbose --no-clean --swift-version=$SWIFT_VERSION --allow-warnings --include-podspecs='RxSwift.podspec' RxRelay.podspec
16+
;;
17+
"RxBlocking"*)
18+
pod lib lint --verbose --no-clean --swift-version=$SWIFT_VERSION --allow-warnings --include-podspecs='RxSwift.podspec' RxBlocking.podspec
19+
;;
20+
"RxTest"*)
21+
pod lib lint --verbose --no-clean --swift-version=$SWIFT_VERSION --allow-warnings --include-podspecs='RxSwift.podspec' RxTest.podspec
22+
;;
23+
esac
24+
25+
# Not sure why this isn't working ¯\_(ツ)_/¯, will figure it out some other time
26+
# pod lib lint --verbose --no-clean --swift-version=${SWIFT_VERSION} ${EXTRA_FLAGS} ${TARGET}.podspec

0 commit comments

Comments
 (0)