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/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 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..fd1358c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,59 @@ +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 -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: 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 + + - name: Publish documentation + run: bundle exec fastlane ios publish_doc 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 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) 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(