Skip to content

Update Build.yml

Update Build.yml #18

Workflow file for this run

name: Build and Test Amazon Connect Chat SDK for iOS
on:
push:
branches:
- main
- rajatttt/test
pull_request:
branches:
- main
- rajatttt/test
jobs:
checkout:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Debug - Print current directory
run: pwd
- name: Debug - List root directory contents
run: ls -al
setup:
runs-on: macos-latest
needs: checkout
steps:
- name: Debug - Print current directory
run: pwd
- name: Debug - List root directory contents
run: ls -al
- name: Set working directory to AmazonConnectChatIOS
run: echo "::set-output name=workdir::${{ github.workspace }}/AmazonConnectChatIOS"
- name: Debug - List AmazonConnectChatIOS directory contents
run: ls -al ${{ steps.set_working_directory.outputs.workdir }}
- name: Set up Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 'latest'
- name: Install CocoaPods
run: sudo gem install cocoapods
- name: Install Pods
working-directory: ${{ steps.set_working_directory.outputs.workdir }}
run: pod install
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Install xcpretty
run: gem install xcpretty
build:
runs-on: macos-latest
needs: setup
steps:
- name: Debug - Print current directory
run: pwd
- name: Debug - List root directory contents
run: ls -al
- name: Clean and Build SDK
working-directory: ${{ steps.set_working_directory.outputs.workdir }}
run: |
xcodebuild clean -workspace AmazonConnectChatIOS.xcworkspace \
-scheme AmazonConnectChatIOS \
-sdk iphonesimulator \
-configuration Debug \
build
test:
runs-on: macos-latest
needs: build
steps:
- name: Debug - Print current directory
run: pwd
- name: Debug - List root directory contents
run: ls -al
- name: Run Unit Tests
working-directory: ${{ steps.set_working_directory.outputs.workdir }}
run: |
xcodebuild test -workspace AmazonConnectChatIOS.xcworkspace \
-scheme AmazonConnectChatIOS \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 12,OS=latest' \
-configuration Debug \
-enableCodeCoverage YES \
2>&1 | tee raw-test-output.log | xcpretty --color --simple
TEST_RESULT=${PIPESTATUS[0]}
if [ $TEST_RESULT -ne 0 ]; then
echo "xcodebuild test failed with exit code $TEST_RESULT"
continue-on-error: true
- name: Print Test Results
if: always()
working-directory: ${{ steps.set_working_directory.outputs.workdir }}
run: cat raw-test-output.log