Skip to content

Commit 0390c91

Browse files
committed
Add workflow to build packages for iOS.
Add workflow to build packages for iOS on a macOS VM. Can't run tests at this time, but we can at least confirm source compiles.
1 parent 46c9211 commit 0390c91

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

.github/workflows/swift_package_test.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ on:
1919
type: string
2020
description: "macOS arch list (JSON)"
2121
default: "[\"ARM64\"]"
22+
ios_host_xcode_versions:
23+
type: string
24+
description: "Xcode version list (JSON)"
25+
default: "${{ inputs.macos_xcode_versions }}"
26+
ios_host_exclude_xcode_versions:
27+
type: string
28+
description: "Exclude Xcode version list (JSON)"
29+
default: "${{ inputs.macos_exclude_xcode_versions }}"
30+
ios_host_versions:
31+
type: string
32+
description: "iOS host (macOS) version list (JSON)"
33+
default: "${{ inputs.macos_versions }}"
34+
ios_host_archs:
35+
type: string
36+
description: "iOS host (macOS) arch list (JSON)"
37+
default: "${{ inputs.macos_archs }}"
2238
linux_swift_versions:
2339
type: string
2440
description: "Include Linux Swift version list (JSON)"
@@ -80,6 +96,14 @@ on:
8096
type: string
8197
description: "macOS command to build and test the package"
8298
default: "xcrun swift test"
99+
ios_pre_build_command:
100+
type: string
101+
description: "macOS command to execute before building the Swift package for iOS"
102+
default: ""
103+
ios_build_command:
104+
type: string
105+
description: "macOS command to build the package for iOS"
106+
default: "xcrun swift build --build-tests --sdk "$(xcrun --sdk iphoneos --show-sdk-path)" --triple arm64-apple-ios"
83107
linux_build_command:
84108
type: string
85109
description: "Linux command to build and test the package"
@@ -106,6 +130,9 @@ on:
106130
macos_env_vars:
107131
description: "Newline separated list of environment variables"
108132
type: string
133+
ios_host_env_vars:
134+
description: "Newline separated list of environment variables"
135+
type: string
109136
linux_env_vars:
110137
description: "Newline separated list of environment variables"
111138
type: string
@@ -132,6 +159,10 @@ on:
132159
type: boolean
133160
description: "Boolean to enable macOS testing. Defaults to false"
134161
default: false
162+
enable_ios_checks:
163+
type: boolean
164+
description: "Boolean to enable iOS testing. Defaults to false"
165+
default: false
135166
enable_windows_checks:
136167
type: boolean
137168
description: "Boolean to enable windows testing. Defaults to true"
@@ -186,6 +217,42 @@ jobs:
186217
run: ${{ inputs.macos_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
187218
timeout-minutes: 60
188219

220+
ios-build:
221+
name: iOS (Build Only, Xcode ${{ matrix.xcode_version }} - ${{ matrix.os_version }} - ${{ matrix.arch }})
222+
if: ${{ inputs.enable_ios_checks }}
223+
runs-on: [self-hosted, macos, "${{ matrix.os_version }}", "${{ matrix.arch }}"]
224+
strategy:
225+
fail-fast: false
226+
matrix:
227+
xcode_version: ${{ fromJson(inputs.ios_host_xcode_versions) }}
228+
os_version: ${{ fromJson(inputs.ios_host_versions) }}
229+
arch: ${{ fromJson(inputs.ios_host_archs) }}
230+
exclude:
231+
- ${{ fromJson(inputs.ios_host_exclude_xcode_versions) }}
232+
steps:
233+
- name: Checkout repository
234+
uses: actions/checkout@v4
235+
- name: Provide token
236+
if: ${{ inputs.needs_token }}
237+
run: |
238+
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
239+
- name: Set environment variables
240+
if: ${{ inputs.ios_host_env_vars }}
241+
run: |
242+
for i in "${{ inputs.ios_host_env_vars }}"
243+
do
244+
printf "%s\n" $i >> $GITHUB_ENV
245+
done
246+
- name: Select Xcode
247+
run: echo "DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode_version }}.app" >> $GITHUB_ENV
248+
- name: Swift version
249+
run: xcrun swift --version
250+
- name: Pre-build
251+
run: ${{ inputs.ios_pre_build_command }}
252+
- name: Build
253+
run: ${{ inputs.ios_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }}
254+
timeout-minutes: 60
255+
189256
linux-build:
190257
name: Linux (${{ matrix.swift_version }} - ${{ matrix.os_version }})
191258
if: ${{ inputs.enable_linux_checks }}

0 commit comments

Comments
 (0)