From ef3873653c31373623516cd2e49de8d7f317545f Mon Sep 17 00:00:00 2001 From: Satyajit Sahoo Date: Mon, 4 Sep 2023 05:17:55 +0200 Subject: [PATCH] chore: remove turborepo --- .github/workflows/build-templates.yml | 46 +++++---------- .../common/$.github/workflows/ci.yml | 56 ++----------------- .../templates/native-common/turbo.json | 36 ------------ 3 files changed, 17 insertions(+), 121 deletions(-) delete mode 100644 packages/create-react-native-library/templates/native-common/turbo.json diff --git a/.github/workflows/build-templates.yml b/.github/workflows/build-templates.yml index 38f4957f5..18466ceb7 100644 --- a/.github/workflows/build-templates.yml +++ b/.github/workflows/build-templates.yml @@ -80,11 +80,16 @@ jobs: type: module-new language: cpp + - os: ubuntu + image: reactnativecommunity/react-native-android + - os: macos + image: macos-latest + concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.os }}-${{ matrix.type }}-${{ matrix.language }} cancel-in-progress: true - runs-on: ${{ matrix.os }}-latest + runs-on: ${{ matrix.image }} steps: - name: Checkout @@ -151,31 +156,6 @@ jobs: fi fi - - name: Cache turborepo - if: env.android_build == 1 || env.ios_build == 1 - uses: actions/cache@v3 - with: - path: | - ${{ env.work_dir }}/.turbo - key: ${{ runner.os }}-library-turborepo-${{ matrix.type }}-${{ matrix.language }}-${{ hashFiles(format('{0}/**/yarn.lock', env.work_dir)) }} - restore-keys: | - ${{ runner.os }}-library-turborepo-${{ matrix.type }}-${{ matrix.language }}- - - - name: Check turborepo cache - if: env.android_build == 1 || env.ios_build == 1 - working-directory: ${{ env.work_dir }} - run: | - TURBO_CACHE_STATUS_ANDROID=$(node -p "($(yarn turbo run build:android --cache-dir=".turbo" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status") - TURBO_CACHE_STATUS_IOS=$(node -p "($(yarn turbo run build:ios --cache-dir=".turbo" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status") - - if [[ $TURBO_CACHE_STATUS_ANDROID == "HIT" ]]; then - echo "turbo_cache_hit_android=1" >> $GITHUB_ENV - fi - - if [[ $TURBO_CACHE_STATUS_IOS == "HIT" ]]; then - echo "turbo_cache_hit_ios=1" >> $GITHUB_ENV - fi - - name: Lint library working-directory: ${{ env.work_dir }} run: | @@ -203,19 +183,19 @@ jobs: yarn example expo export:web - name: Install JDK - if: env.android_build == 1 && env.turbo_cache_hit_android != 1 + if: env.android_build == 1 uses: actions/setup-java@v3 with: distribution: 'zulu' java-version: '11' - name: Finalize Android SDK - if: env.android_build == 1 && env.turbo_cache_hit_android != 1 + if: env.android_build == 1 run: | /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null" - name: Cache Gradle - if: env.android_build == 1 && env.turbo_cache_hit_android != 1 + if: env.android_build == 1 uses: actions/cache@v3 with: path: | @@ -229,10 +209,10 @@ jobs: if: env.android_build == 1 working-directory: ${{ env.work_dir }} run: | - yarn turbo run build:android --cache-dir=".turbo" + yarn example build:android - name: Cache cocoapods - if: env.ios_build == 1 && env.turbo_cache_hit_ios != 1 + if: env.ios_build == 1 id: library-cocoapods-cache uses: actions/cache@v3 with: @@ -245,7 +225,7 @@ jobs: ${{ runner.os }}-library-cocoapods- - name: Install cocoapods - if: env.ios_build == 1 && env.turbo_cache_hit_ios != 1 && steps.library-cocoapods-cache.outputs.cache-hit != 'true' + if: env.ios_build == 1 && steps.library-cocoapods-cache.outputs.cache-hit != 'true' working-directory: ${{ env.work_dir }} run: | yarn example pods @@ -256,4 +236,4 @@ jobs: if: env.ios_build == 1 working-directory: ${{ env.work_dir }} run: | - yarn turbo run build:ios --cache-dir=".turbo" + yarn example build:ios diff --git a/packages/create-react-native-library/templates/common/$.github/workflows/ci.yml b/packages/create-react-native-library/templates/common/$.github/workflows/ci.yml index dfee6120d..b2f6e362e 100644 --- a/packages/create-react-native-library/templates/common/$.github/workflows/ci.yml +++ b/packages/create-react-native-library/templates/common/$.github/workflows/ci.yml @@ -49,9 +49,7 @@ jobs: <% if (project.native) { -%> build-android: - runs-on: ubuntu-latest - env: - TURBO_CACHE_DIR: .turbo/android + runs-on: reactnativecommunity/react-native-android steps: - name: Checkout uses: actions/checkout@v3 @@ -59,36 +57,7 @@ jobs: - name: Setup uses: ./.github/actions/setup - - name: Cache turborepo for Android - uses: actions/cache@v3 - with: - path: ${{ env.TURBO_CACHE_DIR }} - key: ${{ runner.os }}-turborepo-android-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-turborepo-android- - - - name: Check turborepo cache for Android - run: | - TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status") - - if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then - echo "turbo_cache_hit=1" >> $GITHUB_ENV - fi - - - name: Install JDK - if: env.turbo_cache_hit != 1 - uses: actions/setup-java@v3 - with: - distribution: 'zulu' - java-version: '11' - - - name: Finalize Android SDK - if: env.turbo_cache_hit != 1 - run: | - /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null" - - name: Cache Gradle - if: env.turbo_cache_hit != 1 uses: actions/cache@v3 with: path: | @@ -100,7 +69,7 @@ jobs: - name: Build example for Android run: | - yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" + yarn example build:android build-ios: runs-on: macos-latest @@ -113,24 +82,7 @@ jobs: - name: Setup uses: ./.github/actions/setup - - name: Cache turborepo for iOS - uses: actions/cache@v3 - with: - path: ${{ env.TURBO_CACHE_DIR }} - key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-turborepo-ios- - - - name: Check turborepo cache for iOS - run: | - TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status") - - if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then - echo "turbo_cache_hit=1" >> $GITHUB_ENV - fi - - name: Cache cocoapods - if: env.turbo_cache_hit != 1 id: cocoapods-cache uses: actions/cache@v3 with: @@ -141,7 +93,7 @@ jobs: ${{ runner.os }}-cocoapods- - name: Install cocoapods - if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true' + if: steps.cocoapods-cache.outputs.cache-hit != 'true' run: | yarn example pods env: @@ -149,7 +101,7 @@ jobs: - name: Build example for iOS run: | - yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" + yarn example build:ios <% } else { -%> build-web: runs-on: ubuntu-latest diff --git a/packages/create-react-native-library/templates/native-common/turbo.json b/packages/create-react-native-library/templates/native-common/turbo.json deleted file mode 100644 index 385880056..000000000 --- a/packages/create-react-native-library/templates/native-common/turbo.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "$schema": "https://turbo.build/schema.json", - "pipeline": { -<% if (example === 'native') { -%> - "build:android": { - "inputs": [ - "package.json", - "android", - "!android/build", - "src/*.ts", - "src/*.tsx", - "example/package.json", - "example/android", - "!example/android/.gradle", - "!example/android/build", - "!example/android/app/build" - ], - "outputs": [] - }, - "build:ios": { - "inputs": [ - "package.json", - "*.podspec", - "ios", - "src/*.ts", - "src/*.tsx", - "example/package.json", - "example/ios", - "!example/ios/build", - "!example/ios/Pods" - ], - "outputs": [] - } -<% } -%> - } -}