Skip to content

Commit 0d8f12a

Browse files
authored
ci: add action workflow for ensuring minimum sdk version support (#3462)
* ci: add action workflow for ensuring minimum xcode version support * resolve comment * fix typo
1 parent c11781f commit 0d8f12a

File tree

3 files changed

+79
-9
lines changed

3 files changed

+79
-9
lines changed

.github/composite_actions/get_platform_parameters/action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,17 @@ runs:
2828
2929
XCODE_VERSION=${{ inputs.xcode_version }}
3030
case $XCODE_VERSION in
31-
14.3|15.0) ;;
31+
14.0.1|14.3|15.0) ;;
3232
*) echo "Unsupported Xcode version: $XCODE_VERSION"; exit 1 ;;
3333
esac
3434
3535
DESTINATION_MAPPING='{
36+
"14.0.1": {
37+
"iOS": "platform=iOS Simulator,name=iPhone 14,OS=16.0",
38+
"tvOS": "platform=tvOS Simulator,name=Apple TV 4K (2nd generation),OS=16.0",
39+
"watchOS": "platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.0",
40+
"macOS": "platform=macOS,arch=x86_64"
41+
},
3642
"14.3": {
3743
"iOS": "platform=iOS Simulator,name=iPhone 14,OS=16.4",
3844
"tvOS": "platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=16.4",

.github/workflows/build_amplify_swift.yml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,26 @@ on:
66
type: string
77
required: true
88

9+
xcode-version:
10+
type: string
11+
default: '14.3'
12+
13+
os-runner:
14+
type: string
15+
default: 'macos-13'
16+
17+
cacheable:
18+
type: boolean
19+
default: true
20+
921
permissions:
1022
contents: read
1123
actions: write
1224

1325
jobs:
1426
build-amplify-swift:
1527
name: Build Amplify-Package | ${{ inputs.platform }}
16-
runs-on: macos-13
28+
runs-on: ${{ inputs.os-runner }}
1729
steps:
1830
- name: Checkout repository
1931
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 #v4.1.1
@@ -25,10 +37,11 @@ jobs:
2537
uses: ./.github/composite_actions/get_platform_parameters
2638
with:
2739
platform: ${{ inputs.platform }}
28-
xcode_version: '14.3'
29-
40+
xcode_version: ${{ inputs.xcode-version }}
41+
3042
- name: Attempt to use the dependencies cache
3143
id: dependencies-cache
44+
if: inputs.cacheable
3245
timeout-minutes: 4
3346
continue-on-error: true
3447
uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
@@ -40,6 +53,7 @@ jobs:
4053
4154
- name: Attempt to restore the build cache from main
4255
id: build-cache
56+
if: inputs.cacheable
4357
timeout-minutes: 4
4458
continue-on-error: true
4559
uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
@@ -55,28 +69,28 @@ jobs:
5569
scheme: Amplify-Package
5670
destination: ${{ steps.platform.outputs.destination }}
5771
sdk: ${{ steps.platform.outputs.sdk }}
58-
xcode_path: /Applications/Xcode_14.3.app
72+
xcode_path: /Applications/Xcode_${{ inputs.xcode-version }}.app
5973
cloned_source_packages_path: ~/Library/Developer/Xcode/DerivedData/Amplify
6074
derived_data_path: ${{ github.workspace }}/Build
6175
disable_package_resolution: ${{ steps.dependencies-cache.outputs.cache-hit }}
6276

6377
- name: Save the dependencies cache in main
64-
if: steps.dependencies-cache.outputs.cache-hit != 'true' && github.ref_name == 'main'
78+
if: inputs.cacheable && steps.dependencies-cache.outputs.cache-hit != 'true' && github.ref_name == 'main'
6579
uses: actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
6680
with:
6781
path: ~/Library/Developer/Xcode/DerivedData/Amplify
6882
key: ${{ steps.dependencies-cache.outputs.cache-primary-key }}
69-
83+
7084
- name: Delete the old build cache
71-
if: steps.build-cache.outputs.cache-hit && github.ref_name == 'main'
85+
if: inputs.cacheable && steps.build-cache.outputs.cache-hit && github.ref_name == 'main'
7286
env:
7387
GH_TOKEN: ${{ github.token }}
7488
continue-on-error: true
7589
run: |
7690
gh cache delete ${{ steps.build-cache.outputs.cache-primary-key }}
7791
7892
- name: Save the build cache
79-
if: github.ref_name == 'main'
93+
if: inputs.cacheable && github.ref_name == 'main'
8094
uses: actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
8195
with:
8296
path: ${{ github.workspace }}/Build
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build with Minimum Supported Xcode Versions
2+
on:
3+
workflow_dispatch:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: read
10+
actions: write
11+
12+
jobs:
13+
build-amplify-with-minimum-supported-xcode:
14+
name: Build Amplify Swift for ${{ matrix.platform }}
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
include:
19+
- os-runner: macos-12
20+
xcode-version: 14.0.1
21+
platform: iOS
22+
23+
- os-runner: macos-12
24+
xcode-version: 14.0.1
25+
platform: macOS
26+
27+
- os-runner: macos-12
28+
xcode-version: 14.0.1
29+
platform: tvOS
30+
31+
- os-runner: macos-12
32+
xcode-version: 14.0.1
33+
platform: watchOS
34+
35+
uses: ./.github/workflows/build_amplify_swift.yml
36+
with:
37+
os-runner: ${{ matrix.os-runner }}
38+
xcode-version: ${{ matrix.xcode-version }}
39+
platform: ${{ matrix.platform }}
40+
cacheable: false
41+
42+
confirm-pass:
43+
runs-on: ubuntu-latest
44+
name: Confirm Passing Build Steps
45+
if: ${{ !cancelled() }}
46+
needs: [ build-amplify-with-minimum-supported-xcode ]
47+
env:
48+
EXIT_CODE: ${{ contains(needs.*.result, 'failure') && 1 || 0 }}
49+
steps:
50+
- run: exit $EXIT_CODE

0 commit comments

Comments
 (0)