Skip to content

Commit 3719cca

Browse files
authored
ci: change to use xcode version with alias (#3465)
1 parent 003e1f3 commit 3719cca

30 files changed

+134
-101
lines changed

.github/composite_actions/get_platform_parameters/action.yml

Lines changed: 60 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,62 +5,99 @@ inputs:
55
required: true
66
type: string
77
xcode_version:
8-
description: 'The version of Xcode. Valid values are 14.3 and 15.0'
9-
required: true
8+
description: "The version of Xcode. Available aliases are 'latest' and 'minimum'"
9+
default: 'latest'
10+
type: string
11+
destination:
12+
description: "The destination associated with the given platform and Xcode version"
13+
default: ''
1014
type: string
15+
1116
outputs:
1217
destination:
1318
description: "The destination associated with the given platform and Xcode version"
14-
value: ${{ steps.platform.outputs.destination }}
19+
value: ${{ steps.get-destination.outputs.destination }}
1520
sdk:
1621
description: "The SDK associated with the given platform"
17-
value: ${{ steps.platform.outputs.sdk }}
22+
value: ${{ steps.get-sdk.outputs.sdk }}
23+
xcode-version:
24+
description: "The Xcode version to build with"
25+
value: ${{ steps.get-xcode-version.outputs.xcode-version }}
26+
1827
runs:
1928
using: "composite"
2029
steps:
21-
- id: platform
30+
- name: Validate platform
2231
run: |
23-
PLATFORM=${{ inputs.platform }}
24-
case $PLATFORM in
32+
INPUT_PLATFORM=${{ inputs.platform }}
33+
case $INPUT_PLATFORM in
2534
iOS|tvOS|watchOS|macOS) ;;
26-
*) echo "Unsupported platform: $PLATFORM"; exit 1 ;;
35+
*) echo "Unsupported platform: $INPUT_PLATFORM"; exit 1 ;;
2736
esac
37+
shell: bash
38+
39+
- id: get-xcode-version
40+
run: |
41+
LATEST_XCODE_VERSION=14.3.1
42+
MINIMUM_XCODE_VERSION=14.0.1
2843
29-
XCODE_VERSION=${{ inputs.xcode_version }}
30-
case $XCODE_VERSION in
31-
14.0.1|14.3|15.0) ;;
32-
*) echo "Unsupported Xcode version: $XCODE_VERSION"; exit 1 ;;
44+
INPUT_XCODE_VERSION=${{ inputs.xcode_version }}
45+
46+
case $INPUT_XCODE_VERSION in
47+
latest)
48+
XCODE_VERSION=$LATEST_XCODE_VERSION ;;
49+
minimum)
50+
XCODE_VERSION=$MINIMUM_XCODE_VERSION ;;
51+
*)
52+
XCODE_VERSION=$INPUT_XCODE_VERSION ;;
3353
esac
54+
echo "xcode-version=$XCODE_VERSION" >> $GITHUB_OUTPUT
55+
56+
shell: bash
57+
58+
- id: get-destination
59+
run: |
60+
INPUT_PLATFORM=${{ inputs.platform }}
61+
INPUT_DESTINATION='${{ inputs.destination }}'
62+
INPUT_XCODE_VERSION=${{ inputs.xcode_version }}
3463
3564
DESTINATION_MAPPING='{
36-
"14.0.1": {
65+
"minimum": {
3766
"iOS": "platform=iOS Simulator,name=iPhone 14,OS=16.0",
3867
"tvOS": "platform=tvOS Simulator,name=Apple TV 4K (2nd generation),OS=16.0",
3968
"watchOS": "platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.0",
4069
"macOS": "platform=macOS,arch=x86_64"
4170
},
42-
"14.3": {
71+
"latest": {
4372
"iOS": "platform=iOS Simulator,name=iPhone 14,OS=16.4",
4473
"tvOS": "platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=16.4",
4574
"watchOS": "platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.4",
4675
"macOS": "platform=macOS,arch=x86_64"
47-
},
48-
"15.0": {
49-
"iOS": "platform=iOS Simulator,name=iPhone 15,OS=latest",
50-
"tvOS": "platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=latest",
51-
"watchOS": "platform=watchOS Simulator,name=Apple Watch Series 9 (45mm),OS=latest",
52-
"macOS": "platform=macOS,arch=x86_64"
5376
}
5477
}'
5578
79+
if [ -z "$INPUT_DESTINATION" ]; then
80+
DESTINATION=$(echo $DESTINATION_MAPPING | jq -r ".\"$INPUT_XCODE_VERSION\".$INPUT_PLATFORM")
81+
else
82+
DESTINATION=$INPUT_DESTINATION
83+
fi
84+
85+
if [ -z "$DESTINATION" ]; then
86+
echo "No available destination to build for"
87+
exit 1
88+
fi
89+
echo "destination=$DESTINATION" >> $GITHUB_OUTPUT
90+
shell: bash
91+
92+
- id: get-sdk
93+
run: |
94+
INPUT_PLATFORM=${{ inputs.platform }}
5695
SDK_MAPPING='{
5796
"iOS": "iphonesimulator",
5897
"tvOS": "appletvsimulator",
5998
"watchOS": "watchsimulator",
6099
"macOS": "macosx"
61100
}'
62-
63-
echo "destination=$(echo $DESTINATION_MAPPING | jq -r ."\"$XCODE_VERSION\"".$PLATFORM)" >> $GITHUB_OUTPUT
64-
echo "sdk=$(echo $SDK_MAPPING | jq -r .$PLATFORM)" >> $GITHUB_OUTPUT
101+
echo "sdk=$(echo $SDK_MAPPING | jq -r .$INPUT_PLATFORM)" >> $GITHUB_OUTPUT
65102
shell: bash
66103

.github/composite_actions/run_xcodebuild_test/action.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ inputs:
1212
required: false
1313
type: string
1414
destination:
15-
required: false
15+
required: true
1616
type: string
17-
default: 'platform=iOS Simulator,name=iPhone 13,OS=latest'
1817
sdk:
1918
required: false
2019
type: string

.github/workflows/build_amplify_swift.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88

99
xcode-version:
1010
type: string
11-
default: '14.3'
11+
default: 'latest'
1212

1313
os-runner:
1414
type: string
@@ -43,7 +43,7 @@ jobs:
4343
id: dependencies-cache
4444
if: inputs.cacheable
4545
timeout-minutes: 4
46-
continue-on-error: true
46+
continue-on-error: ${{ inputs.cacheable }}
4747
uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
4848
with:
4949
path: ~/Library/Developer/Xcode/DerivedData/Amplify
@@ -55,21 +55,21 @@ jobs:
5555
id: build-cache
5656
if: inputs.cacheable
5757
timeout-minutes: 4
58-
continue-on-error: true
58+
continue-on-error: ${{ inputs.cacheable }}
5959
uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
6060
with:
6161
path: ${{ github.workspace }}/Build
6262
key: Amplify-${{ inputs.platform }}-build-cache
6363

6464
- name: Build Amplify for Swift
6565
id: build-package
66-
continue-on-error: true
66+
continue-on-error: ${{ inputs.cacheable }}
6767
uses: ./.github/composite_actions/run_xcodebuild
6868
with:
6969
scheme: Amplify-Package
7070
destination: ${{ steps.platform.outputs.destination }}
7171
sdk: ${{ steps.platform.outputs.sdk }}
72-
xcode_path: /Applications/Xcode_${{ inputs.xcode-version }}.app
72+
xcode_path: /Applications/Xcode_${{ steps.platform.outputs.xcode-version }}.app
7373
cloned_source_packages_path: ~/Library/Developer/Xcode/DerivedData/Amplify
7474
derived_data_path: ${{ github.workspace }}/Build
7575
disable_package_resolution: ${{ steps.dependencies-cache.outputs.cache-hit }}
@@ -85,7 +85,7 @@ jobs:
8585
if: inputs.cacheable && steps.build-cache.outputs.cache-hit && github.ref_name == 'main'
8686
env:
8787
GH_TOKEN: ${{ github.token }}
88-
continue-on-error: true
88+
continue-on-error: ${{ inputs.cacheable }}
8989
run: |
9090
gh cache delete ${{ steps.build-cache.outputs.cache-primary-key }}
9191

.github/workflows/build_minimum_supported_swift_platforms.yml

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,12 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
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
18+
platform: [iOS, macOS, tvOS, watchOS]
3419

3520
uses: ./.github/workflows/build_amplify_swift.yml
3621
with:
37-
os-runner: ${{ matrix.os-runner }}
38-
xcode-version: ${{ matrix.xcode-version }}
22+
os-runner: macos-12
23+
xcode-version: 'minimum'
3924
platform: ${{ matrix.platform }}
4025
cacheable: false
4126

.github/workflows/integ_test_analytics.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
scheme: ${{ matrix.platform == 'watchOS' && 'AWSPinpointAnalyticsPluginIntegrationTestsWatch' || 'AWSPinpointAnalyticsPluginIntegrationTests' }}
4040
platform: ${{ matrix.platform }}
4141
project_path: ./AmplifyPlugins/Analytics/Tests/AnalyticsHostApp
42-
xcode_version: '14.3'
4342
resource_subfolder: analytics
4443
timeout-minutes: 30
4544
secrets: inherit

.github/workflows/integ_test_api_functional.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
scheme: ${{ matrix.platform == 'watchOS' && 'AWSAPIPluginFunctionalTestsWatch' || 'AWSAPIPluginFunctionalTests' }}
4040
platform: ${{ matrix.platform }}
4141
project_path: ./AmplifyPlugins/API/Tests/APIHostApp
42-
xcode_version: '14.3'
4342
resource_subfolder: api
4443
timeout-minutes: 45
4544
secrets: inherit

.github/workflows/integ_test_api_graphql_auth_directive.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ jobs:
3333
scheme: AWSAPIPluginGraphQLAuthDirectiveTests
3434
platform: ${{ matrix.platform }}
3535
project_path: ./AmplifyPlugins/API/Tests/APIHostApp
36-
xcode_version: '14.3'
3736
resource_subfolder: api
3837
timeout-minutes: 45
3938
secrets: inherit

.github/workflows/integ_test_api_graphql_iam.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ jobs:
3333
scheme: AWSAPIPluginGraphQLIAMTests
3434
platform: ${{ matrix.platform }}
3535
project_path: ./AmplifyPlugins/API/Tests/APIHostApp
36-
xcode_version: '14.3'
3736
resource_subfolder: api
3837
timeout-minutes: 45
3938
secrets: inherit

.github/workflows/integ_test_api_graphql_lambda_auth.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
scheme: ${{ matrix.platform == 'watchOS' && 'AWSAPIPluginGraphQLLambdaAuthTestsWatch' || 'AWSAPIPluginGraphQLLambdaAuthTests' }}
4040
platform: ${{ matrix.platform }}
4141
project_path: ./AmplifyPlugins/API/Tests/APIHostApp
42-
xcode_version: '14.3'
4342
resource_subfolder: api
4443
timeout-minutes: 45
4544
secrets: inherit

.github/workflows/integ_test_api_graphql_lazy_load.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ jobs:
3333
scheme: AWSAPIPluginLazyLoadTests
3434
platform: ${{ matrix.platform }}
3535
project_path: ./AmplifyPlugins/API/Tests/APIHostApp
36-
xcode_version: '14.3'
3736
resource_subfolder: api
3837
timeout-minutes: 45
3938
secrets: inherit

0 commit comments

Comments
 (0)