Skip to content

Commit

Permalink
Merge pull request #86 from yumemi-inc/feature/matrix_test
Browse files Browse the repository at this point in the history
feat: test matrix [skip ci]
  • Loading branch information
novr authored Jul 22, 2024
2 parents 2b29eb4 + 4baf43c commit 5172b0d
Showing 1 changed file with 20 additions and 7 deletions.
27 changes: 20 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,45 @@ 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="[{\"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:
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"
- name: Format
cd ${{ matrix.config.dir }}
xcodebuild -scheme "${{ matrix.config.scheme }}" -resultBundlePath ${{ matrix.config.scheme }} test -destination "platform=$platform,name=$device"
- name: Report
uses: kishikawakatsumi/xcresulttool@v1
with:
path: TestResults.xcresult
path: ${{ matrix.config.scheme }}.xcresult
if: success() || failure()

0 comments on commit 5172b0d

Please sign in to comment.