Skip to content

Update Build.yml

Update Build.yml #20

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
id: set_workdir
run: echo "WORKDIR=${{ github.workspace }}/AmazonConnectChatIOS" >> $GITHUB_ENV
- name: Debug - Verify WORKDIR environment variable
run: echo ${{ env.WORKDIR }}
- name: Debug - List AmazonConnectChatIOS directory contents
run: ls -al ${{ env.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: ${{ env.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: ${{ env.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: ${{ env.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: ${{ env.WORKDIR }}
run: cat raw-test-output.log