Skip to content

Commit

Permalink
chore: kickoff release
Browse files Browse the repository at this point in the history
  • Loading branch information
phantumcode authored Oct 4, 2023
2 parents f015e12 + 21f31d0 commit dc0ce9e
Show file tree
Hide file tree
Showing 31 changed files with 769 additions and 236 deletions.
44 changes: 44 additions & 0 deletions .github/composite_actions/run_xcodebuild/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: 'Run xcodebuild'
description: 'Action runs `xcodebuild build` for the scheme specified'

inputs:
scheme:
required: true
type: string
project_path:
required: false
type: string
xcode_path:
required: false
type: string
destination:
required: false
type: string
default: 'platform=iOS Simulator,name=iPhone 13,OS=latest'
sdk:
required: false
type: string
default: 'iphonesimulator'
other_flags:
required: false
type: string
default: ''

runs:
using: "composite"
steps:
- name: Build ${{ inputs.scheme }}
env:
SCHEME: ${{ inputs.scheme }}
PROJECT_PATH: ${{ inputs.project_path }}
XCODE_PATH: ${{ inputs.xcode_path }}
run: |
if [ ! -z "$PROJECT_PATH" ]; then
cd $PROJECT_PATH
fi
if [ ! -z "$XCODE_PATH" ]; then
sudo xcode-select -s $XCODE_PATH
fi
xcodebuild -version
xcodebuild build -scheme $SCHEME -sdk '${{ inputs.sdk }}' -destination '${{ inputs.destination }}' ${{ inputs.other_flags }} | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]}
shell: bash
66 changes: 66 additions & 0 deletions .github/composite_actions/run_xcodebuild_test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: 'Run xcodebuild test'
description: 'Action runs the test for the scheme specified'

inputs:
scheme:
required: true
type: string
project_path:
required: false
type: string
xcode_path:
required: false
type: string
destination:
required: false
type: string
default: 'platform=iOS Simulator,name=iPhone 13,OS=latest'
sdk:
required: false
type: string
default: 'iphonesimulator'
other_flags:
required: false
type: string
default: ''
generate_coverage:
required: false
type: boolean
default: false

runs:
using: "composite"
steps:
- name: Test ${{ inputs.scheme }}
env:
SCHEME: ${{ inputs.scheme }}
PROJECT_PATH: ${{ inputs.project_path }}
XCODE_PATH: ${{ inputs.xcode_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
coverageFlags=""
if [ "${{ inputs.generate_coverage }}" == "true" ]; then
echo "Code Coverage is enabled!"
coverageFlags+="-derivedDataPath Build/ -clonedSourcePackagesDirPath "~/Library/Developer/Xcode/DerivedData/$SCHEME" -enableCodeCoverage YES build test"
fi
xcode-select -p
xcodebuild -version
xcodebuild test -scheme $SCHEME -sdk '${{ inputs.sdk }}' -destination '${{ inputs.destination }}' ${{ inputs.other_flags }} $coverageFlags | xcpretty --simple --color --report junit && exit ${PIPESTATUS[0]}
shell: bash

- name: Generate Coverage report
if: ${{ inputs.generate_coverage == 'true' }}
run: |
echo "Generating Coverage report..."
cd Build/Build/ProfileData
cd $(ls -d */|head -n 1)
pathCoverage=Build/Build/ProfileData/${PWD##*/}/Coverage.profdata
cd ../../../../
xcrun llvm-cov export -format="lcov" -instr-profile $pathCoverage Build/Build/Products/Debug-iphonesimulator/$SCHEME.o > Coverage.lcov
shell: bash
45 changes: 45 additions & 0 deletions .github/workflows/build_liveness.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build | Amplify UI Swift Liveness
on:
workflow_call:
inputs:
identifier:
required: true
type: string
workflow_dispatch:
push:
branches-ignore:
- main
- release

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-ui-swift-liveness:
runs-on: macos-13
timeout-minutes: 20
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3
with:
persist-credentials: false
- name: Build Amplify Swift Liveness UI
uses: ./.github/composite_actions/run_xcodebuild
with:
scheme: AmplifyUILiveness
destination: 'platform=iOS Simulator,name=iPhone 14,OS=16.4'
xcode_path: '/Applications/Xcode_14.3.app'

confirm-pass:
runs-on: ubuntu-latest
name: Confirm Passing Build Steps
if: ${{ !cancelled() }}
needs: [ build-amplify-ui-swift-liveness ]
env:
EXIT_CODE: ${{ contains(needs.*.result, 'failure') && 1 || 0 }}
steps:
- run: exit $EXIT_CODE

24 changes: 24 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -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
75 changes: 75 additions & 0 deletions .github/workflows/deploy_liveness.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Deploy Liveness
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-amplify-ui-swift-liveness:
name: Build Amplify package
uses: ./.github/workflows/build_liveness.yml
with:
identifier: 'workflow-call-build-liveness'

unit-tests:
name: Run Unit Tests
uses: ./.github/workflows/liveness_unit_tests.yml
with:
identifier: 'workflow-call-unit-test'

fortify:
name: Run Fortify Scan
uses: ./.github/workflows/fortify_scan.yml
secrets: inherit
with:
identifier: 'workflow-call-fortify'

release:
environment: Release
name: Release new ${{ inputs.type }} version
needs: [unit-tests, fortify, build-amplify-ui-swift-liveness]
runs-on: macos-latest
env:
GITHUB_EMAIL: aws-amplify-ops@amazon.com
GITHUB_USER: aws-amplify-ops
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@8c3f20df09ac63af7b3ae3d7c91f105f857d8497 #v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
role-session-name: ${{ format('{0}.release', github.run_id) }}
aws-region: ${{ secrets.AWS_REGION }}
mask-aws-account-id: true

- 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: Release Package
run: bundle exec fastlane ${{ inputs.type }}
17 changes: 17 additions & 0 deletions .github/workflows/deploy_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Build, Test and Release | Stable version
on:
push:
branches:
release

permissions:
id-token: write
contents: write

jobs:
release-stable:
uses: ./.github/workflows/deploy_liveness.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:
main

permissions:
id-token: write
contents: write

jobs:
release-unstable:
uses: ./.github/workflows/deploy_liveness.yml
with:
type: unstable
secrets: inherit
74 changes: 74 additions & 0 deletions .github/workflows/fortify_scan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Fortify Scan
on:
workflow_dispatch:
workflow_call:
inputs:
identifier:
required: true
type: string
push:
branches-ignore:
- main
- release

permissions:
id-token: write
contents: read

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

jobs:
fortify-scan:
runs-on: macos-latest
environment: Fortify
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 #v3.5.3
with:
persist-credentials: false

- name: Configure AWS credentials for fetching fortify resources
uses: aws-actions/configure-aws-credentials@8c3f20df09ac63af7b3ae3d7c91f105f857d8497 #v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_REGION }}
role-session-name: GHAFortifySession
role-duration-seconds: 900
mask-aws-account-id: true

- 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 }} liveness_swift_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-ui-swift-liveness/Fortify --InstallSamples 0 --fortify_license_path fortify.license --MigrateSCA 0
export PATH=~/amplify-ui-swift-liveness/Fortify/bin:$PATH
fortifyupdate -acceptKey
sourceanalyzer -version
- name: Run Scan
run: |
export PATH=~/amplify-ui-swift-liveness/Fortify/bin:$PATH
sh ./liveness_swift_fortify_scan.sh Sources
confirm-pass:
runs-on: ubuntu-latest
name: Confirm Passing Fortify Scan
if: ${{ !cancelled() }}
needs: [ fortify-scan ]
env:
EXIT_CODE: ${{ contains(needs.*.result, 'failure') && 1 || 0 }}
steps:
- run: exit $EXIT_CODE
Loading

0 comments on commit dc0ce9e

Please sign in to comment.