Add github actions script #32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: iOS CI | |
| on: [push, pull_request] | |
| env: | |
| CLOUDINARY_URL: ${{ secrets.CLOUDINARY_URL }} | |
| jobs: | |
| build: | |
| name: Xcode ${{ matrix.xcode_version }} - iOS ${{ matrix.os_version }} | |
| runs-on: macos-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - xcode_version: '16.2' | |
| ios_name: 'iPhone 16' | |
| os_version: '18.4' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Ruby (for CocoaPods) | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: 3.2 | |
| - name: Setup Xcode ${{ matrix.xcode_version }} | |
| uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: ${{ matrix.xcode_version }} | |
| - name: Install CocoaPods | |
| run: sudo gem install cocoapods | |
| - name: Install xcpretty | |
| run: sudo gem install xcpretty | |
| - name: Setup CLOUDINARY_URL | |
| run: | | |
| echo "CLOUDINARY_URL=$(bash tools/get_test_cloud.sh)" >> $GITHUB_ENV | |
| echo "cloud_name: $(echo $CLOUDINARY_URL | cut -d'@' -f2)" | |
| - name: Clean Derived Data | |
| run: rm -rf ~/Library/Developer/Xcode/DerivedData | |
| - name: Debug directory structure | |
| run: | | |
| echo "Contents of root directory:" | |
| ls -la | |
| echo "Contents of Example directory:" | |
| ls -la Example/ | |
| echo "Looking for workspace files:" | |
| find . -name "*.xcworkspace" -type d | |
| - name: List available schemes | |
| working-directory: Example | |
| run: | | |
| echo "Current directory contents:" | |
| ls -la | |
| echo "Available schemes:" | |
| if [ -d "Cloudinary.xcworkspace" ]; then | |
| xcodebuild -workspace Cloudinary.xcworkspace -list | |
| else | |
| echo "Cloudinary.xcworkspace not found, trying alternative paths..." | |
| find . -name "*.xcworkspace" -type d | |
| fi | |
| - name: Install Pods | |
| working-directory: Example | |
| run: pod install | |
| - name: Check Cloudinary_Tests scheme destinations | |
| working-directory: Example | |
| run: | | |
| echo "Checking destinations for Cloudinary_Tests scheme:" | |
| xcodebuild -workspace Cloudinary.xcworkspace -scheme Cloudinary_Tests -showdestinations | |
| - name: Build for Testing | |
| run: | | |
| xcodebuild build-for-testing \ | |
| -workspace Example/Cloudinary.xcworkspace \ | |
| -scheme Cloudinary_Tests \ | |
| -destination "platform=iOS Simulator,name=${{ matrix.ios_name }}" \ | |
| CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | xcpretty | |
| - name: Run Tests | |
| run: | | |
| xcodebuild test-without-building \ | |
| -workspace Example/Cloudinary.xcworkspace \ | |
| -scheme Cloudinary_Tests \ | |
| -destination "platform=iOS Simulator,name=${{ matrix.ios_name }}" \ | |
| CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO | xcpretty | |
| - name: Notify on Failure | |
| if: failure() | |
| run: echo "Notify [email protected] of failure" |