Skip to content

Commit 5b95da8

Browse files
authored
chore: kickoff release
2 parents 3c03eb7 + 5ce17ba commit 5b95da8

File tree

51 files changed

+963
-734
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+963
-734
lines changed

.github/composite_actions/download_test_configuration/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ runs:
2323
using: "composite"
2424
steps:
2525
- name: Configure AWS credentials for {{ inputs.resource_subfolder }}
26-
uses: aws-actions/configure-aws-credentials@05b148adc31e091bafbaf404f745055d4d3bc9d2 # Pin to 1.6.1
26+
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 #v2
2727
with:
2828
role-to-assume: ${{ inputs.aws_role_to_assume }}
2929
aws-region: ${{ inputs.aws_region }}

.github/composite_actions/run_xcodebuild/action.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ inputs:
1919
required: false
2020
type: string
2121
default: 'iphonesimulator'
22+
disable_package_resolution:
23+
required: false
24+
type: boolean
25+
default: false
2226
other_flags:
2327
required: false
2428
type: string
@@ -39,6 +43,11 @@ runs:
3943
if [ ! -z "$XCODE_PATH" ]; then
4044
sudo xcode-select -s $XCODE_PATH
4145
fi
46+
47+
otherFlags="${{ inputs.other_flags }}"
48+
if [ "${{ inputs.disable_package_resolution }}" == "true" ]; then
49+
otherFlags+=" -disableAutomaticPackageResolution"
50+
fi
4251
xcodebuild -version
43-
xcodebuild build -scheme $SCHEME -sdk '${{ inputs.sdk }}' -destination '${{ inputs.destination }}' ${{ inputs.other_flags }} | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]}
52+
xcodebuild build -scheme $SCHEME -sdk '${{ inputs.sdk }}' -destination '${{ inputs.destination }}' $otherFlags | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]}
4453
shell: bash

.github/composite_actions/run_xcodebuild_test/action.yml

Lines changed: 84 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,26 @@ inputs:
2323
required: false
2424
type: string
2525
default: ''
26+
generate_coverage:
27+
required: false
28+
type: boolean
29+
default: false
30+
cloned_source_packages_path:
31+
required: false
32+
type: string
33+
default: ''
34+
derived_data_path:
35+
required: false
36+
type: string
37+
default: ''
38+
disable_package_resolution:
39+
required: false
40+
type: boolean
41+
default: false
42+
test_without_building:
43+
required: false
44+
type: boolean
45+
default: false
2646

2747
runs:
2848
using: "composite"
@@ -32,13 +52,76 @@ runs:
3252
SCHEME: ${{ inputs.scheme }}
3353
PROJECT_PATH: ${{ inputs.project_path }}
3454
XCODE_PATH: ${{ inputs.xcode_path }}
55+
CLONED_SOURCE_PACKAGES_PATH: ${{ inputs.cloned_source_packages_path }}
56+
DERIVED_DATA_PATH: ${{ inputs.derived_data_path }}
3557
run: |
3658
if [ ! -z "$PROJECT_PATH" ]; then
3759
cd $PROJECT_PATH
3860
fi
3961
if [ ! -z "$XCODE_PATH" ]; then
62+
echo "Using Xcode $XCODE_PATH"
4063
sudo xcode-select -s $XCODE_PATH
4164
fi
65+
66+
clonedSourcePackagesPath=""
67+
if [ ! -z "$CLONED_SOURCE_PACKAGES_PATH" ]; then
68+
echo "Using custom cloned source packages path"
69+
clonedSourcePackagesPath+="-clonedSourcePackagesDirPath $CLONED_SOURCE_PACKAGES_PATH"
70+
fi
71+
72+
derivedDataPath=""
73+
if [ ! -z "$DERIVED_DATA_PATH" ]; then
74+
echo "Using custom DerivedData path"
75+
derivedDataPath+="-derivedDataPath $DERIVED_DATA_PATH"
76+
fi
77+
78+
coverageFlags=""
79+
if [ "${{ inputs.generate_coverage }}" == "true" ]; then
80+
echo "Code Coverage is enabled!"
81+
coverageFlags+="-enableCodeCoverage YES"
82+
if [ -z "$clonedSourcePackagesPath" ]; then
83+
clonedSourcePackagesPath+="-clonedSourcePackagesDirPath ~/Library/Developer/Xcode/DerivedData/Amplify"
84+
fi
85+
86+
if [ -z "$derivedDataPath" ]; then
87+
derivedDataPath+="-derivedDataPath Build/"
88+
fi
89+
fi
90+
91+
if [ "${{ inputs.disable_package_resolution }}" == "true" ]; then
92+
echo "Disabling Automatic Package Resolution"
93+
clonedSourcePackagesPath+=" -disableAutomaticPackageResolution"
94+
fi
95+
96+
action="test"
97+
if [ "${{ inputs.test_without_building }}" == "true" ]; then
98+
echo "Testing without building..."
99+
action+="-without-building"
100+
fi
101+
102+
xcode-select -p
42103
xcodebuild -version
43-
xcodebuild test -scheme $SCHEME -sdk '${{ inputs.sdk }}' -destination '${{ inputs.destination }}' ${{ inputs.other_flags }} | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]}
104+
xcodebuild $action -scheme $SCHEME -sdk '${{ inputs.sdk }}' -destination '${{ inputs.destination }}' ${{ inputs.other_flags }} $clonedSourcePackagesPath $derivedDataPath $coverageFlags | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]}
105+
shell: bash
106+
107+
- name: Generate Coverage report
108+
if: ${{ inputs.generate_coverage == 'true' }}
109+
env:
110+
SCHEME: ${{ inputs.scheme }}
111+
DERIVED_DATA_PATH: ${{ inputs.derived_data_path }}
112+
run: |
113+
echo "Generating Coverage report..."
114+
115+
derivedDataPath=""
116+
if [ ! -z "$DERIVED_DATA_PATH" ]; then
117+
derivedDataPath="$DERIVED_DATA_PATH"
118+
else
119+
derivedDataPath="Build"
120+
fi
121+
122+
cd $derivedDataPath/Build/ProfileData
123+
cd $(ls -d */|head -n 1)
124+
pathCoverage=Build/Build/ProfileData/${PWD##*/}/Coverage.profdata
125+
cd ${{ github.workspace }}
126+
xcrun llvm-cov export -format="lcov" -instr-profile $pathCoverage $derivedDataPath/Build/Products/Debug-${{ inputs.sdk }}/$SCHEME.o > $SCHEME-Coverage.lcov
44127
shell: bash
Lines changed: 107 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Build | Amplify Swift
22
on:
33
workflow_call:
4+
inputs:
5+
identifier:
6+
required: true
7+
type: string
48
workflow_dispatch:
59
push:
610
branches-ignore:
@@ -10,57 +14,153 @@ on:
1014
permissions:
1115
contents: read
1216

17+
concurrency:
18+
group: ${{ inputs.identifier || github.workflow }}-${{ github.event.pull_request.number || github.ref }}
19+
cancel-in-progress: ${{ github.ref_name != 'main'}}
20+
1321
jobs:
1422
build-amplify-swift-iOS:
1523
runs-on: macos-13
24+
timeout-minutes: 20
1625
steps:
17-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
26+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3
1827
with:
1928
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-
2039
- name: Build Amplify Swift for iOS
2140
uses: ./.github/composite_actions/run_xcodebuild
2241
with:
2342
scheme: Amplify-Package
43+
destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4'
2444
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 }}
2553

2654
build-amplify-swift-macOS:
2755
runs-on: macos-13
56+
timeout-minutes: 20
2857
steps:
29-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
58+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3
3059
with:
3160
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-
3271
- name: Build Amplify Swift for macOS
3372
uses: ./.github/composite_actions/run_xcodebuild
3473
with:
3574
scheme: Amplify-Package
3675
destination: platform=macOS,arch=x86_64
3776
sdk: macosx
3877
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 }}
3986

4087
build-amplify-swift-tvOS:
4188
runs-on: macos-13
89+
timeout-minutes: 20
4290
steps:
43-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
91+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3
4492
with:
4593
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-
46104
- name: Build Amplify Swift for tvOS
47105
uses: ./.github/composite_actions/run_xcodebuild
48106
with:
49107
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
51109
sdk: appletvsimulator
52110
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 }}
53119

54120
build-amplify-swift-watchOS:
55121
runs-on: macos-13
122+
timeout-minutes: 20
56123
steps:
57-
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
124+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3
58125
with:
59126
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-
60137
- name: Build Amplify Swift for watchOS
61138
uses: ./.github/composite_actions/run_xcodebuild
62139
with:
63140
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
65142
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

.github/workflows/canary.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Canary Test
2+
3+
on:
4+
schedule:
5+
- cron: '0 16 * * *' # Everyday 16:00 UTC
6+
7+
permissions: {}
8+
9+
concurrency:
10+
group: ${{ github.workflow }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
canary-test:
15+
strategy:
16+
matrix:
17+
include:
18+
- os: macos-13
19+
xcode-version: 14.3.1
20+
device: iPhone 14 Pro
21+
version: 16.4
22+
- os: macos-12
23+
xcode-version: 14.1
24+
device: iPhone 13 Pro
25+
version: 16.1
26+
name: Canary Test - Xcode ${{ matrix.xcode-version }}
27+
runs-on: ${{ matrix.os }}
28+
steps:
29+
- name: Checkout Code
30+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
31+
with:
32+
persist-credentials: false
33+
34+
- name: Install amplify-cli
35+
run: npm install -g @aws-amplify/[email protected]
36+
37+
- name: Create Sample Amplify App
38+
working-directory: ${{ github.workspace }}/canaries/example
39+
run: amplify init --quickstart --frontend ios
40+
41+
- name: Setup Ruby
42+
uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
43+
with:
44+
ruby-version: '3.2.1'
45+
bundler-cache: true
46+
working-directory: ${{ github.workspace }}/canaries/example
47+
48+
- name: Set Default Xcode Version to ${{ matrix.xcode-version }}
49+
run: |
50+
sudo xcode-select -s "/Applications/Xcode_${{ matrix.xcode-version }}.app"
51+
xcodebuild -version
52+
53+
- name: Run Tests - ${{ matrix.device }} with iOS ${{ matrix.version }}
54+
working-directory: ${{ github.workspace }}/canaries/example
55+
run: bundle exec fastlane scan --device "${{ matrix.device }}" --deployment_target_version "${{ matrix.version }}"
56+

.github/workflows/codeql.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939

4040
steps:
4141
- name: Checkout repository
42-
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
42+
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3
4343

4444
# Initializes the CodeQL tools for scanning.
4545
- name: Initialize CodeQL
@@ -52,3 +52,12 @@ jobs:
5252
- name: Perform CodeQL Analysis
5353
uses: github/codeql-action/analyze@822fe5ef9a15bd752ef127e9ff6eac38ec37dd9c
5454

55+
confirm-pass:
56+
runs-on: ubuntu-latest
57+
name: Confirm Passing CodeQL Scan
58+
if: ${{ !cancelled() }}
59+
needs: [ analyze ]
60+
env:
61+
EXIT_CODE: ${{ contains(needs.*.result, 'failure') && 1 || 0 }}
62+
steps:
63+
- run: exit $EXIT_CODE

0 commit comments

Comments
 (0)