Skip to content

Commit

Permalink
chore: kickoff release
Browse files Browse the repository at this point in the history
  • Loading branch information
ruisebas authored Aug 24, 2023
2 parents 3c03eb7 + 5ce17ba commit 5b95da8
Show file tree
Hide file tree
Showing 51 changed files with 963 additions and 734 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ runs:
using: "composite"
steps:
- name: Configure AWS credentials for {{ inputs.resource_subfolder }}
uses: aws-actions/configure-aws-credentials@05b148adc31e091bafbaf404f745055d4d3bc9d2 # Pin to 1.6.1
uses: aws-actions/configure-aws-credentials@5fd3084fc36e372ff1fff382a39b10d03659f355 #v2
with:
role-to-assume: ${{ inputs.aws_role_to_assume }}
aws-region: ${{ inputs.aws_region }}
Expand Down
11 changes: 10 additions & 1 deletion .github/composite_actions/run_xcodebuild/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ inputs:
required: false
type: string
default: 'iphonesimulator'
disable_package_resolution:
required: false
type: boolean
default: false
other_flags:
required: false
type: string
Expand All @@ -39,6 +43,11 @@ runs:
if [ ! -z "$XCODE_PATH" ]; then
sudo xcode-select -s $XCODE_PATH
fi
otherFlags="${{ inputs.other_flags }}"
if [ "${{ inputs.disable_package_resolution }}" == "true" ]; then
otherFlags+=" -disableAutomaticPackageResolution"
fi
xcodebuild -version
xcodebuild build -scheme $SCHEME -sdk '${{ inputs.sdk }}' -destination '${{ inputs.destination }}' ${{ inputs.other_flags }} | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]}
xcodebuild build -scheme $SCHEME -sdk '${{ inputs.sdk }}' -destination '${{ inputs.destination }}' $otherFlags | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]}
shell: bash
85 changes: 84 additions & 1 deletion .github/composite_actions/run_xcodebuild_test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,26 @@ inputs:
required: false
type: string
default: ''
generate_coverage:
required: false
type: boolean
default: false
cloned_source_packages_path:
required: false
type: string
default: ''
derived_data_path:
required: false
type: string
default: ''
disable_package_resolution:
required: false
type: boolean
default: false
test_without_building:
required: false
type: boolean
default: false

runs:
using: "composite"
Expand All @@ -32,13 +52,76 @@ runs:
SCHEME: ${{ inputs.scheme }}
PROJECT_PATH: ${{ inputs.project_path }}
XCODE_PATH: ${{ inputs.xcode_path }}
CLONED_SOURCE_PACKAGES_PATH: ${{ inputs.cloned_source_packages_path }}
DERIVED_DATA_PATH: ${{ inputs.derived_data_path }}
run: |
if [ ! -z "$PROJECT_PATH" ]; then
cd $PROJECT_PATH
fi
if [ ! -z "$XCODE_PATH" ]; then
echo "Using Xcode $XCODE_PATH"
sudo xcode-select -s $XCODE_PATH
fi
clonedSourcePackagesPath=""
if [ ! -z "$CLONED_SOURCE_PACKAGES_PATH" ]; then
echo "Using custom cloned source packages path"
clonedSourcePackagesPath+="-clonedSourcePackagesDirPath $CLONED_SOURCE_PACKAGES_PATH"
fi
derivedDataPath=""
if [ ! -z "$DERIVED_DATA_PATH" ]; then
echo "Using custom DerivedData path"
derivedDataPath+="-derivedDataPath $DERIVED_DATA_PATH"
fi
coverageFlags=""
if [ "${{ inputs.generate_coverage }}" == "true" ]; then
echo "Code Coverage is enabled!"
coverageFlags+="-enableCodeCoverage YES"
if [ -z "$clonedSourcePackagesPath" ]; then
clonedSourcePackagesPath+="-clonedSourcePackagesDirPath ~/Library/Developer/Xcode/DerivedData/Amplify"
fi
if [ -z "$derivedDataPath" ]; then
derivedDataPath+="-derivedDataPath Build/"
fi
fi
if [ "${{ inputs.disable_package_resolution }}" == "true" ]; then
echo "Disabling Automatic Package Resolution"
clonedSourcePackagesPath+=" -disableAutomaticPackageResolution"
fi
action="test"
if [ "${{ inputs.test_without_building }}" == "true" ]; then
echo "Testing without building..."
action+="-without-building"
fi
xcode-select -p
xcodebuild -version
xcodebuild test -scheme $SCHEME -sdk '${{ inputs.sdk }}' -destination '${{ inputs.destination }}' ${{ inputs.other_flags }} | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]}
xcodebuild $action -scheme $SCHEME -sdk '${{ inputs.sdk }}' -destination '${{ inputs.destination }}' ${{ inputs.other_flags }} $clonedSourcePackagesPath $derivedDataPath $coverageFlags | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]}
shell: bash

- name: Generate Coverage report
if: ${{ inputs.generate_coverage == 'true' }}
env:
SCHEME: ${{ inputs.scheme }}
DERIVED_DATA_PATH: ${{ inputs.derived_data_path }}
run: |
echo "Generating Coverage report..."
derivedDataPath=""
if [ ! -z "$DERIVED_DATA_PATH" ]; then
derivedDataPath="$DERIVED_DATA_PATH"
else
derivedDataPath="Build"
fi
cd $derivedDataPath/Build/ProfileData
cd $(ls -d */|head -n 1)
pathCoverage=Build/Build/ProfileData/${PWD##*/}/Coverage.profdata
cd ${{ github.workspace }}
xcrun llvm-cov export -format="lcov" -instr-profile $pathCoverage $derivedDataPath/Build/Products/Debug-${{ inputs.sdk }}/$SCHEME.o > $SCHEME-Coverage.lcov
shell: bash
114 changes: 107 additions & 7 deletions .github/workflows/build_amplify_swift.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Build | Amplify Swift
on:
workflow_call:
inputs:
identifier:
required: true
type: string
workflow_dispatch:
push:
branches-ignore:
Expand All @@ -10,57 +14,153 @@ on:
permissions:
contents: read

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

jobs:
build-amplify-swift-iOS:
runs-on: macos-13
timeout-minutes: 20
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3
with:
persist-credentials: false
- name: Attempt to restore dependencies cache
id: cache-packages
timeout-minutes: 4
continue-on-error: true
uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: ~/Library/Developer/Xcode/DerivedData/Amplify
key: amplify-packages-${{ hashFiles('Package.resolved') }}
restore-keys: |
amplify-packages-
- name: Build Amplify Swift for iOS
uses: ./.github/composite_actions/run_xcodebuild
with:
scheme: Amplify-Package
destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4'
xcode_path: '/Applications/Xcode_14.3.app'
disable_package_resolution: ${{ steps.cache-packages.outputs.cache-hit }}
other_flags: '-derivedDataPath Build -clonedSourcePackagesDirPath ~/Library/Developer/Xcode/DerivedData/Amplify'
- name: Save the dependencies cache if necessary
if: steps.cache-packages.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.cache-packages.outputs.cache-primary-key }}

build-amplify-swift-macOS:
runs-on: macos-13
timeout-minutes: 20
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3
with:
persist-credentials: false
- name: Attempt to restore dependencies cache
id: cache-packages
timeout-minutes: 4
continue-on-error: true
uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: ~/Library/Developer/Xcode/DerivedData/Amplify
key: amplify-packages-${{ hashFiles('Package.resolved') }}
restore-keys: |
amplify-packages-
- name: Build Amplify Swift for macOS
uses: ./.github/composite_actions/run_xcodebuild
with:
scheme: Amplify-Package
destination: platform=macOS,arch=x86_64
sdk: macosx
xcode_path: '/Applications/Xcode_14.3.app'
disable_package_resolution: ${{ steps.cache-packages.outputs.cache-hit }}
other_flags: '-derivedDataPath Build -clonedSourcePackagesDirPath ~/Library/Developer/Xcode/DerivedData/Amplify'
- name: Save the dependencies cache if necessary
if: steps.cache-packages.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.cache-packages.outputs.cache-primary-key }}

build-amplify-swift-tvOS:
runs-on: macos-13
timeout-minutes: 20
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3
with:
persist-credentials: false
- name: Attempt to restore dependencies cache
timeout-minutes: 4
id: cache-packages
continue-on-error: true
uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: ~/Library/Developer/Xcode/DerivedData/Amplify
key: amplify-packages-${{ hashFiles('Package.resolved') }}
restore-keys: |
amplify-packages-
- name: Build Amplify Swift for tvOS
uses: ./.github/composite_actions/run_xcodebuild
with:
scheme: Amplify-Package
destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=latest
destination: platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=16.4
sdk: appletvsimulator
xcode_path: '/Applications/Xcode_14.3.app'
disable_package_resolution: ${{ steps.cache-packages.outputs.cache-hit }}
other_flags: '-derivedDataPath Build -clonedSourcePackagesDirPath ~/Library/Developer/Xcode/DerivedData/Amplify'
- name: Save the dependencies cache if necessary
if: steps.cache-packages.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.cache-packages.outputs.cache-primary-key }}

build-amplify-swift-watchOS:
runs-on: macos-13
timeout-minutes: 20
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3
with:
persist-credentials: false
- name: Attempt to restore dependencies cache
id: cache-packages
timeout-minutes: 4
continue-on-error: true
uses: actions/cache/restore@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: ~/Library/Developer/Xcode/DerivedData/Amplify
key: amplify-packages-${{ hashFiles('Package.resolved') }}
restore-keys: |
amplify-packages-
- name: Build Amplify Swift for watchOS
uses: ./.github/composite_actions/run_xcodebuild
with:
scheme: Amplify-Package
destination: platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=latest
destination: platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=9.4
sdk: watchsimulator
xcode_path: '/Applications/Xcode_14.3.app'
xcode_path: '/Applications/Xcode_14.3.app'
disable_package_resolution: ${{ steps.cache-packages.outputs.cache-hit }}
other_flags: '-derivedDataPath Build -clonedSourcePackagesDirPath ~/Library/Developer/Xcode/DerivedData/Amplify'
- name: Save the dependencies cache if necessary
if: steps.cache-packages.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.cache-packages.outputs.cache-primary-key }}

confirm-pass:
runs-on: ubuntu-latest
name: Confirm Passing Build Steps
if: ${{ !cancelled() }}
needs: [
build-amplify-swift-iOS,
build-amplify-swift-macOS,
build-amplify-swift-tvOS,
build-amplify-swift-watchOS
]
env:
EXIT_CODE: ${{ contains(needs.*.result, 'failure') && 1 || 0 }}
steps:
- run: exit $EXIT_CODE
56 changes: 56 additions & 0 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Canary Test

on:
schedule:
- cron: '0 16 * * *' # Everyday 16:00 UTC

permissions: {}

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true

jobs:
canary-test:
strategy:
matrix:
include:
- os: macos-13
xcode-version: 14.3.1
device: iPhone 14 Pro
version: 16.4
- os: macos-12
xcode-version: 14.1
device: iPhone 13 Pro
version: 16.1
name: Canary Test - Xcode ${{ matrix.xcode-version }}
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
persist-credentials: false

- name: Install amplify-cli
run: npm install -g @aws-amplify/[email protected]

- name: Create Sample Amplify App
working-directory: ${{ github.workspace }}/canaries/example
run: amplify init --quickstart --frontend ios

- name: Setup Ruby
uses: ruby/setup-ruby@250fcd6a742febb1123a77a841497ccaa8b9e939 # v1.152.0
with:
ruby-version: '3.2.1'
bundler-cache: true
working-directory: ${{ github.workspace }}/canaries/example

- name: Set Default Xcode Version to ${{ matrix.xcode-version }}
run: |
sudo xcode-select -s "/Applications/Xcode_${{ matrix.xcode-version }}.app"
xcodebuild -version
- name: Run Tests - ${{ matrix.device }} with iOS ${{ matrix.version }}
working-directory: ${{ github.workspace }}/canaries/example
run: bundle exec fastlane scan --device "${{ matrix.device }}" --deployment_target_version "${{ matrix.version }}"

11 changes: 10 additions & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3

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

confirm-pass:
runs-on: ubuntu-latest
name: Confirm Passing CodeQL Scan
if: ${{ !cancelled() }}
needs: [ analyze ]
env:
EXIT_CODE: ${{ contains(needs.*.result, 'failure') && 1 || 0 }}
steps:
- run: exit $EXIT_CODE
Loading

0 comments on commit 5b95da8

Please sign in to comment.