From 163dd36d565918b9ddc4f148ea6b4ab6b1e51812 Mon Sep 17 00:00:00 2001 From: Michal Sek Date: Wed, 10 Jul 2024 08:38:23 +0200 Subject: [PATCH 1/3] fix: fix CI setup --- .github/workflows/ci.yml | 247 +++++++++++++++++++-------------------- 1 file changed, 122 insertions(+), 125 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f5ec2e7..9276f45c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,17 +1,13 @@ name: CI on: - push: - branches: - - main pull_request: - branches: - - main - merge_group: - types: - - checks_requested + types: [opened] + issue_comment: + types: [created] jobs: lint: + if: github.event.issue.pull_request && contains(github.event.comment.body, '/lint') runs-on: ubuntu-latest steps: - name: Checkout @@ -27,6 +23,7 @@ jobs: run: yarn typecheck test: + if: github.event.issue.pull_request && contains(github.event.comment.body, '/test') runs-on: ubuntu-latest steps: - name: Checkout @@ -38,120 +35,120 @@ jobs: - name: Run unit tests run: yarn test --maxWorkers=2 --coverage - build-library: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup - uses: ./.github/actions/setup - - - name: Build package - run: yarn prepare - - build-android: - runs-on: ubuntu-latest - env: - TURBO_CACHE_DIR: .turbo/android - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup - uses: ./.github/actions/setup - - - name: Cache turborepo for Android - uses: actions/cache@v4 - 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@v4 - with: - distribution: 'zulu' - java-version: '17' - - - 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@v4 - with: - path: | - ~/.gradle/wrapper - ~/.gradle/caches - key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- - - - name: Build example for Android - env: - JAVA_OPTS: '-XX:MaxHeapSize=6g' - run: | - yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" - - build-ios: - runs-on: macos-14 - env: - TURBO_CACHE_DIR: .turbo/ios - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup - uses: ./.github/actions/setup - - - name: Cache turborepo for iOS - uses: actions/cache@v4 - 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@v4 - with: - path: | - **/ios/Pods - key: ${{ runner.os }}-cocoapods-${{ hashFiles('example/ios/Podfile.lock') }} - restore-keys: | - ${{ runner.os }}-cocoapods- - - - name: Install cocoapods - if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true' - run: | - cd example/ios - pod install - env: - NO_FLIPPER: 1 - - - name: Build example for iOS - run: | - yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" + # build-library: + # runs-on: ubuntu-latest + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + + # - name: Setup + # uses: ./.github/actions/setup + + # - name: Build package + # run: yarn prepare + + # build-android: + # runs-on: ubuntu-latest + # env: + # TURBO_CACHE_DIR: .turbo/android + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + + # - name: Setup + # uses: ./.github/actions/setup + + # - name: Cache turborepo for Android + # uses: actions/cache@v4 + # 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@v4 + # with: + # distribution: 'zulu' + # java-version: '17' + + # - 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@v4 + # with: + # path: | + # ~/.gradle/wrapper + # ~/.gradle/caches + # key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }} + # restore-keys: | + # ${{ runner.os }}-gradle- + + # - name: Build example for Android + # env: + # JAVA_OPTS: '-XX:MaxHeapSize=6g' + # run: | + # yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" + + # build-ios: + # runs-on: macos-14 + # env: + # TURBO_CACHE_DIR: .turbo/ios + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + + # - name: Setup + # uses: ./.github/actions/setup + + # - name: Cache turborepo for iOS + # uses: actions/cache@v4 + # 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@v4 + # with: + # path: | + # **/ios/Pods + # key: ${{ runner.os }}-cocoapods-${{ hashFiles('example/ios/Podfile.lock') }} + # restore-keys: | + # ${{ runner.os }}-cocoapods- + + # - name: Install cocoapods + # if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true' + # run: | + # cd example/ios + # pod install + # env: + # NO_FLIPPER: 1 + + # - name: Build example for iOS + # run: | + # yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" From a1a833c0f47822c647b7d852778fdf1e747e7a8a Mon Sep 17 00:00:00 2001 From: Michal Sek Date: Wed, 10 Jul 2024 08:40:42 +0200 Subject: [PATCH 2/3] fix: modify --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9276f45c..aa4a4a6a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,5 @@ name: CI on: - pull_request: - types: [opened] issue_comment: types: [created] From 07683feb8ba2495e1b32b57c9710a7331402e93a Mon Sep 17 00:00:00 2001 From: Michal Sek Date: Wed, 10 Jul 2024 08:42:26 +0200 Subject: [PATCH 3/3] fix: run normally on PR --- .github/workflows/ci.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa4a4a6a..b61f830f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,11 +1,14 @@ name: CI on: - issue_comment: - types: [created] + pull_request: + branches: + - main + merge_group: + types: + - checks_requested jobs: lint: - if: github.event.issue.pull_request && contains(github.event.comment.body, '/lint') runs-on: ubuntu-latest steps: - name: Checkout @@ -21,7 +24,6 @@ jobs: run: yarn typecheck test: - if: github.event.issue.pull_request && contains(github.event.comment.body, '/test') runs-on: ubuntu-latest steps: - name: Checkout