-
Notifications
You must be signed in to change notification settings - Fork 31
Add workflow to build packages for iOS. #169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,22 @@ on: | |
type: string | ||
description: "macOS arch list (JSON)" | ||
default: "[\"ARM64\"]" | ||
ios_host_xcode_versions: | ||
type: string | ||
description: "Xcode version list (JSON)" | ||
default: null | ||
ios_host_exclude_xcode_versions: | ||
type: string | ||
description: "Exclude Xcode version list (JSON)" | ||
default: null | ||
ios_host_versions: | ||
type: string | ||
description: "iOS host (macOS) version list (JSON)" | ||
default: null | ||
ios_host_archs: | ||
type: string | ||
description: "iOS host (macOS) arch list (JSON)" | ||
default: null | ||
linux_swift_versions: | ||
type: string | ||
description: "Include Linux Swift version list (JSON)" | ||
|
@@ -84,6 +100,14 @@ on: | |
type: string | ||
description: "macOS command to build and test the package" | ||
default: "xcrun swift test" | ||
ios_pre_build_command: | ||
type: string | ||
description: "macOS command to execute before building the Swift package for iOS" | ||
default: "" | ||
ios_build_command: | ||
type: string | ||
description: "macOS command to build the package for iOS" | ||
default: "xcrun swift build --build-tests --sdk \"$(xcrun --sdk iphoneos --show-sdk-path)\" --triple arm64-apple-ios" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IMHO, it would be better to use
To prevent this, you can use Related discussion: https://forums.swift.org/t/getting-incompatible-sysroot-warning-when-compiling-for-ios-with-sdk-and-target-set/80584 You can easily reproduce this issue by the following steps: mkdir foo && cd foo
swift package init --type executable --name Foo
xcrun swift build --sdk "$(xcrun --sdk iphoneos --show-sdk-path)" --triple arm64-apple-ios |
||
linux_build_command: | ||
type: string | ||
description: "Linux command to build and test the package" | ||
|
@@ -110,6 +134,9 @@ on: | |
macos_env_vars: | ||
description: "Newline separated list of environment variables" | ||
type: string | ||
ios_host_env_vars: | ||
description: "Newline separated list of environment variables" | ||
type: string | ||
linux_env_vars: | ||
description: "Newline separated list of environment variables" | ||
type: string | ||
|
@@ -136,6 +163,10 @@ on: | |
type: boolean | ||
description: "Boolean to enable macOS testing. Defaults to false" | ||
default: false | ||
enable_ios_checks: | ||
type: boolean | ||
description: "Boolean to enable iOS testing. Defaults to false" | ||
default: false | ||
enable_windows_checks: | ||
type: boolean | ||
description: "Boolean to enable windows testing. Defaults to true" | ||
|
@@ -192,6 +223,42 @@ jobs: | |
run: ${{ inputs.macos_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }} | ||
timeout-minutes: 60 | ||
|
||
ios-build: | ||
name: iOS (Build Only, Xcode ${{ matrix.xcode_version }} - ${{ matrix.os_version }} - ${{ matrix.arch }}) | ||
if: ${{ inputs.enable_ios_checks }} | ||
runs-on: [self-hosted, macos, "${{ matrix.os_version }}", "${{ matrix.arch }}"] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
xcode_version: ${{ fromJson(inputs.ios_host_xcode_versions || inputs.macos_xcode_versions) }} | ||
os_version: ${{ fromJson(inputs.ios_host_versions || inputs.macos_versions) }} | ||
arch: ${{ fromJson(inputs.ios_host_archs || inputs.macos_archs) }} | ||
exclude: | ||
- ${{ fromJson(inputs.ios_host_exclude_xcode_versions || inputs.macos_exclude_xcode_versions) }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Provide token | ||
if: ${{ inputs.needs_token }} | ||
run: | | ||
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV | ||
- name: Set environment variables | ||
if: ${{ inputs.ios_host_env_vars }} | ||
run: | | ||
for i in "${{ inputs.ios_host_env_vars }}" | ||
do | ||
printf "%s\n" $i >> $GITHUB_ENV | ||
done | ||
- name: Select Xcode | ||
run: echo "DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode_version }}.app" >> $GITHUB_ENV | ||
- name: Swift version | ||
run: xcrun swift --version | ||
- name: Pre-build | ||
run: ${{ inputs.ios_pre_build_command }} | ||
- name: Build | ||
run: ${{ inputs.ios_build_command }} ${{ (contains(matrix.swift_version, 'nightly') && inputs.swift_nightly_flags) || inputs.swift_flags }} | ||
timeout-minutes: 60 | ||
|
||
linux-build: | ||
name: Linux (${{ matrix.swift_version }} - ${{ matrix.os_version }}) | ||
if: ${{ inputs.enable_linux_checks }} | ||
|
Uh oh!
There was an error while loading. Please reload this page.