diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index df39930d..84225d66 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,5 @@ name: CI + on: [push, pull_request] concurrency: @@ -13,48 +14,63 @@ jobs: - uses: actions/setup-node@v4.0.3 with: node-version: 18.x - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - uses: actions/cache@v4 - id: yarn-cache + + # Cache Yarn dependencies + - name: Cache Yarn dependencies + uses: actions/cache@v4 with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + path: ${{ github.workspace }}/node_modules key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- - - name: Run test + + # Install dependencies and run lint + - name: Install dependencies and run lint run: | yarn yarn lint - build-ios: - runs-on: macos-latest + sed -i '' 's/"newArchEnabled": true/"newArchEnabled": false/g' path/to/your/file.json +build-ios-old-arch: + runs-on: macos-latest steps: # Checkout the code - name: Checkout the code uses: actions/checkout@v4 - # Set up Node.js environment + # Disable new architecture in app config + - name: Disable New Architecture in JSON + working-directory: apps/external-display-example + run: | + sed -i '' 's/"newArchEnabled": true/"newArchEnabled": false/g' app.json + + # Set up Node.js - name: Set up Node.js uses: actions/setup-node@v4.0.3 with: node-version: 18.x - # Cache Yarn dependencies to speed up the build - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v4 - id: yarn-cache + # Cache Yarn dependencies + - name: Cache Yarn dependencies + uses: actions/cache@v4 with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + path: ${{ github.workspace }}/node_modules key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- + # Cache CocoaPods dependencies + - name: Cache CocoaPods + uses: actions/cache@v4 + with: + path: | + apps/external-display-example/ios/Pods + apps/external-display-example/ios/Podfile.lock + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: | + ${{ runner.os }}-pods- + # Install dependencies - name: Install dependencies run: yarn @@ -62,13 +78,83 @@ jobs: # Prebuild the iOS folder for Expo - name: Prebuild iOS with Expo working-directory: apps/external-display-example + run: yarn expo prebuild --platform ios + + # Install xcpretty for better build output + - name: Install xcpretty + run: gem install xcpretty + + # Cache Xcode derived data + - name: Cache Xcode Derived Data + uses: actions/cache@v4 + with: + path: apps/external-display-example/ios/build + key: build-${{ github.sha }} + + # Build the iOS app using Xcode (with xcpretty) + - name: Build iOS App (Debug) with xcpretty + working-directory: apps/external-display-example/ios run: | - yarn expo prebuild --platform ios + set -o pipefail && xcodebuild \ + -workspace externaldisplayexample.xcworkspace \ + -scheme externaldisplayexample \ + -configuration Debug \ + -sdk iphonesimulator \ + -derivedDataPath build | xcpretty + + build-ios-new-arch: + runs-on: macos-latest + steps: + # Checkout the code + - name: Checkout the code + uses: actions/checkout@v4 + + # Set up Node.js + - name: Set up Node.js + uses: actions/setup-node@v4.0.3 + with: + node-version: 18.x + + # Cache Yarn dependencies + - name: Cache Yarn dependencies + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/node_modules + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + # Cache CocoaPods dependencies + - name: Cache CocoaPods + uses: actions/cache@v4 + with: + path: | + apps/external-display-example/ios/Pods + apps/external-display-example/ios/Podfile.lock + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} + restore-keys: | + ${{ runner.os }}-pods- + + # Install dependencies + - name: Install dependencies + run: yarn + + # Prebuild the iOS folder for Expo + - name: Prebuild iOS with Expo + working-directory: apps/external-display-example + run: yarn expo prebuild --platform ios # Install xcpretty for better build output - name: Install xcpretty run: gem install xcpretty + # Cache Xcode derived data + - name: Cache Xcode Derived Data + uses: actions/cache@v4 + with: + path: apps/external-display-example/ios/build + key: build-${{ github.sha }} + # Build the iOS app using Xcode (with xcpretty) - name: Build iOS App (Debug) with xcpretty working-directory: apps/external-display-example/ios @@ -80,15 +166,20 @@ jobs: -sdk iphonesimulator \ -derivedDataPath build | xcpretty - build-android: + build-android-old-arch: runs-on: ubuntu-latest - steps: # Checkout the code - name: Checkout the code uses: actions/checkout@v4 + + # Disable new architecture in app config + - name: Disable New Architecture in JSON + working-directory: apps/external-display-example + run: | + sed -i '' 's/"newArchEnabled": true/"newArchEnabled": false/g' app.json - # Set up Node.js environment + # Set up Node.js - name: Set up Node.js uses: actions/setup-node@v4.0.3 with: @@ -101,19 +192,81 @@ jobs: distribution: 'temurin' java-version: '17' - # Cache Yarn dependencies to speed up the build - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" + # Cache Yarn dependencies + - name: Cache Yarn dependencies + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/node_modules + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- - - uses: actions/cache@v4 - id: yarn-cache + # Cache Gradle dependencies + - name: Cache Gradle + uses: actions/cache@v4 with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + gradle-${{ runner.os }}- + + # Install dependencies + - name: Install dependencies + run: yarn + + # Prebuild the Android folder for Expo + - name: Prebuild Android with Expo + working-directory: apps/external-display-example + run: yarn expo prebuild --platform android + + # Build the APK using Gradle (without running on a device) + - name: Build Android APK + working-directory: apps/external-display-example/android + run: ./gradlew assembleDebug + + + build-android-new-arch: + runs-on: ubuntu-latest + steps: + # Checkout the code + - name: Checkout the code + uses: actions/checkout@v4 + + # Set up Node.js + - name: Set up Node.js + uses: actions/setup-node@v4.0.3 + with: + node-version: 18.x + + # Install Java 17 + - name: Set up Java 17 + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '17' + + # Cache Yarn dependencies + - name: Cache Yarn dependencies + uses: actions/cache@v4 + with: + path: ${{ github.workspace }}/node_modules key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- + # Cache Gradle dependencies + - name: Cache Gradle + uses: actions/cache@v4 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + gradle-${{ runner.os }}- + # Install dependencies - name: Install dependencies run: yarn @@ -121,10 +274,9 @@ jobs: # Prebuild the Android folder for Expo - name: Prebuild Android with Expo working-directory: apps/external-display-example - run: | - yarn expo prebuild --platform android + run: yarn expo prebuild --platform android - # Build the APK without running on a device + # Build the APK using Gradle (without running on a device) - name: Build Android APK working-directory: apps/external-display-example/android run: ./gradlew assembleDebug