Created
July 1, 2025 15:53
-
-
Save kylehughes/8a839477244206f0492c08503be66402 to your computer and use it in GitHub Desktop.
Bash script for testing a single Swift package inside of an Xcode project.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# --- Configuration --- | |
# Source shared configuration | |
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
source "$SCRIPT_DIR/xcodebuild-config.sh" | |
# --- Script --- | |
# Check if package name was provided | |
if [ -z "$1" ]; then | |
echo "Error: Package name required" | |
echo "Usage: $0 <package-name>" | |
echo "Example: $0 Engine" | |
exit 1 | |
fi | |
PACKAGE_NAME="$1" | |
PACKAGE_PATH="Packages/$PACKAGE_NAME" | |
# Check if package exists | |
if [ ! -d "$PACKAGE_PATH" ]; then | |
echo "Error: Package '$PACKAGE_NAME' not found at $PACKAGE_PATH" | |
echo "Available packages:" | |
ls -1 Packages/ | |
exit 1 | |
fi | |
echo "Testing package: $PACKAGE_NAME" | |
# Run tests for the package using xcodebuild | |
xcodebuild test \ | |
-project "$PROJECT" \ | |
-scheme "$SCHEME" \ | |
-destination "$TEST_DESTINATION" \ | |
-only-testing:"${PACKAGE_NAME}Tests" | |
echo "Finished testing package: $PACKAGE_NAME" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment