Skip to content

Commit

Permalink
Update CI workflow configuration
Browse files Browse the repository at this point in the history
Includes:
 - Extended `run_tests.sh` script with optional `--ios-platform` and
   `--tvos-platform` options for specifying a custom iOS/tvOS platform
   specifier.
 - Bumped a default iOS device name in the `run_tests.sh` script from
   "iPhone 14 Pro" to "iPhone 15 Pro".
 - Beautified the xcodebuild output with xcbeautify.
  • Loading branch information
mgutski committed Dec 6, 2024
1 parent cc41f89 commit a606165
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,19 @@ jobs:
include:
- macos: 13
xcode: '14.1' # Swift 5.7
ios-simulator: 'iPhone 14 Pro'
- macos: 13
xcode: '14.3.1' # Swift 5.8
ios-simulator: 'iPhone 14 Pro'
- macos: 14
xcode: '15.0' # Swift 5.9
ios-simulator: 'iPhone 15 Pro'
- macos: 14
xcode: '15.3' # Swift 5.10
ios-simulator: 'iPhone 15 Pro'
- macos: 14
xcode: '16.0' # Swift 6.0
ios-simulator: 'iPhone 16 Pro'

steps:
- name: Runner Overview
Expand All @@ -66,4 +71,4 @@ jobs:
uses: actions/checkout@v4

- name: Run Tests
run: make tests
run: make tests OPTIONS="--ios-platform 'iOS Simulator,name=${{ matrix.ios-simulator }}'"
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@

GITHOOKS_DIR := ".githooks"

OPTIONS ?= ""

help:
@cat $(MAKEFILE_LIST)

lint:
@./scripts/lint_code.sh --strict

tests:
@./scripts/run_tests.sh
@./scripts/run_tests.sh $(OPTIONS)

environment:
git config core.hooksPath $(GITHOOKS_DIR)
33 changes: 29 additions & 4 deletions scripts/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,47 @@ set -Eeuo pipefail

readonly SCRIPT_ABS_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)"

readonly PROJECT_ROOT_PATH="$SCRIPT_ABS_PATH/.."
readonly OPTION_IOS_PLATFORM="--ios-platform"
readonly OPTION_TVOS_PLATFORM="--tvos-platform"

readonly PLATFORM_IOS="iOS Simulator,name=iPhone 14 Pro"
readonly PLATFORM_TVOS="tvOS Simulator,name=Apple TV 4K (3rd generation) (at 1080p)"
readonly PROJECT_ROOT_PATH="$SCRIPT_ABS_PATH/.."

readonly XCODE_PROJECT="FingerprintJS.xcodeproj"
readonly XCODE_SCHEME="FingerprintJS"

PLATFORM_IOS="iOS Simulator,name=iPhone 15 Pro"
PLATFORM_TVOS="tvOS Simulator,name=Apple TV 4K (3rd generation) (at 1080p)"

cd "$PROJECT_ROOT_PATH"

function xcodebuild_test() {
xcodebuild clean test \
-project "$XCODE_PROJECT" \
-scheme "$XCODE_SCHEME" \
-destination platform="$1"
-destination platform="$1" \
| xcbeautify
}

while [[ $# -gt 0 ]]
do
key="$1"

case $key in
"$OPTION_IOS_PLATFORM")
shift
PLATFORM_IOS="$1"
shift
;;
"$OPTION_TVOS_PLATFORM")
shift
PLATFORM_TVOS="$1"
shift
;;
*)
break
;;
esac
done

xcodebuild_test "$PLATFORM_IOS"
xcodebuild_test "$PLATFORM_TVOS"

0 comments on commit a606165

Please sign in to comment.