Skip to content
Merged
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
42 changes: 42 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,45 @@ jobs:
-skipMacroValidation \
-destination "generic/platform=iOS Simulator" \
clean build

- name: Run unit tests (all *Tests schemes)
run: |
set -euo pipefail

TEST_SCHEMES="$(xcodebuild -workspace Dori-iOS.xcworkspace -list | awk '
/Schemes:/ { in_schemes=1; next }
in_schemes && NF {
gsub(/^[[:space:]]+|[[:space:]]+$/, "", $0)
print
}
' | grep 'Tests$' || true)"

if [ -z "${TEST_SCHEMES}" ]; then
echo "No *Tests schemes found. Skipping test step."
exit 0
fi

SIMULATOR_ID="$(xcrun simctl list devices available | awk -F '[()]' '
/iPhone/ && /(Shutdown|Booted)/ { print $2; exit }
')"

if [ -z "${SIMULATOR_ID}" ]; then
echo "No available iPhone simulator found."
exit 1
fi

echo "Using simulator id: ${SIMULATOR_ID}"
echo "Test schemes:"
echo "${TEST_SCHEMES}"

while IFS= read -r scheme; do
[ -z "${scheme}" ] && continue
echo "Running tests for scheme: ${scheme}"
xcodebuild \
-workspace Dori-iOS.xcworkspace \
-scheme "${scheme}" \
-configuration Debug \
-skipMacroValidation \
-destination "id=${SIMULATOR_ID}" \
test
done <<< "${TEST_SCHEMES}"
Loading