Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 22 additions & 6 deletions Tests/test_spm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,35 @@ echo "Current checksum in Package.swift: ${ACTUAL_CHECKSUM}"

URL="https://api.mapbox.com/downloads/v2/dash-native/snapshots/ios/packages/${VERSION}/MapboxNavigationNative.xcframework.zip"
XCFRAMEWORK_ZIP=$(mktemp).zip
curl -s --retry 3 --netrc ${URL} --output ${XCFRAMEWORK_ZIP}
echo "Downloading ${URL} to ${XCFRAMEWORK_ZIP}"
if ! curl --fail-with-body --retry 3 --netrc ${URL} --output ${XCFRAMEWORK_ZIP}; then
cat ${XCFRAMEWORK_ZIP}
exit 1
fi
EXPECTED_CHECKSUM=$(swift package compute-checksum ${XCFRAMEWORK_ZIP})

if [[ "$ACTUAL_CHECKSUM" != "$EXPECTED_CHECKSUM" ]]; then
>&2 echo "Actual cheksum is ${ACTUAL_CHECKSUM} and expected checksum is ${EXPECTED_CHECKSUM}. SPM checksum test failed."
exit 1
fi

# try to build test project
echo "Generating the Xcode project..."
xcodegen generate
xcodebuild -project SPMTest.xcodeproj -scheme SPMTest -destination 'platform=iOS Simulator,name=iPhone 15 Pro' build \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO

echo "Checking Installed Simulators..."
xcrun simctl list devices

echo "Building the project..."
xcodebuild \
-verbose \
-project SPMTest.xcodeproj \
-scheme SPMTest \
-scmProvider system \
-packageAuthorizationProvider netrc \
-destination "platform=iOS Simulator,name=iPhone 15 Pro,OS=17.5" \
build \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO

popd