Skip to content

Commit 78c8f2a

Browse files
committed
ci: build-and-test workflow added
Signed-off-by: Denis Dobanda <[email protected]>
1 parent 9c35977 commit 78c8f2a

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Package build & test
2+
3+
on:
4+
push:
5+
branches: [ "main", "develop" ]
6+
pull_request:
7+
branches: [ "main", "develop" ]
8+
9+
jobs:
10+
build:
11+
name: Build and Test SecurityToolkit scheme using any available iPhone simulator
12+
runs-on: macos-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
- name: Set Default Scheme
18+
run: |
19+
default="SecurityToolkit"
20+
echo $default | cat >default
21+
echo Using default scheme: $default
22+
- name: Build
23+
env:
24+
scheme: ${{ 'default' }}
25+
platform: ${{ 'iOS Simulator' }}
26+
run: |
27+
# xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959)
28+
device=`xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//"`
29+
if [ $scheme = default ]; then scheme=$(cat default); fi
30+
xcodebuild build-for-testing -scheme "$scheme" -destination "platform=$platform,name=$device"
31+
- name: Test
32+
env:
33+
scheme: ${{ 'default' }}
34+
platform: ${{ 'iOS Simulator' }}
35+
run: |
36+
# xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959)
37+
device=`xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//"`
38+
if [ $scheme = default ]; then scheme=$(cat default); fi
39+
xcodebuild test -scheme "$scheme" -destination "platform=$platform,name=$device"

0 commit comments

Comments
 (0)