1
1
name : Build | Amplify Swift
2
2
on :
3
3
workflow_call :
4
+ inputs :
5
+ identifier :
6
+ required : true
7
+ type : string
4
8
workflow_dispatch :
5
9
push :
6
10
branches-ignore :
10
14
permissions :
11
15
contents : read
12
16
17
+ concurrency :
18
+ group : ${{ inputs.identifier || github.workflow }}-${{ github.event.pull_request.number || github.ref }}
19
+ cancel-in-progress : ${{ github.ref_name != 'main'}}
20
+
13
21
jobs :
14
22
build-amplify-swift-iOS :
15
23
runs-on : macos-13
24
+ timeout-minutes : 20
16
25
steps :
17
- - uses : actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
26
+ - uses : actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
18
27
with :
19
28
persist-credentials : false
29
+ - name : Attempt to restore dependencies cache
30
+ id : cache-packages
31
+ timeout-minutes : 4
32
+ continue-on-error : true
33
+ uses : actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
34
+ with :
35
+ path : ~/Library/Developer/Xcode/DerivedData/Amplify
36
+ key : amplify-packages-${{ hashFiles('Package.resolved') }}
37
+ restore-keys : |
38
+ amplify-packages-
20
39
- name : Build Amplify Swift for iOS
21
40
uses : ./.github/composite_actions/run_xcodebuild
22
41
with :
23
42
scheme : Amplify-Package
43
+ destination : ' platform=iOS Simulator,name=iPhone 14,OS=16.4'
24
44
xcode_path : ' /Applications/Xcode_14.3.app'
45
+ disable_package_resolution : ${{ steps.cache-packages.outputs.cache-hit }}
46
+ other_flags : ' -derivedDataPath Build -clonedSourcePackagesDirPath ~/Library/Developer/Xcode/DerivedData/Amplify'
47
+ - name : Save the dependencies cache if necessary
48
+ if : steps.cache-packages.outputs.cache-hit != 'true' && github.ref_name == 'main'
49
+ uses : actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
50
+ with :
51
+ path : ~/Library/Developer/Xcode/DerivedData/Amplify
52
+ key : ${{ steps.cache-packages.outputs.cache-primary-key }}
25
53
26
54
build-amplify-swift-macOS :
27
55
runs-on : macos-13
56
+ timeout-minutes : 20
28
57
steps :
29
- - uses : actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
58
+ - uses : actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
30
59
with :
31
60
persist-credentials : false
61
+ - name : Attempt to restore dependencies cache
62
+ id : cache-packages
63
+ timeout-minutes : 4
64
+ continue-on-error : true
65
+ uses : actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
66
+ with :
67
+ path : ~/Library/Developer/Xcode/DerivedData/Amplify
68
+ key : amplify-packages-${{ hashFiles('Package.resolved') }}
69
+ restore-keys : |
70
+ amplify-packages-
32
71
- name : Build Amplify Swift for macOS
33
72
uses : ./.github/composite_actions/run_xcodebuild
34
73
with :
35
74
scheme : Amplify-Package
36
75
destination : platform=macOS,arch=x86_64
37
76
sdk : macosx
38
77
xcode_path : ' /Applications/Xcode_14.3.app'
78
+ disable_package_resolution : ${{ steps.cache-packages.outputs.cache-hit }}
79
+ other_flags : ' -derivedDataPath Build -clonedSourcePackagesDirPath ~/Library/Developer/Xcode/DerivedData/Amplify'
80
+ - name : Save the dependencies cache if necessary
81
+ if : steps.cache-packages.outputs.cache-hit != 'true' && github.ref_name == 'main'
82
+ uses : actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
83
+ with :
84
+ path : ~/Library/Developer/Xcode/DerivedData/Amplify
85
+ key : ${{ steps.cache-packages.outputs.cache-primary-key }}
39
86
40
87
build-amplify-swift-tvOS :
41
88
runs-on : macos-13
89
+ timeout-minutes : 20
42
90
steps :
43
- - uses : actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
91
+ - uses : actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
44
92
with :
45
93
persist-credentials : false
94
+ - name : Attempt to restore dependencies cache
95
+ timeout-minutes : 4
96
+ id : cache-packages
97
+ continue-on-error : true
98
+ uses : actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
99
+ with :
100
+ path : ~/Library/Developer/Xcode/DerivedData/Amplify
101
+ key : amplify-packages-${{ hashFiles('Package.resolved') }}
102
+ restore-keys : |
103
+ amplify-packages-
46
104
- name : Build Amplify Swift for tvOS
47
105
uses : ./.github/composite_actions/run_xcodebuild
48
106
with :
49
107
scheme : Amplify-Package
50
- destination : platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=latest
108
+ destination : platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=16.4
51
109
sdk : appletvsimulator
52
110
xcode_path : ' /Applications/Xcode_14.3.app'
111
+ disable_package_resolution : ${{ steps.cache-packages.outputs.cache-hit }}
112
+ other_flags : ' -derivedDataPath Build -clonedSourcePackagesDirPath ~/Library/Developer/Xcode/DerivedData/Amplify'
113
+ - name : Save the dependencies cache if necessary
114
+ if : steps.cache-packages.outputs.cache-hit != 'true' && github.ref_name == 'main'
115
+ uses : actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
116
+ with :
117
+ path : ~/Library/Developer/Xcode/DerivedData/Amplify
118
+ key : ${{ steps.cache-packages.outputs.cache-primary-key }}
53
119
54
120
build-amplify-swift-watchOS :
55
121
runs-on : macos-13
122
+ timeout-minutes : 20
56
123
steps :
57
- - uses : actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
124
+ - uses : actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
58
125
with :
59
126
persist-credentials : false
127
+ - name : Attempt to restore dependencies cache
128
+ id : cache-packages
129
+ timeout-minutes : 4
130
+ continue-on-error : true
131
+ uses : actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
132
+ with :
133
+ path : ~/Library/Developer/Xcode/DerivedData/Amplify
134
+ key : amplify-packages-${{ hashFiles('Package.resolved') }}
135
+ restore-keys : |
136
+ amplify-packages-
60
137
- name : Build Amplify Swift for watchOS
61
138
uses : ./.github/composite_actions/run_xcodebuild
62
139
with :
63
140
scheme : Amplify-Package
64
- destination : platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=latest
141
+ destination : platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.4
65
142
sdk : watchsimulator
66
- xcode_path : ' /Applications/Xcode_14.3.app'
143
+ xcode_path : ' /Applications/Xcode_14.3.app'
144
+ disable_package_resolution : ${{ steps.cache-packages.outputs.cache-hit }}
145
+ other_flags : ' -derivedDataPath Build -clonedSourcePackagesDirPath ~/Library/Developer/Xcode/DerivedData/Amplify'
146
+ - name : Save the dependencies cache if necessary
147
+ if : steps.cache-packages.outputs.cache-hit != 'true' && github.ref_name == 'main'
148
+ uses : actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
149
+ with :
150
+ path : ~/Library/Developer/Xcode/DerivedData/Amplify
151
+ key : ${{ steps.cache-packages.outputs.cache-primary-key }}
152
+
153
+ confirm-pass :
154
+ runs-on : ubuntu-latest
155
+ name : Confirm Passing Build Steps
156
+ if : ${{ !cancelled() }}
157
+ needs : [
158
+ build-amplify-swift-iOS,
159
+ build-amplify-swift-macOS,
160
+ build-amplify-swift-tvOS,
161
+ build-amplify-swift-watchOS
162
+ ]
163
+ env :
164
+ EXIT_CODE : ${{ contains(needs.*.result, 'failure') && 1 || 0 }}
165
+ steps :
166
+ - run : exit $EXIT_CODE
0 commit comments