Skip to content

Update Build.yml

Update Build.yml #23

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
outputs:
workdir: ${{ steps.set_workdir.outputs.workdir }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Debug - Print current directory
run: pwd
- name: Debug - List root directory contents
run: ls -al
- name: Set working directory
id: set_workdir
run: |
echo "workdir=${{ github.workspace }}/AmazonConnectChatIOS" >> $GITHUB_ENV
echo "::set-output name=workdir::${{ github.workspace }}/AmazonConnectChatIOS"
- name: Debug - Verify WORKDIR environment variable
run: echo ${{ steps.set_workdir.outputs.workdir }}
- name: Debug - List AmazonConnectChatIOS directory contents
run: ls -al ${{ steps.set_workdir.outputs.workdir }}
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 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: ${{ needs.checkout.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: ${{ needs.checkout.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: ${{ needs.checkout.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: ${{ needs.checkout.outputs.workdir }}
run: cat raw-test-output.log