Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: kickoff v1 release #3422

Merged
merged 7 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
507 changes: 0 additions & 507 deletions .circleci/config.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/build_test_amplify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build Test Amplify
on:
workflow_call:
workflow_dispatch:
push:
branches-ignore:
- v1
- release-v1

permissions:
contents: read

jobs:
build-test-amplify:
runs-on: macos-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
with:
persist-credentials: false
- name: Build Test Amplify
uses: ./.github/composite_actions/run_xcodebuild_test
with:
project_path: .
workspace: Amplify.xcworkspace
scheme: Amplify

build-amplify-spm:
runs-on: macos-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
with:
persist-credentials: false
- name: Build Amplify for SPM
run: xcodebuild build-for-testing -scheme Amplify-Package -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 13,OS=latest' | xcpretty
78 changes: 78 additions & 0 deletions .github/workflows/deploy_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Deploy Package
on:
workflow_call:
inputs:
type:
description: 'The type of deployment. Valid values are unstable (default) and release'
default: 'unstable'
required: false
type: string

permissions:
id-token: write
contents: write

jobs:
build-and-test-amplify:
name: Build and Test Amplify
uses: ./.github/workflows/build_test_amplify.yml

unit-tests:
name: Run Plugins Unit Tests
uses: ./.github/workflows/unit_test.yml

fortify:
name: Run Fortify Scan
uses: ./.github/workflows/fortify_scan.yml
secrets: inherit

release:
name: Release new ${{ inputs.type }} version
environment: Release
needs: [build-and-test-amplify, unit-tests, fortify]
runs-on: macos-latest
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 #v2
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-session-name: ${{ format('{0}.release', github.run_id) }}
aws-region: ${{ secrets.AWS_REGION }}
role-duration-seconds: 900

- id: retrieve-token
name: Retrieve Deploy Token
env:
DEPLOY_SECRET_ARN: ${{ secrets.DEPLOY_SECRET_ARN }}
run: |
PAT=$(aws secretsmanager get-secret-value \
--secret-id "$DEPLOY_SECRET_ARN" \
| jq -r ".SecretString | fromjson | .Credential")
echo "token=$PAT" >> $GITHUB_OUTPUT

- name: Checkout repo
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
with:
fetch-depth: 10
token: ${{steps.retrieve-token.outputs.token}}

- name: Restore Gems Cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: vendor/bundle
key: v2-gems-${{ hashFiles('**/Gemfile.lock') }}

- name: Install Bundle
env:
BUNDLE_PATH: vendor/bundle
run: |
bundle config set --local path $BUNDLE_PATH
bundle check || bundle install

- name: Release Pods
env:
COCOAPODS_SECRET_ARN: ${{ secrets.COCOAPODS_SECRET_ARN }}
WORKING_DIRECTORY: ${{ github.workspace }}
GITHUB_EMAIL: [email protected]
GITHUB_USER: aws-amplify-ops
run: bundle exec fastlane ${{ inputs.type }}
16 changes: 16 additions & 0 deletions .github/workflows/deploy_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Build, Test and Release | Stable version
on:
push:
branches:
release-v1

permissions:
id-token: write
contents: write

jobs:
release-stable:
uses: ./.github/workflows/deploy_package.yml
with:
type: release
secrets: inherit
16 changes: 16 additions & 0 deletions .github/workflows/deploy_unstable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Build, Test and Release | Unstable version
on:
push:
branches:
v1

permissions:
id-token: write
contents: write

jobs:
release-unstable:
uses: ./.github/workflows/deploy_package.yml
with:
type: unstable
secrets: inherit
56 changes: 56 additions & 0 deletions .github/workflows/fortify_scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Fortify Scan
on:
workflow_dispatch:
workflow_call:
push:
branches-ignore:
- v1
- release-v1

permissions:
id-token: write
contents: read

jobs:
fortify-scan:
runs-on: macos-latest
environment: Fortify
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
with:
persist-credentials: false

- name: Make source directory
run: |
mkdir source
cp -r Amplify source
cp -r AmplifyPlugins source
- name: Configure AWS credentials for fetching fortify resources
uses: aws-actions/configure-aws-credentials@05b148adc31e091bafbaf404f745055d4d3bc9d2 # Pin to 1.6.1
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
role-session-name: GHAFortifySession
role-duration-seconds: 900

- name: Download License
run: |
aws s3 cp s3://${{ secrets.AWS_S3_FORTIFY_BUCKET }}${{ vars.LICENSE_PATH }} fortify.license
- name: Download Installer
run: |
aws s3 cp s3://${{ secrets.AWS_S3_FORTIFY_BUCKET }}${{ vars.INSTALLER_PATH }} Fortify_SCA_and_Apps_22.1.1_Mac.tar.gz
tar -xvf Fortify_SCA_and_Apps_22.1.1_Mac.tar.gz
unzip Fortify_SCA_and_Apps_22.1.1_osx_x64.app.zip
- name: Download Scripts
run: |
aws s3 cp s3://${{ secrets.AWS_S3_FORTIFY_BUCKET }}${{ vars.SCRIPTS_PATH }} fortify_scan.sh
- name: Run Installer
run: |
Fortify_SCA_and_Apps_22.1.1_osx_x64.app/Contents/MacOS/installbuilder.sh --mode unattended --installdir ~/amplify-swift/Fortify --InstallSamples 0 --fortify_license_path fortify.license --MigrateSCA 0
export PATH=~/amplify-swift/Fortify/bin:$PATH
fortifyupdate -acceptKey
sourceanalyzer -version
- name: Run Scan
run: |
export PATH=~/amplify-swift/Fortify/bin:$PATH
sh ./fortify_scan.sh source
1 change: 1 addition & 0 deletions .github/workflows/integ_test.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: Integration Tests
on:
workflow_call:
push:
branches: [v1]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_kickoff.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Creates a PR to push main to release branch to kick-off the CircleCI release workflow
# Creates a PR to push main to release branch to kick-off the release workflow
name: Release Amplify iOS V1+

on:
Expand Down
124 changes: 124 additions & 0 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Unit Tests
on:
workflow_call:
workflow_dispatch:
push:
branches-ignore:
- v1
- release-v1

permissions:
contents: read

jobs:
unit-test-aws-plugins-core:
runs-on: macos-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
with:
persist-credentials: false

- name: Unit Test AWSPluginsCore
uses: ./.github/composite_actions/run_xcodebuild_test
with:
project_path: .
workspace: Amplify.xcworkspace
scheme: AWSPluginsCore

unit-test-analytics:
runs-on: macos-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
with:
persist-credentials: false

- name: Unit Test Analytics
uses: ./.github/composite_actions/run_xcodebuild_test
with:
project_path: ./AmplifyPlugins/Analytics/
workspace: AnalyticsCategoryPlugin.xcworkspace
scheme: AWSPinpointAnalyticsPlugin

unit-test-api:
runs-on: macos-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
with:
persist-credentials: false

- name: Unit Test API
uses: ./.github/composite_actions/run_xcodebuild_test
with:
project_path: ./AmplifyPlugins/API/
workspace: APICategoryPlugin.xcworkspace
scheme: AWSAPICategoryPlugin

unit-test-auth:
runs-on: macos-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
with:
persist-credentials: false

- name: Unit Test Auth
uses: ./.github/composite_actions/run_xcodebuild_test
with:
project_path: ./AmplifyPlugins/Auth/
workspace: AWSCognitoAuthPlugin.xcworkspace
scheme: AWSCognitoAuthPlugin

unit-test-datastore:
runs-on: macos-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
with:
persist-credentials: false

- name: Unit Test DataStore
uses: ./.github/composite_actions/run_xcodebuild_test
with:
project_path: ./AmplifyPlugins/DataStore/
workspace: DataStoreCategoryPlugin.xcworkspace
scheme: AWSDataStoreCategoryPlugin

unit-test-geo:
runs-on: macos-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
with:
persist-credentials: false

- name: Unit Test Geo
uses: ./.github/composite_actions/run_xcodebuild_test
with:
project_path: ./AmplifyPlugins/Geo/
workspace: GeoCategoryPlugin.xcworkspace
scheme: AWSLocationGeoPlugin

unit-test-predictions:
runs-on: macos-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
with:
persist-credentials: false

- name: Unit Test Predictions
uses: ./.github/composite_actions/run_xcodebuild_test
with:
project_path: ./AmplifyPlugins/Predictions/
workspace: PredictionsCategoryPlugin.xcworkspace
scheme: CoreMLPredictionsPlugin

unit-test-storage:
runs-on: macos-latest
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
with:
persist-credentials: false

- name: Unit Test Auth
uses: ./.github/composite_actions/run_xcodebuild_test
with:
project_path: ./AmplifyPlugins/Storage/
workspace: StoragePlugin.xcworkspace
scheme: AWSS3StoragePlugin
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,17 @@ extension Model where Self: Codable {
/// application making any change to these `public` types should be backward compatible, otherwise it will be a
/// breaking change.
public func toJSON(encoder: JSONEncoder? = nil) throws -> String {
let resolvedEncoder: JSONEncoder
var resolvedEncoder: JSONEncoder
if let encoder = encoder {
resolvedEncoder = encoder
} else {
resolvedEncoder = JSONEncoder(dateEncodingStrategy: ModelDateFormatting.encodingStrategy)
}

if isKnownUniquelyReferenced(&resolvedEncoder) {
resolvedEncoder.outputFormatting = .sortedKeys
}

let data = try resolvedEncoder.encode(self)
guard let json = String(data: data, encoding: .utf8) else {
throw DataStoreError.decodingError(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ extension ModelValueConverter {
}

static var jsonEncoder: JSONEncoder {
JSONEncoder(dateEncodingStrategy: ModelDateFormatting.encodingStrategy)
let encoder = JSONEncoder(dateEncodingStrategy: ModelDateFormatting.encodingStrategy)
encoder.outputFormatting = .sortedKeys
return encoder
}

/// - Warning: Although this has `public` access, it is intended for internal & codegen use and should not be used
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,8 @@ final class OutgoingMutationQueue: OutgoingMutationQueueBehavior {
api: api,
storageAdapter: storageAdapter,
graphQLResponseError: graphQLResponseError,
apiError: apiError
apiError: apiError,
reconciliationQueue: reconciliationQueue
) { [weak self] result in
guard let self = self else {
return
Expand Down
Loading
Loading