Skip to content

Commit

Permalink
Use Matrices for OS Platforms (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
leogdion authored Dec 17, 2024
1 parent e6f3421 commit 2242415
Showing 1 changed file with 88 additions and 68 deletions.
156 changes: 88 additions & 68 deletions .github/workflows/IPSWDownloads.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,40 +69,85 @@ jobs:
runs-on: ${{ matrix.runs-on }}
if: "!contains(github.event.head_commit.message, 'ci skip')"
strategy:
fail-fast: false
matrix:
include:
# SPM Build Matrix
- runs-on: macos-13
xcode: "/Applications/Xcode_15.0.1.app"
iOSVersion: "17.0.1"
watchOSVersion: "10.0"
watchName: "Apple Watch Series 9 (41mm)"
iPhoneName: "iPhone 15"
- runs-on: macos-13
xcode: "/Applications/Xcode_15.1.app"
iOSVersion: "17.2"
watchOSVersion: "10.2"
watchName: "Apple Watch Series 9 (45mm)"
iPhoneName: "iPhone 15 Pro"
- runs-on: macos-13
xcode: "/Applications/Xcode_15.2.app"
iOSVersion: "17.2"
watchOSVersion: "10.2"
watchName: "Apple Watch Ultra 2 (49mm)"
iPhoneName: "iPhone 15 Pro Max"
- runs-on: macos-15
xcode: "/Applications/Xcode_16.1.app"
iOSVersion: "18.1"
watchOSVersion: "11.1"
watchName: "Apple Watch Ultra 2 (49mm)"
iPhoneName: "iPhone 16"
- runs-on: macos-15
xcode: "/Applications/Xcode_16.2.app"
iOSVersion: "18.2"
watchOSVersion: "11.2"
watchName: "Apple Watch Ultra 2 (49mm)"
iPhoneName: "iPhone 16 Pro"

# iOS Build Matrix
- type: ios
runs-on: macos-13
xcode: "/Applications/Xcode_15.0.1.app"
deviceName: "iPhone 15"
osVersion: "17.0.1"
- type: ios
runs-on: macos-13
xcode: "/Applications/Xcode_15.1.app"
deviceName: "iPhone 15 Pro"
osVersion: "17.2"
- type: ios
runs-on: macos-13
xcode: "/Applications/Xcode_15.2.app"
deviceName: "iPhone 15 Pro Max"
osVersion: "17.2"
- type: ios
runs-on: macos-15
xcode: "/Applications/Xcode_16.1.app"
deviceName: "iPhone 16"
osVersion: "18.1"
- type: ios
runs-on: macos-15
xcode: "/Applications/Xcode_16.2.app"
deviceName: "iPhone 16 Pro"
osVersion: "18.2"

# watchOS Build Matrix
- type: watchos
runs-on: macos-13
xcode: "/Applications/Xcode_15.0.1.app"
deviceName: "Apple Watch Series 9 (41mm)"
osVersion: "10.0"
- type: watchos
runs-on: macos-13
xcode: "/Applications/Xcode_15.1.app"
deviceName: "Apple Watch Series 9 (45mm)"
osVersion: "10.2"
- type: watchos
runs-on: macos-13
xcode: "/Applications/Xcode_15.2.app"
deviceName: "Apple Watch Ultra 2 (49mm)"
osVersion: "10.2"
- type: watchos
runs-on: macos-15
xcode: "/Applications/Xcode_16.1.app"
deviceName: "Apple Watch Ultra 2 (49mm)"
osVersion: "11.1"
- type: watchos
runs-on: macos-15
xcode: "/Applications/Xcode_16.2.app"
deviceName: "Apple Watch Ultra 2 (49mm)"
osVersion: "11.2"

steps:
- uses: actions/checkout@v4

- name: Set Xcode Name
run: echo "XCODE_NAME=$(basename -- ${{ matrix.xcode }} | sed 's/\.[^.]*$//' | cut -d'_' -f2)" >> $GITHUB_ENV

- name: Setup Xcode
run: sudo xcode-select -s ${{ matrix.xcode }}/Contents/Developer

# SPM Cache Step
- name: Cache swift package modules
id: cache-spm-macos
uses: actions/cache@v4
Expand All @@ -115,59 +160,34 @@ jobs:
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Cache mint
if: ${{ github.event_name == 'pull_request' && ( github.base_ref == 'main' || endsWith( github.ref_name , 'Prep') ) && matrix.xcode == '/Applications/Xcode_16.1.app' }}
id: cache-mint
uses: actions/cache@v4
env:
cache-name: cache-mint
with:
path: .mint
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('Mintfile') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Set Xcode Name
run: echo "XCODE_NAME=$(basename -- ${{ matrix.xcode }} | sed 's/\.[^.]*$//' | cut -d'_' -f2)" >> $GITHUB_ENV
- name: Setup Xcode
run: sudo xcode-select -s ${{ matrix.xcode }}/Contents/Developer
- name: Install mint
if: ${{ github.event_name == 'pull_request' && ( github.base_ref == 'main' || endsWith( github.ref_name , 'Prep') ) && matrix.xcode == '/Applications/Xcode_16.1.app' }}
run: |
brew update
brew install mint
- name: Build
- name: Build SPM
if: "!matrix.type"
run: swift build

- name: Run Swift Package tests
if: "!matrix.type"
run: swift test -v --enable-code-coverage
- uses: sersoft-gmbh/swift-coverage-action@v4

# Common iOS/watchOS Test Steps
- name: Run Device Tests
if: matrix.type
run: >
xcodebuild test
-scheme ${{ env.PACKAGE_NAME }}
-sdk ${{ matrix.type == 'ios' && 'iphonesimulator' || 'watchsimulator' }}
-destination 'platform=${{ matrix.type == 'ios' && 'iOS Simulator' || 'watchOS Simulator' }},name=${{ matrix.deviceName }},OS=${{ matrix.osVersion }}'
-enableCodeCoverage YES
build test
# Common Coverage Steps
- name: Process Coverage
uses: sersoft-gmbh/swift-coverage-action@v4
with:
fail-on-empty-output: true
- name: Upload SPM to CodeCov.io
run: bash <(curl https://codecov.io/bash) -F spm -F macOS -F ${XCODE_NAME}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Clean up spm build directory
run: rm -rf .build
- name: Lint
run: ./scripts/lint.sh
if: ${{ github.event_name == 'pull_request' && ( github.base_ref == 'main' || endsWith( github.ref_name , 'Prep') ) && matrix.xcode == '/Applications/Xcode_16.1.app' }}
- name: Run iOS target tests
run: xcodebuild test -scheme ${{ env.PACKAGE_NAME }} -sdk iphonesimulator -destination 'platform=iOS Simulator,name=${{ matrix.iPhoneName }},OS=${{ matrix.iOSVersion }}' -enableCodeCoverage YES build test
- uses: sersoft-gmbh/swift-coverage-action@v4
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: iOS,iOS${{ matrix.iOSVersion }},macOS,${{ env.XCODE_NAME }}
- name: Run watchOS target tests
run: xcodebuild test -scheme ${{ env.PACKAGE_NAME }} -sdk watchsimulator -destination 'platform=watchOS Simulator,name=${{ matrix.watchName }},OS=${{ matrix.watchOSVersion }}' -enableCodeCoverage YES build test
- uses: sersoft-gmbh/swift-coverage-action@v4
with:
fail-on-empty-output: true
- name: Upload coverage reports to Codecov

- name: Upload Coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: watchOS,watchOS${{ matrix.watchOSVersion }},macOS,${{ env.XCODE_NAME }}
flags: ${{ matrix.type && format('{0}{1}', matrix.type, matrix.osVersion) || 'spm' }}

0 comments on commit 2242415

Please sign in to comment.