-
Notifications
You must be signed in to change notification settings - Fork 41
47 lines (44 loc) · 1.51 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Test
on:
push:
branches: ["main"]
pull_request_target:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
setup:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.setmatrix.outputs.matrix }}
steps:
- id: setmatrix
run: |
object="[{\"scheme\":\"YumemiWeather\",\"dir\":\".\"},{\"scheme\":\"Example\",\"dir\":\"Example\"}]"
echo "matrix=$object" >> $GITHUB_OUTPUT
test:
needs: setup
runs-on: macos-latest
permissions:
contents: read
checks: write
strategy:
matrix:
config: ${{fromJson(needs.setup.outputs.matrix)}}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Test
env:
platform: ${{ 'iOS Simulator' }}
run: |
# xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959)
device=`xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}' | sed -e "s/ Simulator$//"`
cd ${{ matrix.config.dir }}
rm -rf "${{ matrix.config.scheme }}".xcresult
xcodebuild -scheme "${{ matrix.config.scheme }}" -resultBundlePath "${{ matrix.config.scheme }}".xcresult test -destination "platform=$platform,name=$device"
- name: Report
uses: kishikawakatsumi/xcresulttool@v1
with:
path: ${{ matrix.config.scheme }}.xcresult
if: success() || failure()