Skip to content

Commit

Permalink
ci: add action workflow for ensuring minimum xcode version support
Browse files Browse the repository at this point in the history
  • Loading branch information
5d committed Jan 8, 2024
1 parent eec6a7f commit 6e17fc1
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 4 deletions.
8 changes: 7 additions & 1 deletion .github/composite_actions/get_platform_parameters/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,17 @@ runs:
XCODE_VERSION=${{ inputs.xcode_version }}
case $XCODE_VERSION in
14.3|15.0) ;;
14.0.1|14.3|15.0) ;;
*) echo "Unsupported Xcode version: $XCODE_VERSION"; exit 1 ;;
esac
DESTINATION_MAPPING='{
"14.0.1": {
"iOS": "platform=iOS Simulator,name=iPhone 14,OS=16.0",
"tvOS": "platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=16.0",
"watchOS": "platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.0",
"macOS": "platform=macOS,arch=x86_64"
},
"14.3": {
"iOS": "platform=iOS Simulator,name=iPhone 14,OS=16.4",
"tvOS": "platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=16.4",
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/build_amplify_swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ on:
platform:
type: string
required: true

xcode-version:
type: string
default: '14.3'

os-runner:
type: string
default: 'macos-13'

permissions:
contents: read
Expand All @@ -13,7 +21,7 @@ permissions:
jobs:
build-amplify-swift:
name: Build Amplify-Package | ${{ inputs.platform }}
runs-on: macos-13
runs-on: ${{ inputs.os-runner }}
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
Expand All @@ -25,7 +33,7 @@ jobs:
uses: ./.github/composite_actions/get_platform_parameters
with:
platform: ${{ inputs.platform }}
xcode_version: '14.3'
xcode_version: ${{ inputs.xcode-version }}

- name: Attempt to use the dependencies cache
id: dependencies-cache
Expand Down Expand Up @@ -55,7 +63,7 @@ jobs:
scheme: Amplify-Package
destination: ${{ steps.platform.outputs.destination }}
sdk: ${{ steps.platform.outputs.sdk }}
xcode_path: /Applications/Xcode_14.3.app
xcode_path: /Applications/Xcode_${{ inputs.xcode-version }}.app
cloned_source_packages_path: ~/Library/Developer/Xcode/DerivedData/Amplify
derived_data_path: ${{ github.workspace }}/Build
disable_package_resolution: ${{ steps.dependencies-cache.outputs.cache-hit }}
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/build_minimum_supported_swift_platforms.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build with Minimum Supported Xcode Versions
on:
push:
branches:
- main

permissions:
contents: read
actions: write

jobs:
build-amplify-with-minimum-supported-xcode:
name: Build Amplify Swift for ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
include:
- os-runner: macos-12
xcode-version: 14.0.1
platform: iOS

- os-runner: macos-12
xcode-version: 14.0.1
platform: macOS

- os-runner: macos-12
xcode-version: 14.0.1
platform: tvOS

- os-runner: macos-12
xcode-version: 14.0.1
platform: watchOS

uses: ./.github/workflows/build_amplify_swift.yml
with:
os-runner: ${{ matrix.os-runner }}
xcode-version: ${{ matrix.xcode-version }}
platform: ${{ matrix.platform }}

confirm-pass:
runs-on: ubuntu-latest
name: Confirm Passing Build Steps
if: ${{ !cancelled() }}
needs: [ build-amplify-with-minimum-supported-xcode ]
env:
EXIT_CODE: ${{ contains(needs.*.result, 'failure') && 1 || 0 }}
steps:
- run: exit $EXIT_CODE

0 comments on commit 6e17fc1

Please sign in to comment.