From f5a0cfb77439099aae2e44c2b82268346108e6ae Mon Sep 17 00:00:00 2001 From: Sebastian Villena <97059974+ruisebas@users.noreply.github.com> Date: Tue, 1 Aug 2023 16:42:11 -0400 Subject: [PATCH 1/6] chore: Migrating testing and release workflows to GitHub Actions. (#35) --- .circleci/config.yml | 115 -------------------------- .github/workflows/build-and-test.yml | 89 ++++++++++++++++++++ .github/workflows/release-kickoff.yml | 2 +- .github/workflows/release.yml | 56 +++++++++++++ fastlane/Fastfile | 16 ---- 5 files changed, 146 insertions(+), 132 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/build-and-test.yml create mode 100644 .github/workflows/release.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index cc26984..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,115 +0,0 @@ - -version: 2.1 - - -orbs: - macos: circleci/macos@2.3.3 - ruby: circleci/ruby@2.0.0 - aws-cli: circleci/aws-cli@3.1.4 - -default-executor: &default-executor - macos: - xcode: 14.1.0 - working_directory: ~/circle-ci - environment: - FL_OUTPUT_DIR: output - -jobs: - build-test-ios: - <<: *default-executor - - steps: - - checkout - - ruby/install-deps - - run: - name: Unit tests - command: bundle exec fastlane ios tests - - run: - name: Integration tests - command: bundle exec fastlane ios integration_tests - - build-test-macos: - <<: *default-executor - - steps: - - checkout - - ruby/install-deps - - run: - name: Unit tests - command: bundle exec fastlane mac tests - - build-test-tvos: - <<: *default-executor - - steps: - - checkout - - ruby/install-deps - - run: - name: Unit tests - command: bundle exec fastlane tvos tests - - build-test-watchos: - <<: *default-executor - - steps: - - checkout - - ruby/install-deps - - run: - name: Unit tests - command: bundle exec fastlane watchos tests - - release: - <<: *default-executor - - steps: - - add_ssh_keys: - fingerprints: - - "1d:f2:37:1e:7e:38:02:e0:76:2d:6a:a8:47:2e:85:09" - - checkout - - ruby/install-deps - - aws-cli/setup: - role-arn: $AWS_OIDC_ROLE_ARN - role-session-name: "${CIRCLE_WORKFLOW_JOB_ID}.release" - session-duration: '900' - - run: - name: Publish new version to cocoapods trunk - command: bundle exec fastlane ios release - - publish-doc: - <<: *default-executor - - steps: - - add_ssh_keys: - fingerprints: - - "1d:f2:37:1e:7e:38:02:e0:76:2d:6a:a8:47:2e:85:09" - - checkout - - ruby/install-deps - - run: - name: Publish documention for new version - command: bundle exec fastlane ios publish_doc - - -workflows: - build-test-deploy: - jobs: - - build-test-ios - - build-test-macos - - build-test-tvos - - build-test-watchos - - release: - filters: - branches: - only: release - requires: - - build-test-ios - - build-test-macos - - build-test-tvos - - build-test-watchos - context: amplify-swift-aws-oidc - - - publish-doc: - filters: - branches: - only: release - requires: - - release diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..883607a --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,89 @@ +name: Build and Test +on: + workflow_call: + workflow_dispatch: + push: + branches: + - main + pull_request: + branches: + - main + +permissions: + contents: read + +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + build-test-ios: + runs-on: macos-latest + steps: + - name: Checkout repo + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + with: + persist-credentials: false + + - name: Setup Ruby + uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0 + with: + ruby-version: '3.2.1' + bundler-cache: true + + - name: Run unit tests + run: bundle exec fastlane ios tests + + - name: Run integration tests + run: bundle exec fastlane ios integration_tests + + build-test-macos: + runs-on: macos-latest + steps: + - name: Checkout repo + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + with: + persist-credentials: false + + - name: Setup Ruby + uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0 + with: + ruby-version: '3.2.1' + bundler-cache: true + + - name: Run unit tests + run: bundle exec fastlane mac tests + + build-test-tvos: + runs-on: macos-latest + steps: + - name: Checkout repo + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + with: + persist-credentials: false + + - name: Setup Ruby + uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0 + with: + ruby-version: '3.2.1' + bundler-cache: true + + - name: Run unit tests + run: bundle exec fastlane tvos tests + + build-test-watchos: + runs-on: macos-latest + steps: + - name: Checkout repo + uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 + with: + persist-credentials: false + + - name: Setup Ruby + uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0 + with: + ruby-version: '3.2.1' + bundler-cache: true + + - name: Run unit tests + run: bundle exec fastlane watchos tests diff --git a/.github/workflows/release-kickoff.yml b/.github/workflows/release-kickoff.yml index 17b6904..364d1c3 100644 --- a/.github/workflows/release-kickoff.yml +++ b/.github/workflows/release-kickoff.yml @@ -1,4 +1,4 @@ -name: Release new version +name: Kick off new release on: workflow_dispatch diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c97326c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,56 @@ +name: Release new version +on: + push: + branches: + - release + +permissions: + id-token: write + contents: write +jobs: + build-and-test: + uses: ./.github/workflows/build-and-test.yml + + release: + environment: Release + needs: [build-and-test] + 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 }} + + - id: retrieve-token + name: Retrieve Token + env: + DEPLOY_SECRET_ARN: ${{ secrets.DEPLOY_SECRET_ARN }} + run: | + PAT=$(aws secretsmanager get-secret-value \ + --secret-id "$DEPLOY_SECRET_ARN" \ + | jq ".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: Setup Ruby + uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0 + with: + ruby-version: '3.2.1' + bundler-cache: true + + - name: Fetch tags + run: git fetch --tags origin + + - name: Publish new version to cocoapods trunk + env: + COCOAPODS_SECRET_ARN: ${{ secrets.COCOAPODS_SECRET_ARN }} + GITHUB_EMAIL: aws-amplify-ops@amazon.com + GITHUB_USER: aws-amplify-ops + run: bundle exec fastlane ios release diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 1bd96e8..43d4139 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -4,10 +4,6 @@ PODSPEC_PATH = "AmplifyUtilsNotifications.podspec" CHANGELOG_PATH = "CHANGELOG.md" platform :ios do - before_all do - setup_circle_ci - end - desc "Run all the tests on iOS" lane :tests do run_tests( @@ -137,10 +133,6 @@ platform :ios do end platform :mac do - before_all do - setup_circle_ci - end - desc "Run all the tests on macOS" lane :tests do run_tests( @@ -156,10 +148,6 @@ platform :mac do end platform :tvos do - before_all do - setup_circle_ci - end - desc "Run all the tests on tvOS" lane :tests do run_tests( @@ -175,10 +163,6 @@ platform :tvos do end platform :watchos do - before_all do - setup_circle_ci - end - desc "Run all the tests on watchOS" lane :tests do run_tests( From fc8116b4efac7516edff5bd323a5ebee5eec5a07 Mon Sep 17 00:00:00 2001 From: Sebastian Villena <97059974+ruisebas@users.noreply.github.com> Date: Wed, 2 Aug 2023 18:30:58 -0400 Subject: [PATCH 2/6] chore: Fixing wrong parsing in release workflow (#36) --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c97326c..c52ee96 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,7 +30,7 @@ jobs: run: | PAT=$(aws secretsmanager get-secret-value \ --secret-id "$DEPLOY_SECRET_ARN" \ - | jq ".SecretString | fromjson | .Credential") + | jq -r ".SecretString | fromjson | .Credential") echo "token=$PAT" >> $GITHUB_OUTPUT - name: Checkout repo From f9c0016635d3229669b170589796cd0e3a6b1cc2 Mon Sep 17 00:00:00 2001 From: Sebastian Villena <97059974+ruisebas@users.noreply.github.com> Date: Fri, 4 Aug 2023 17:43:14 -0400 Subject: [PATCH 3/6] chore: Adding step to publish docs (#37) --- .github/workflows/release.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c52ee96..fd1358c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,3 +54,6 @@ jobs: GITHUB_EMAIL: aws-amplify-ops@amazon.com GITHUB_USER: aws-amplify-ops run: bundle exec fastlane ios release + + - name: Publish documentation + run: bundle exec fastlane ios publish_doc From e0801608e8ce191ff22b784cf382ef3db2ee8c8c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 28 Aug 2023 14:02:20 -0400 Subject: [PATCH 4/6] chore(deps): bump activesupport from 6.1.7.3 to 6.1.7.6 (#39) Bumps [activesupport](https://github.com/rails/rails) from 6.1.7.3 to 6.1.7.6. - [Release notes](https://github.com/rails/rails/releases) - [Changelog](https://github.com/rails/rails/blob/v7.0.7.2/activesupport/CHANGELOG.md) - [Commits](https://github.com/rails/rails/compare/v6.1.7.3...v6.1.7.6) --- updated-dependencies: - dependency-name: activesupport dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index d00f0c8..d0bc1dd 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -11,7 +11,7 @@ GEM specs: CFPropertyList (3.0.6) rexml - activesupport (6.1.7.3) + activesupport (6.1.7.6) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) @@ -209,7 +209,7 @@ GEM http-cookie (1.0.5) domain_name (~> 0.5) httpclient (2.8.3) - i18n (1.12.0) + i18n (1.14.1) concurrent-ruby (~> 1.0) jazzy (0.14.3) cocoapods (~> 1.5) @@ -229,7 +229,7 @@ GEM mini_magick (4.12.0) mini_mime (1.1.2) mini_portile2 (2.8.1) - minitest (5.18.0) + minitest (5.19.0) molinillo (0.8.0) multi_json (1.15.0) multipart-post (2.0.0) @@ -300,7 +300,7 @@ GEM rouge (~> 2.0.7) xcpretty-travis-formatter (1.0.1) xcpretty (~> 0.2, >= 0.0.7) - zeitwerk (2.6.7) + zeitwerk (2.6.11) PLATFORMS ruby From b26bf297393ed8b1c9842f5625caafdc94c3e328 Mon Sep 17 00:00:00 2001 From: Di Wu Date: Thu, 14 Sep 2023 14:24:08 -0700 Subject: [PATCH 5/6] ci: add dependency review workflow (#38) * ci: add dependency review workflow * Update dependency-review.yml --- .github/workflows/dependency-review.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/dependency-review.yml diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 0000000..27ebe3b --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,24 @@ +name: Dependency Review + +on: + pull_request: + branches: + - main + +permissions: + contents: read + +jobs: + dependency-review: + name: Dependency Review + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 + with: + persist-credentials: false + + - name: Dependency Review + uses: actions/dependency-review-action@7d90b4f05fea31dde1c4a1fb3fa787e197ea93ab # v3.0.7 + with: + config-file: aws-amplify/amplify-ci-support/.github/dependency-review-config.yml@main From 4be0d8f6b691227cad1d068ec1e5aef067575dd1 Mon Sep 17 00:00:00 2001 From: Tuan Pham <103537251+phantumcode@users.noreply.github.com> Date: Fri, 8 Dec 2023 11:52:43 -0600 Subject: [PATCH 6/6] fix: supports mac catalyst (#40) * fix: supports mac catalyst * simplify import logic --- .../AUNotificationPermissions.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/AmplifyUtilsNotifications/AUNotificationPermissions.swift b/Sources/AmplifyUtilsNotifications/AUNotificationPermissions.swift index dca2279..2e978b7 100644 --- a/Sources/AmplifyUtilsNotifications/AUNotificationPermissions.swift +++ b/Sources/AmplifyUtilsNotifications/AUNotificationPermissions.swift @@ -10,12 +10,12 @@ import UserNotifications #if canImport(WatchKit) import WatchKit -#elseif canImport(AppKit) -import AppKit -typealias Application = NSApplication #elseif canImport(UIKit) import UIKit typealias Application = UIApplication +#elseif canImport(AppKit) +import AppKit +typealias Application = NSApplication #endif @available(iOSApplicationExtension, unavailable)