Skip to content

Commit

Permalink
Update documentation build script
Browse files Browse the repository at this point in the history
  • Loading branch information
blochberger committed Sep 27, 2018
1 parent a1b73a6 commit c806786
Showing 1 changed file with 34 additions and 13 deletions.
47 changes: 34 additions & 13 deletions build-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ LAST_COMMIT=$(git log -1 --format='%H')
GITHUB_FILE_PREFIX="${GITHUB_URL}/blob/${LAST_COMMIT}"
OUTPUT_DIR="gh-pages"

JAZZY="jazzy"
JAZZY_THEME="fullwidth"

COMMIT=false
Expand Down Expand Up @@ -41,12 +40,23 @@ while [[ $# -gt 0 ]]; do
esac
done

# Check requirements
if ! [ -x "$(command -v jazzy)" ]; then
echo "Did not find 'jazzy'. Please install with: gem install --user-install jazzy" >&2
exit 1
fi

if ! [ -x "$(command -v xcov)" ]; then
echo "Did not find 'xcov'. Please install with: gem install --user-install xcov" >&2
exit 1
fi

# Generate documentation
for SDK in macos iphone; do
for MIN_ACL in public private internal; do
OUTPUT="${OUTPUT_DIR}/${SDK}/${MIN_ACL}"

${JAZZY}\
jazzy\
--clean\
--use-safe-filenames\
--theme="${JAZZY_THEME}"\
Expand All @@ -66,17 +76,28 @@ done # SDK

# Execute unit tests and create test coverage badge
if [ ${RUN_TESTS} = true ]; then
xcodebuild\
-quiet\
-sdk macosx\
-project "${MODULE}.xcodeproj"\
-scheme "${MODULE}_macOS"\
-enableCodeCoverage YES\
-derivedDataPath "build"\
clean\
test

xcrun xccov view --json build/Logs/Test/*.xccovreport > build/coverage.json
function build {
xcodebuild\
-quiet\
-sdk macosx\
-project "${MODULE}.xcodeproj"\
-scheme "${MODULE}_macOS"\
-enableCodeCoverage YES\
-derivedDataPath "build"\
clean\
test
}

if [ -x "$(command -v xcpretty)" ]; then
set -o pipefail
build | xcpretty
else
build
fi

XCCOVREPORT=$(find build/Logs/Test -name '*.xccovreport' | tail -1)

xcrun xccov view --json "$XCCOVREPORT" > build/coverage.json

COVERAGE=$(
python3 "extract_coverage.py" "${MODULE}.framework" < build/coverage.json
Expand Down

0 comments on commit c806786

Please sign in to comment.