Skip to content

Commit

Permalink
feat: test matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
novr committed Jul 16, 2024
1 parent 21e7b36 commit 76a265f
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,44 @@ name: Test

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request_target:
branches: [ "main" ]
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build:
setup:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.setmatrix.outputs.matrix }}
steps:
- id: setmatrix
run: |
object="{\"targets\":[{\"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: ${{ fromJson(needs.setup.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Test
env:
scheme: ${{ 'YumemiWeather' }}
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$//"`
xcodebuild -scheme "$scheme" -resultBundlePath TestResults test -destination "platform=$platform,name=$device"
cd ${{ matrix.dir }}
xcodebuild -scheme "${{ matrix.scheme }}" -resultBundlePath ${{ matrix.scheme }} test -destination "platform=$platform,name=$device"
- name: Format
uses: kishikawakatsumi/xcresulttool@v1
with:
path: TestResults.xcresult
path: ${{ matrix.scheme }}.xcresult
if: success() || failure()

0 comments on commit 76a265f

Please sign in to comment.