diff --git a/.github/actions/build-app/action.yml b/.github/actions/build-app/action.yml deleted file mode 100644 index db349b6..0000000 --- a/.github/actions/build-app/action.yml +++ /dev/null @@ -1,142 +0,0 @@ -name: Build App -description: 'Set up your GitHub Actions workflow with a specific version of Node.js' -inputs: - new-arch-enabled: - description: 'Enable new architecture (example: 1 or 0))' - required: false - default: '1' - - rn-ver: - description: 'Version of React Native (example: 0.72.6))' - required: true - - arch: - description: 'Architecture (example: "arm64-v8a" or "x86_64,arm64-v8a") android only' - required: false - default: 'armeabi-v7a,arm64-v8a,x86,x86_64' - - module-to-install: - description: 'Module to install (example: "react-native-architectures" or "/path/to/module"))' - required: true - - store-artifacts: - description: 'Store artifacts on GitHub (example: true or false))' - required: false - default: 'true' - - ios-package-manager: - description: 'iOS dependency manager (pods or spm)' - required: false - default: 'pods' - - platform: - description: 'Platform (example: android or ios))' - required: true - - -runs: - using: 'composite' - steps: - - uses: ./.github/actions/lock-nodejs-ver - - - uses: ./.github/actions/lock-java-ver - if: ${{ inputs.platform == 'android' }} - - - uses: ./.github/actions/lock-ruby-ver - if: ${{ inputs.platform == 'ios' }} - - - name: Create tmp directory - shell: bash - id: clear_name - env: - APP_NAME: Example${{ inputs.rn-ver }}${{ inputs.new-arch-enabled }}App - run: | - input_string="${{ env.APP_NAME }}" - - # Remove "." and "-" symbols from the input string - modified_string="${input_string//./}" - modified_string="${modified_string//-/}" - - echo "folder=${modified_string}" >> $GITHUB_OUTPUT - - - name: Build ${{ inputs.platform }} (${{ inputs.arch }}) - working-directory: /tmp - shell: bash - id: app_build - env: - APP_NAME: ${{ steps.clear_name.outputs.folder }} - # iOS only - NO_FLIPPER: 1 - RCT_NEW_ARCH_ENABLED: ${{ inputs.new-arch-enabled }} - run: | - set -x # print all executed commands - - export YARN_ENABLE_IMMUTABLE_INSTALLS=false - - # Create new tmp React Native project - npx @react-native-community/cli init ${{ env.APP_NAME }} --version ${{ inputs.rn-ver }} --skip-git-init --install-pods false --pm yarn - cd ${{ env.APP_NAME }} - - # Link my module - if [ -d ".yarn" ]; then - # Yarn Berry (2+) syntax: - yarn add @react-native-community/image-editor@portal:${{ inputs.module-to-install }} - else - # Yarn1 syntax: - yarn add ${{ inputs.module-to-install }} - fi - - if [[ '${{ inputs.platform }}' == 'ios' ]]; then - # Use Xcode 16.4 for RN 0.80+; macos-15 includes its iOS 18.5 simulator runtime. - if [[ '${{ inputs.rn-ver }}' == "0.8"* || "${{ inputs.rn-ver }}" == "latest" ]]; then - sudo xcode-select --switch /Applications/Xcode_16.4.app/Contents/Developer - fi - fi - - # Debug info - npx @react-native-community/cli info - - if [[ '${{ inputs.platform }}' == 'ios' ]]; then - brew install xcbeautify - - xcodebuild_container=(-workspace "ios/${APP_NAME}.xcworkspace") - if [[ '${{ inputs.ios-package-manager }}' == 'spm' ]]; then - npx react-native spm add --deintegrate --yes - xcodebuild_container=(-project "ios/${APP_NAME}.xcodeproj") - else - # Update pods after adding new module - npx pod-install - fi - - # Build iOS App - set -o pipefail - xcodebuild -scheme "${APP_NAME}" "${xcodebuild_container[@]}" -configuration Release -sdk iphonesimulator -destination 'generic/platform=iOS Simulator' | xcbeautify --quiet - - # set output variable - echo "app_path=$(find ~/Library/Developer/Xcode/DerivedData -type d -name "${{ env.APP_NAME }}.app")" >> $GITHUB_OUTPUT - else - # Enable new arch for Android - if [[ '${{ inputs.new-arch-enabled }}' == '1' ]]; then - sed -i 's/newArchEnabled=false/newArchEnabled=true/' android/gradle.properties - fi - - # Fix: generate codegen artifacts for RN 0.80 only - if [[ '${{ inputs.rn-ver }}' == "0.80"* ]]; then - ./android/gradlew generateCodegenArtifactsFromSchema -p android - fi - - # Build Android - ./android/gradlew assembleRelease --no-daemon -p android -PreactNativeArchitectures=${{ inputs.arch }} - - # set output variable - echo "app_path=$(find $(pwd)/android -type f -name '*.apk')" >> $GITHUB_OUTPUT - fi - - - name: Store Android artifacts on GitHub - uses: actions/upload-artifact@v4 - if: ${{ inputs.store-artifacts == 'true' }} - with: - name: ${{ inputs.platform }}-${{ inputs.rn-ver }}-newArch${{ inputs.new-arch-enabled }} - if-no-files-found: error - retention-days: 14 # 2 weeks - path: ${{ steps.app_build.outputs.app_path }} diff --git a/.github/actions/lock-java-ver/action.yml b/.github/actions/lock-java-ver/action.yml deleted file mode 100644 index e4ac61a..0000000 --- a/.github/actions/lock-java-ver/action.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Setup Java -description: 'Set up your GitHub Actions workflow with a specific version of Java' -inputs: - java-version: - description: 'The Java version to set up' - required: false - default: 17 - -runs: - using: 'composite' - steps: - - name: Setup Java ${{ inputs.java-version }} - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: ${{ inputs.java-version }} diff --git a/.github/actions/lock-ruby-ver/action.yml b/.github/actions/lock-ruby-ver/action.yml deleted file mode 100644 index f16fece..0000000 --- a/.github/actions/lock-ruby-ver/action.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: Setup Ruby -description: 'Set up your GitHub Actions workflow with a specific version of Ruby' -inputs: - ruby-version: - description: 'The Ruby version to set up' - required: false - default: 3.2 - -runs: - using: 'composite' - steps: - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ inputs.ruby-version }} - bundler-cache: true diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..4ac004c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,68 @@ +name: Build + +on: + push: + branches: + - master + paths: + - '.github/workflows/build.yml' + - 'android/**' + - 'ios/**' + - 'src/**' + - '*.podspec' + - 'Package.swift' + - 'package.json' + pull_request: + types: [ opened, synchronize, reopened ] + paths: + - '.github/workflows/build.yml' + - 'android/**' + - 'ios/**' + - 'src/**' + - '*.podspec' + - 'Package.swift' + - 'package.json' + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + build-android: + name: Build Android (RN ${{ matrix.rn_ver }}) + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + rn_ver: [ latest, 0.87.1, 0.86.3 ] + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - uses: retyui/oss-react-native-build/build-app@v0 + with: + platform: android + rn-ver: ${{ matrix.rn_ver }} + android-arch: arm64-v8a + + build-ios: + name: Build iOS ${{ matrix.ios-package-manager }} (RN ${{ matrix.rn_ver }}) + runs-on: macos-15 + strategy: + fail-fast: false + matrix: + rn_ver: [ latest, 0.87.1, 0.86.3 ] + ios-package-manager: [ pods, spm ] + exclude: + - rn_ver: 0.86.3 # SPM requires RN >= 0.87 + ios-package-manager: spm + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - uses: retyui/oss-react-native-build/build-app@v0 + with: + platform: ios + rn-ver: ${{ matrix.rn_ver }} + ios-package-manager: ${{ matrix.ios-package-manager }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..b52933e --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,83 @@ +name: Lint + +on: + push: + branches: + - master + paths: + - '.github/workflows/lint.yml' + - '.github/actions/**' + - 'android/**' + - 'src/**' + - 'example/**' + - 'package.json' + - 'yarn.lock' + - '.yarnrc.yml' + - '.yarn/releases/**' + - 'babel.config.js' + - 'eslint.config.js' + - 'prettier.config.js' + - 'tsconfig*.json' + pull_request: + types: [ opened, synchronize, reopened ] + paths: + - '.github/workflows/lint.yml' + - '.github/actions/**' + - 'android/**' + - 'src/**' + - 'example/**' + - 'package.json' + - 'yarn.lock' + - '.yarnrc.yml' + - '.yarn/releases/**' + - 'babel.config.js' + - 'eslint.config.js' + - 'prettier.config.js' + - 'tsconfig*.json' + +permissions: + contents: read + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + ACTIONS_RUNNER_DEBUG: true # Enable debug logs + +jobs: + cache-node-modules: + name: Cache node_modules + runs-on: ubuntu-22.04 + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: ./.github/actions/install-dependencies + with: + lookup-only: true + + code-quality: + name: Code Quality + runs-on: ubuntu-22.04 + needs: [cache-node-modules] + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: ./.github/actions/install-dependencies + + - name: Lint Android files + run: yarn lint:android + + - name: Types check + run: yarn ts + + - name: Lib build + run: yarn build + + - name: Lint files + run: yarn lint + # required to run after `yarn build` diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index a4c65dc..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,118 +0,0 @@ -name: Main - -on: - pull_request: - branches: - - master - push: - branches: - - master - -permissions: - contents: read - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -env: - ACTIONS_RUNNER_DEBUG: true # Enable debug logs - -jobs: - cache-node-modules: - name: Cache node_modules - runs-on: ubuntu-22.04 - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - uses: ./.github/actions/install-dependencies - with: - lookup-only: true - - code-quality: - name: Code Quality - runs-on: ubuntu-22.04 - needs: [cache-node-modules] - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - uses: ./.github/actions/install-dependencies - - - name: Lint Android files - run: yarn lint:android - - - name: Types check - run: yarn ts - - - name: Lib build - run: yarn build - - - name: Lint files - run: yarn lint - # required to run after `yarn build` - - build-android: - name: Build Android - runs-on: ubuntu-22.04 - strategy: - fail-fast: false - max-parallel: 4 - matrix: - rn_ver: [ latest ] # also, can be any npm tag: 0.71-stable, next, nightly - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - uses: ./.github/actions/build-app - with: - arch: arm64-v8a - rn-ver: ${{ matrix.rn_ver }} - module-to-install: ${{ github.workspace }} - store-artifacts: true - platform: android - - build-ios-pods: - name: Build iOS (CocoaPods) - runs-on: macos-15 - strategy: - fail-fast: false - max-parallel: 3 - matrix: - rn_ver: [ latest ] # also, can be any npm tag: 0.71-stable, next, nightly - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - uses: ./.github/actions/build-app - with: - rn-ver: ${{ matrix.rn_ver }} - module-to-install: ${{ github.workspace }} - store-artifacts: true - platform: ios - - build-ios-spm: - name: Build iOS (SPM) - runs-on: macos-15 - strategy: - fail-fast: false - max-parallel: 3 - matrix: - rn_ver: [ latest ] # also, can be any npm tag: 0.71-stable, next, nightly - steps: - - name: Checkout repository - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - uses: ./.github/actions/build-app - with: - rn-ver: ${{ matrix.rn_ver }} - module-to-install: ${{ github.workspace }} - store-artifacts: false - platform: ios - ios-package-manager: spm