diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 1df9e89..749fb03 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -77,6 +77,18 @@ jobs: xcrun swift package init --type library xcrun swift build + build_tests_ios: + name: Build iOS Tests + uses: ./.github/workflows/swift_package_test.yml + with: + enable_linux_checks: false + enable_windows_checks: false + # iOS + enable_ios_checks: true + ios_pre_build_command: | + pwd + xcrun swift package init --type library + soundness: name: Soundness uses: ./.github/workflows/soundness.yml diff --git a/.github/workflows/swift_package_test.yml b/.github/workflows/swift_package_test.yml index 524d5ca..92ba522 100644 --- a/.github/workflows/swift_package_test.yml +++ b/.github/workflows/swift_package_test.yml @@ -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" 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 }}