ci.yml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. name: CI
  2. on:
  3. push:
  4. branches:
  5. - main
  6. pull_request:
  7. branches:
  8. - main
  9. jobs:
  10. lint:
  11. runs-on: ubuntu-latest
  12. steps:
  13. - name: Checkout
  14. uses: actions/checkout@v3
  15. - name: Setup
  16. uses: ./.github/actions/setup
  17. - name: Lint files
  18. run: yarn lint
  19. - name: Typecheck files
  20. run: yarn typecheck
  21. test:
  22. runs-on: ubuntu-latest
  23. steps:
  24. - name: Checkout
  25. uses: actions/checkout@v3
  26. - name: Setup
  27. uses: ./.github/actions/setup
  28. - name: Run unit tests
  29. run: yarn test --maxWorkers=2 --coverage
  30. build-library:
  31. runs-on: ubuntu-latest
  32. steps:
  33. - name: Checkout
  34. uses: actions/checkout@v3
  35. - name: Setup
  36. uses: ./.github/actions/setup
  37. - name: Build package
  38. run: yarn prepare
  39. build-android:
  40. runs-on: ubuntu-latest
  41. env:
  42. TURBO_CACHE_DIR: .turbo/android
  43. steps:
  44. - name: Checkout
  45. uses: actions/checkout@v3
  46. - name: Setup
  47. uses: ./.github/actions/setup
  48. - name: Cache turborepo for Android
  49. uses: actions/cache@v3
  50. with:
  51. path: ${{ env.TURBO_CACHE_DIR }}
  52. key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }}
  53. restore-keys: |
  54. ${{ runner.os }}-turborepo-android-
  55. - name: Check turborepo cache for Android
  56. run: |
  57. 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")
  58. if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
  59. echo "turbo_cache_hit=1" >> $GITHUB_ENV
  60. fi
  61. - name: Install JDK
  62. if: env.turbo_cache_hit != 1
  63. uses: actions/setup-java@v3
  64. with:
  65. distribution: 'zulu'
  66. java-version: '17'
  67. - name: Finalize Android SDK
  68. if: env.turbo_cache_hit != 1
  69. run: |
  70. /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
  71. - name: Cache Gradle
  72. if: env.turbo_cache_hit != 1
  73. uses: actions/cache@v3
  74. with:
  75. path: |
  76. ~/.gradle/wrapper
  77. ~/.gradle/caches
  78. key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }}
  79. restore-keys: |
  80. ${{ runner.os }}-gradle-
  81. - name: Build example for Android
  82. env:
  83. JAVA_OPTS: "-XX:MaxHeapSize=6g"
  84. run: |
  85. yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}"
  86. build-ios:
  87. runs-on: macos-14
  88. env:
  89. TURBO_CACHE_DIR: .turbo/ios
  90. steps:
  91. - name: Checkout
  92. uses: actions/checkout@v3
  93. - name: Setup
  94. uses: ./.github/actions/setup
  95. - name: Cache turborepo for iOS
  96. uses: actions/cache@v3
  97. with:
  98. path: ${{ env.TURBO_CACHE_DIR }}
  99. key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }}
  100. restore-keys: |
  101. ${{ runner.os }}-turborepo-ios-
  102. - name: Check turborepo cache for iOS
  103. run: |
  104. 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")
  105. if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
  106. echo "turbo_cache_hit=1" >> $GITHUB_ENV
  107. fi
  108. - name: Cache cocoapods
  109. if: env.turbo_cache_hit != 1
  110. id: cocoapods-cache
  111. uses: actions/cache@v3
  112. with:
  113. path: |
  114. **/ios/Pods
  115. key: ${{ runner.os }}-cocoapods-${{ hashFiles('example/ios/Podfile.lock') }}
  116. restore-keys: |
  117. ${{ runner.os }}-cocoapods-
  118. - name: Install cocoapods
  119. if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
  120. run: |
  121. cd example/ios
  122. pod install
  123. env:
  124. NO_FLIPPER: 1
  125. - name: Build example for iOS
  126. run: |
  127. yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}"