Skip to content

Commit 8e552b5

Browse files
authored
Setup iOS/tvOS workflows (#11)
* Setup ios workflows * Vary target platform * Show destinations * Workflow update * Fix platform name * Simplify * Fix destination * Test * Fix test device selection * Env * Step naming * Add OS latest * Add latest * Remove latest from generic device * Split test so that it is build for testing * Boot simulator and set pipefail and NSUnbufferedIO * Don't fail fast * Split test build and test run * Fix platforms * Try without boot * Make release testable * Naming * Enable testablility * Re-enable all workflows
1 parent 8bd20aa commit 8e552b5

5 files changed

Lines changed: 74 additions & 14 deletions

File tree

File renamed without changes.

.github/workflows/_selftest.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ on:
1515
- cron: "0 0 * * *"
1616

1717
jobs:
18+
seltest-validate:
19+
name: Validate
20+
uses: ./.github/workflows/validate.yml
21+
1822
selftest-linux:
1923
name: Linux
2024
uses: ./.github/workflows/ci-linux.yml
@@ -30,3 +34,7 @@ jobs:
3034
selftest-wasm:
3135
name: WASM
3236
uses: ./.github/workflows/ci-wasm.yml
37+
38+
selftest-ios:
39+
name: iOS & tvOS
40+
uses: ./.github/workflows/ci-iOS.yml

.github/workflows/ci-iOS.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: (i|tv)(Pad)OS
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
ios-SPM:
8+
name: SPM ${{ matrix.destination }} Xcode ${{ matrix.config.xcode }} [${{ matrix.build_config }}]
9+
runs-on: ${{ matrix.config.os }}
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
config: # newer versions at top
14+
- { os: "macos-15", xcode: "16.0" }
15+
- { os: "macos-14", xcode: "15.4" }
16+
destination:
17+
- iOS
18+
- tvOS
19+
build_config:
20+
- Debug
21+
- Release
22+
steps:
23+
- uses: actions/checkout@v4
24+
25+
- name: Cache SPM dependencies
26+
uses: actions/cache@v4
27+
with:
28+
path: |
29+
~/Library/Caches/org.swift.swiftpm
30+
~/Library/Developer/Xcode/DerivedData/**/SourcePackages
31+
key: ${{ runner.os }}-spm-xcode-${{ hashFiles('Package.resolved', '**/*.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved') }}
32+
restore-keys: |
33+
${{ runner.os }}-spm-xcode-
34+
35+
- name: Select Xcode ${{ matrix.config.xcode }}
36+
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.config.xcode }}.app
37+
38+
- name: Find Simulator
39+
run: |
40+
SIMULATOR_NAME=$(xcodebuild -showdestinations -scheme "shared-actions-Package" | perl -nle 'if (m/${{ matrix.destination }}\sSimulator.*name\:([^\}]+)\s\}\.*/g && $1 !~ /^Any/ && $1 !~ /SE/) { print $1; }' | sort -r | head -n 1)
41+
echo "Found simulator: $SIMULATOR_NAME"
42+
echo "SIMULATOR_NAME=$SIMULATOR_NAME" >> $GITHUB_ENV
43+
44+
- name: Build ${{ matrix.build_config }} for Any ${{ matrix.destination }} Device
45+
run: |
46+
xcodebuild build -scheme "shared-actions-Package" -configuration ${{ matrix.build_config }} -destination "generic/platform=${{ matrix.destination }},name=Any ${{ matrix.destination }} Device"
47+
48+
- name: Build ${{ matrix.build_config }} for testing on ${{ matrix.destination }} Simulator
49+
run: | # https://developer.apple.com/documentation/xcode/build-settings-reference#Enable-Testability
50+
xcodebuild build-for-testing -scheme "shared-actions-Package" -configuration ${{ matrix.build_config }} -destination "platform=${{ matrix.destination }} Simulator,OS=latest,name=$SIMULATOR_NAME" ENABLE_TESTABILITY=YES
51+
52+
- name: Test ${{ matrix.build_config }} on ${{ matrix.destination }} Simulator
53+
run: |
54+
set -o pipefail && env NSUnbufferedIO=YES xcodebuild test-without-building -scheme "shared-actions-Package" -configuration ${{ matrix.build_config }} -destination "platform=${{ matrix.destination }} Simulator,OS=latest,name=$SIMULATOR_NAME"
55+
56+
- name: Upload failure artifacts
57+
if: failure()
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: ${{ runner.os }}-${{ github.job }}-swift_${{ matrix.config.xcode }}-${{ matrix.destination }}-${{ matrix.build_config }}-${{ github.run_id }}
61+
path: |
62+
~/Library/Developer/Xcode/DerivedData/
63+
if-no-files-found: warn
64+
include-hidden-files: true

.github/workflows/markdown-link-check.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Insprired by:
1313
- https://github.com/google/flatbuffers/blob/master/.github/workflows/build.yml
1414
- https://github.com/pointfreeco/swift-dependencies/blob/main/.github/workflows/ci.yml
1515
- https://github.com/swiftwasm/carton/blob/main/.github/workflows/swift.yml
16+
- https://github.com/orchetect/MIDIKit/blob/main/.github/workflows/build.yml
17+
1618

1719

1820

0 commit comments

Comments
 (0)