Skip to content

Commit

Permalink
create matrix from json
Browse files Browse the repository at this point in the history
  • Loading branch information
417-72KI committed Apr 16, 2022
1 parent 55b62d5 commit 2b9ea75
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 11 deletions.
30 changes: 19 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,38 @@
name: Test
on:
push:
branches:
- main
- hotfix
paths:
- .github/workflows/test.yml
- Package.*
- Sources/**/*.swift
- Tests/**/*.swift
pull_request:
paths:
- .github/workflows/test.yml
- Package.*
- Sources/**/*.swift
- Tests/**/*.swift
- versions.json
concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
xcode-versions:
name: Extract latest Xcode version from matrix
runs-on: ubuntu-latest
outputs:
xcode-versions: ${{ steps.extract-xcode-version.outputs.xcode-versions }}
latest: ${{ steps.extract-xcode-version.outputs.latest-xcode-version }}
steps:
- uses: actions/checkout@v3
- id: extract-xcode-version
run: |
echo "::set-output name=xcode-versions::$(cat versions.json | jq -rc '.xcode_version')"
echo "::set-output name=latest-xcode-version::$(cat versions.json | jq -r '.xcode_version | max')"
test:
name: Test
needs: xcode-versions
runs-on: macos-latest
concurrency:
group: ${{ github.head_ref }}-${{ github.workflow }}-${{ matrix.xcode }}-${{ matrix.destination }}
cancel-in-progress: true
strategy:
matrix:
xcode: ['13.2.1']
xcode: ${{ fromJson(needs.xcode-versions.outputs.xcode-versions) }}
destination:
- "platform=macOS"
- "platform=macOS,variant=Mac Catalyst"
Expand Down Expand Up @@ -59,7 +67,7 @@ jobs:
clean test | xcpretty
- name: Upload test result
uses: actions/upload-artifact@v3
if: success() || failure()
if: ${{ matrix.xcode }} == ${{ needs.xcode-versions.outputs.latest }} && (success() || failure())
with:
name: ${{ steps.create-destination-key.outputs.destination-key }}
path: test_output
Expand Down
5 changes: 5 additions & 0 deletions versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"xcode_version": [
"13.2.1"
]
}

0 comments on commit 2b9ea75

Please sign in to comment.