Skip to content

Commit 32e943c

Browse files
author
Matty Cross
committed
Add GitHub test action.
1 parent bc6bc58 commit 32e943c

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

.github/workflows/test.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Run tests
2+
on: [push]
3+
# on:
4+
# push:
5+
# branches: [$default-branch]
6+
# pull_request:
7+
# branches: [$default-branch]
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
test_macOS:
14+
name: Build and Test on macOS
15+
runs-on: macos-15
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
- name: Test
20+
run: |
21+
make ci
22+
xcodebuild test -scheme "Cuckoo-macOS" -workspace Cuckoo.xcworkspace
23+
24+
test_iOS:
25+
name: Build and Test on iOS simulator
26+
runs-on: macos-15
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
- name: List available Xcode versions
31+
run: ls /Applications | grep Xcode
32+
- name: Show current version of Xcode
33+
run: xcodebuild -version
34+
- name: Test
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+
file_to_build=`echo $file_to_build | awk '{$1=$1;print}'`
39+
make ci
40+
xcodebuild test -scheme "Cuckoo-iOS" -workspace Cuckoo.xcworkspace -destination "platform=iOS Simulator,name=$device"

Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,13 @@ init:
2020

2121
# Generate Cuckoo workspace.
2222
make dev
23+
24+
ci:
25+
# Install Tuist if not present.
26+
if ! command -v tuist &> /dev/null; then curl -Ls https://install.tuist.io | bash; fi
27+
28+
# Create generated mocks file which will be populated later.
29+
touch "Tests/Swift/Generated/GeneratedMocks.swift"
30+
31+
# Generate Cuckoo workspace.
32+
make dev

0 commit comments

Comments
 (0)