Carthage compatibility tests
From Wikipedia:
An amphora is a type of container of a characteristic shape and size.
Table of Contents
An Amphora is simply a bats test that invokes Carthage and checks the results of the invocation.
- If the Amphora succedes, the project is compabitle with carthage.
- If the Amphora fails:
- either the project is not compatible with Carthage
- or Carthage is not compatible with the project
Either way, a failure is not a good sign.
Amphorae are organized alphabetically in different folders.
Don't over populate a folder for the sake of parallelizing Travis job stages. No more than 10 Amphorae in one folder.
To have Travis run Amphorae for new folder XYZ
add a two stages to the .travis.yml like so:
- HEAD Stage
- stage: "Tests"
install:
- brew update
- brew install bats-core
- brew uninstall carthage
- brew install carthage --HEAD
script: travis_wait 30 bats Amphorae/XYZ/*
name: "XYZ Amphorae - Carthage HEAD"
- Stable Stage
- stage: "Tests"
install:
- brew update
- brew install bats-core
script: travis_wait 30 bats Amphorae/XYZ/*
name: "XYZ Amphorae - Carthage Stable"
An Amphora template looks like the following
#!/usr/bin/env bats
export PROJECT_NAME=AFNetworking
setup() {
cd $BATS_TMPDIR
rm -rf carthage_${PROJECT_NAME}
mkdir carthage_${PROJECT_NAME} && cd carthage_${PROJECT_NAME}
printf 'github "%s/%s" ~> 3.2.1' "${PROJECT_NAME}" "${PROJECT_NAME}" > Cartfile
echo $BATS_TMPDIR
}
teardown() {
cd $BATS_TEST_DIRNAME
rm -rf carthage_${PROJECT_NAME}
}
@test "Carthage builds ${PROJECT_NAME}" {
run carthage update --no-use-binaries --cache-builds
[ "$status" -eq 0 ]
# Version file
[ -e "Carthage/Build/.${PROJECT_NAME}.version" ]
# Mac
[ -d "Carthage/Build/Mac/${PROJECT_NAME}.framework" ]
[ -d "Carthage/Build/Mac/${PROJECT_NAME}.framework.dSYM" ]
# iOS
[ -d "Carthage/Build/iOS/${PROJECT_NAME}.framework" ]
[ -d "Carthage/Build/iOS/${PROJECT_NAME}.framework.dSYM" ]
symbolmapsCount=$(ls -lR Carthage/Build/iOS/*.bcsymbolmap | wc -l)
[ "$symbolmapsCount" -eq 2 ]
# tvOS
[ -d "Carthage/Build/tvOS/${PROJECT_NAME}.framework" ]
[ -d "Carthage/Build/tvOS/${PROJECT_NAME}.framework.dSYM" ]
symbolmapsCount=$(ls -lR Carthage/Build/tvOS/*.bcsymbolmap | wc -l)
[ "$symbolmapsCount" -eq 1 ]
# watchOS
[ -d "Carthage/Build/watchOS/${PROJECT_NAME}.framework" ]
[ -d "Carthage/Build/watchOS/${PROJECT_NAME}.framework.dSYM" ]
symbolmapsCount=$(ls -lR Carthage/Build/watchOS/*.bcsymbolmap | wc -l)
[ "$symbolmapsCount" -eq 1 ]
}
Not all projects are the same so customisation is required here and there.
The project is under MIT License.
The logo is curtesy of gotatiana.com .