Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into 5d/amplify-network
Browse files Browse the repository at this point in the history
  • Loading branch information
5d committed May 16, 2024
2 parents 705338f + d6d5a23 commit d3299a4
Show file tree
Hide file tree
Showing 267 changed files with 12,644 additions and 2,994 deletions.
5 changes: 4 additions & 1 deletion .codecov.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
coverage:
codecov:
branch: main

coverage:
status:
patch: off
project:
default:
threshold: 1%
9 changes: 8 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
* @aws-amplify/amplify-ios
# Amplify iOS / Swift team has general approval permissions.
* @aws-amplify/amplify-ios

# Changes to this file requires admin approval.
/.github/CODEOWNERS @aws-amplify/amplify-ios-admins

# Changes to Xcode / OS runtime versions run in CI/CD requires admin approval.
/.github/composite_actions/get_platform_parameters/action.yml @aws-amplify/amplify-ios-admins
17 changes: 12 additions & 5 deletions .github/composite_actions/get_platform_parameters/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,22 @@ runs:
- id: get-xcode-version
run: |
LATEST_XCODE_VERSION=14.3.1
MINIMUM_XCODE_VERSION=14.0.1
MINIMUM_XCODE_VERSION_IOS_MAC=14.1.0
MINIMUM_XCODE_VERSION_WATCH_TV=14.3.1
INPUT_XCODE_VERSION=${{ inputs.xcode_version }}
case $INPUT_XCODE_VERSION in
latest)
XCODE_VERSION=$LATEST_XCODE_VERSION ;;
minimum)
XCODE_VERSION=$MINIMUM_XCODE_VERSION ;;
INPUT_PLATFORM=${{ inputs.platform }}
case $INPUT_PLATFORM in
iOS|macOS)
XCODE_VERSION=$MINIMUM_XCODE_VERSION_IOS_MAC ;;
tvOS|watchOS)
XCODE_VERSION=$MINIMUM_XCODE_VERSION_WATCH_TV ;;
esac ;;
*)
XCODE_VERSION=$INPUT_XCODE_VERSION ;;
esac
Expand All @@ -63,9 +70,9 @@ runs:
DESTINATION_MAPPING='{
"minimum": {
"iOS": "platform=iOS Simulator,name=iPhone 14,OS=16.0",
"tvOS": "platform=tvOS Simulator,name=Apple TV 4K (2nd generation),OS=16.0",
"watchOS": "platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.0",
"iOS": "platform=iOS Simulator,name=iPhone 14,OS=16.1",
"tvOS": "platform=tvOS Simulator,name=Apple TV 4K (2nd generation),OS=16.1",
"watchOS": "platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.1",
"macOS": "platform=macOS,arch=x86_64"
},
"latest": {
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build_amplify_swift_platforms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ jobs:
- platform: ${{ github.event.inputs.macos == 'false' && 'macOS' || 'None' }}
- platform: ${{ github.event.inputs.tvos == 'false' && 'tvOS' || 'None' }}
- platform: ${{ github.event.inputs.watchos == 'false' && 'watchOS' || 'None' }}
uses: ./.github/workflows/build_amplify_swift.yml
uses: ./.github/workflows/build_scheme.yml
with:
scheme: Amplify-Package
platform: ${{ matrix.platform }}

confirm-pass:
Expand Down
19 changes: 15 additions & 4 deletions .github/workflows/build_minimum_supported_swift_platforms.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
name: Build with Minimum Supported Xcode Versions
name: Build with minimum Xcode version | Amplify Swift
on:
workflow_dispatch:
pull_request:
branches:
- main
push:
branches:
- main

permissions:
contents: read
actions: write

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref_name != 'main'}}

jobs:
build-amplify-with-minimum-supported-xcode:
name: Build Amplify Swift for ${{ matrix.platform }}
Expand All @@ -14,12 +24,13 @@ jobs:
matrix:
platform: [iOS, macOS, tvOS, watchOS]

uses: ./.github/workflows/build_amplify_swift.yml
uses: ./.github/workflows/build_scheme.yml
with:
os-runner: macos-12
scheme: Amplify-Build
os-runner: ${{ (matrix.platform == 'tvOS' || matrix.platform == 'watchOS') && 'macos-13' || 'macos-12' }}
xcode-version: 'minimum'
platform: ${{ matrix.platform }}
cacheable: false
save_build_cache: false

confirm-pass:
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: Build Amplify-Package for the given platform
name: Build scheme for the given platform and other parameters
on:
workflow_call:
inputs:
scheme:
type: string
required: true

platform:
type: string
required: true
Expand All @@ -14,7 +18,7 @@ on:
type: string
default: 'macos-13'

cacheable:
save_build_cache:
type: boolean
default: true

Expand All @@ -23,8 +27,8 @@ permissions:
actions: write

jobs:
build-amplify-swift:
name: Build Amplify-Package | ${{ inputs.platform }}
build-scheme:
name: Build ${{ inputs.scheme }} | ${{ inputs.platform }}
runs-on: ${{ inputs.os-runner }}
steps:
- name: Checkout repository
Expand All @@ -41,9 +45,8 @@ jobs:

- name: Attempt to use the dependencies cache
id: dependencies-cache
if: inputs.cacheable
timeout-minutes: 4
continue-on-error: ${{ inputs.cacheable }}
continue-on-error: true
uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: ~/Library/Developer/Xcode/DerivedData/Amplify
Expand All @@ -53,20 +56,18 @@ jobs:
- name: Attempt to restore the build cache from main
id: build-cache
if: inputs.cacheable
timeout-minutes: 4
continue-on-error: ${{ inputs.cacheable }}
continue-on-error: true
uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: ${{ github.workspace }}/Build
key: Amplify-${{ inputs.platform }}-build-cache

- name: Build Amplify for Swift
- name: Build ${{ inputs.scheme }}
id: build-package
continue-on-error: ${{ inputs.cacheable }}
uses: ./.github/composite_actions/run_xcodebuild
with:
scheme: Amplify-Package
scheme: ${{ inputs.scheme }}
destination: ${{ steps.platform.outputs.destination }}
sdk: ${{ steps.platform.outputs.sdk }}
xcode_path: /Applications/Xcode_${{ steps.platform.outputs.xcode-version }}.app
Expand All @@ -75,22 +76,22 @@ jobs:
disable_package_resolution: ${{ steps.dependencies-cache.outputs.cache-hit }}

- name: Save the dependencies cache in main
if: inputs.cacheable && steps.dependencies-cache.outputs.cache-hit != 'true' && github.ref_name == 'main'
if: inputs.save_build_cache && steps.dependencies-cache.outputs.cache-hit != 'true' && github.ref_name == 'main'
uses: actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: ~/Library/Developer/Xcode/DerivedData/Amplify
key: ${{ steps.dependencies-cache.outputs.cache-primary-key }}

- name: Delete the old build cache
if: inputs.cacheable && steps.build-cache.outputs.cache-hit && github.ref_name == 'main'
if: inputs.save_build_cache && steps.build-cache.outputs.cache-hit && github.ref_name == 'main'
env:
GH_TOKEN: ${{ github.token }}
continue-on-error: ${{ inputs.cacheable }}
continue-on-error: true
run: |
gh cache delete ${{ steps.build-cache.outputs.cache-primary-key }}
- name: Save the build cache
if: inputs.cacheable && github.ref_name == 'main'
if: inputs.save_build_cache && github.ref_name == 'main'
uses: actions/cache/save@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: ${{ github.workspace }}/Build
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/deploy_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
uses: ./.github/workflows/unit_test.yml
with:
identifier: 'workflow-call-unit-test'
secrets: inherit

fortify:
name: Run Fortify Scan
Expand Down Expand Up @@ -66,7 +67,7 @@ jobs:
token: ${{steps.retrieve-token.outputs.token}}

- name: Setup Ruby
uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
uses: ruby/setup-ruby@22fdc77bf4148f810455b226c90fb81b5cbc00a7 # v1.171.0
with:
ruby-version: '3.2.1'
bundler-cache: true
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/deploy_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
uses: ./.github/workflows/unit_test.yml
with:
identifier: 'workflow-call-unit-test'
secrets: inherit

fortify:
name: Run Fortify Scan
Expand Down Expand Up @@ -62,7 +63,7 @@ jobs:
token: ${{steps.retrieve-token.outputs.token}}

- name: Setup Ruby
uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
uses: ruby/setup-ruby@22fdc77bf4148f810455b226c90fb81b5cbc00a7 # v1.171.0
with:
ruby-version: '3.2.1'
bundler-cache: true
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/deploy_unstable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
uses: ./.github/workflows/unit_test.yml
with:
identifier: 'workflow-call-unit-test'
secrets: inherit

fortify:
name: Run Fortify Scan
Expand Down Expand Up @@ -62,7 +63,7 @@ jobs:
token: ${{steps.retrieve-token.outputs.token}}

- name: Setup Ruby
uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
uses: ruby/setup-ruby@22fdc77bf4148f810455b226c90fb81b5cbc00a7 # v1.171.0
with:
ruby-version: '3.2.1'
bundler-cache: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
token: ${{steps.retrieve-token.outputs.token}}

- name: Setup Ruby
uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
uses: ruby/setup-ruby@22fdc77bf4148f810455b226c90fb81b5cbc00a7 # v1.171.0
with:
ruby-version: '3.2.1'
bundler-cache: true
Expand Down
14 changes: 8 additions & 6 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ concurrency:
cancel-in-progress: ${{ github.ref_name != 'main'}}

jobs:
unit-tests-without-coverage:
targets-without-coverage:
name: ${{ matrix.scheme }} Unit Tests
strategy:
fail-fast: false
Expand All @@ -54,7 +54,7 @@ jobs:
scheme: ${{ matrix.scheme }}
generate_coverage_report: false

unit-tests-with-coverage:
targets-with-coverage:
name: ${{ matrix.scheme }} Unit Tests
strategy:
fail-fast: false
Expand All @@ -76,11 +76,12 @@ jobs:
uses: ./.github/workflows/run_unit_tests_platforms.yml
with:
scheme: ${{ matrix.scheme }}
generate_coverage_report: true
generate_coverage_report: ${{ vars.DISABLE_COVERAGE_REPORT != 'true' }}

report-coverage:
if: ${{ vars.DISABLE_COVERAGE_REPORT != 'true' }}
name: ${{ matrix.file.scheme }} Unit Tests
needs: [unit-tests-with-coverage]
needs: [targets-with-coverage]
strategy:
fail-fast: false
matrix:
Expand All @@ -102,14 +103,15 @@ jobs:
with:
scheme: ${{ matrix.file.scheme }}
flags: ${{ matrix.file.flags }}
secrets: inherit

unit-test-pass-confirmation:
runs-on: ubuntu-latest
name: Confirm Passing Unit Tests
if: ${{ !cancelled() }}
needs: [
unit-tests-with-coverage,
unit-tests-without-coverage
targets-with-coverage,
targets-without-coverage
]
env:
EXIT_CODE: ${{ contains(needs.*.result, 'failure') && 1 || 0 }}
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/upload_coverage_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ jobs:
path: ${{ github.workspace }}

- name: Upload report to Codecov
shell: bash
run: |
build-support/codecov.sh -F '${{ inputs.flags }}'
uses: codecov/codecov-action@84508663e988701840491b86de86b666e8a86bed # v4.3.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: ${{ inputs.flags }}
Loading

0 comments on commit d3299a4

Please sign in to comment.