Fix workflows #228
Workflow file for this run
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: "Contentstack CI" | |
| on: | |
| push: | |
| branches: [ master, staging ] | |
| pull_request: | |
| branches: [ master, staging ] | |
| jobs: | |
| macOS: | |
| name: Test macOS | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Configure Git credentials | |
| run: | | |
| git config --global url."https://x-access-token:${{ secrets.PKG_TOKEN }}@github.com/".insteadOf "https://github.com/" | |
| - name: Set up Ruby (for installing Bundler and Fastlane) | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.0' | |
| - name: Install dep via Carthage | |
| run: | | |
| carthage bootstrap --platform macOS --use-xcframeworks --cache-builds | |
| - name: Install dependencies via Swift Package Manager | |
| run: swift package resolve | |
| - name: Set up Xcode | |
| uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: '15.4.0' | |
| - name: Create config file | |
| run: | | |
| echo '{ | |
| "api_key": "${{ secrets.api_key }}", | |
| "delivery_token": "${{ secrets.delivery_token }}", | |
| "environment": "${{ secrets.environment }}" | |
| }' > Tests/config.json | |
| - name: Build and run tests | |
| run: | | |
| xcodebuild test \ | |
| -workspace ContentstackSwift.xcworkspace \ | |
| -scheme "Contentstack macOS Tests" \ | |
| -destination 'platform=macOS,arch=arm64' \ | |
| ONLY_ACTIVE_ARCH=NO \ | |
| CODE_SIGNING_ALLOWED=NO | |
| iOS: | |
| name: Test iOS | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| - name: Configure Git credentials | |
| run: | | |
| git config --global url."https://x-access-token:${{ secrets.PKG_TOKEN }}@github.com/".insteadOf "https://github.com/" | |
| - name: Set up Ruby (for installing Bundler and Fastlane) | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.0' | |
| - name: Install dep via Carthage | |
| run: | | |
| carthage bootstrap --platform iOS --use-xcframeworks --cache-builds | |
| - name: Install dependencies via Swift Package Manager | |
| run: swift package resolve | |
| - name: Set up Xcode | |
| uses: maxim-lobanov/setup-xcode@v1 | |
| with: | |
| xcode-version: '15.4.0' | |
| - name: Create config file | |
| run: | | |
| echo '{ | |
| "api_key": "${{ secrets.api_key }}", | |
| "delivery_token": "${{ secrets.delivery_token }}", | |
| "environment": "${{ secrets.environment }}" | |
| }' > Tests/config.json | |
| - name: Find available iOS simulator | |
| id: find-simulator | |
| run: | | |
| # Find a booted or available iPhone simulator (e.g., iPhone 14) | |
| DEVICE=$(xcrun simctl list devices available | grep -m1 'iPhone' | awk -F '[()]' '{print $2}') | |
| RUNTIME=$(xcrun simctl list devices available | grep "$DEVICE" | awk -F '[()]' '{print $4}') | |
| echo "device=$DEVICE" >> $GITHUB_OUTPUT | |
| echo "runtime=$RUNTIME" >> $GITHUB_OUTPUT | |
| - name: Build and run tests | |
| run: | | |
| xcodebuild test \ | |
| -workspace ContentstackSwift.xcworkspace \ | |
| -scheme "Contentstack iOS Tests" \ | |
| -destination "id=${{ steps.find-simulator.outputs.device }}" \ | |
| -sdk iphonesimulator \ | |
| ONLY_ACTIVE_ARCH=NO \ | |
| CODE_SIGNING_ALLOWED=NO |