Skip to content

Commit

Permalink
Build monorepo CI (#3747)
Browse files Browse the repository at this point in the history
## Description

CI for testing monorepo build.
  • Loading branch information
piaskowyk authored Nov 9, 2022
1 parent 0d1cf52 commit fa04a7f
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 4 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/build-monorepo-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Test build in monorepo
on:
workflow_call:
inputs:
platform:
required: true
type: string
concurrency_group:
required: true
type: string
is_hoisted:
required: true
type: boolean
react_native_version:
required: false
type: string

env:
REACT_NATIVE_TEMPLATE: ${{ inputs.react_native_version && '--version' || '' }} ${{ inputs.react_native_version }}

jobs:
build:
runs-on: ${{ inputs.platform == 'iOS' && 'macos-12' || 'ubuntu-latest' }}
concurrency:
group: ${{ inputs.concurrency_group }}
cancel-in-progress: true
steps:
- name: Create monorepo
run: |
mkdir monorepo
cd monorepo
echo '{"name":"rnos-monorepo-tester","version":"1.0.0","license":"MIT","private":true,"workspaces":{"packages":["RootApp","packages/PackageApp", "AppA", "AppB"],"nohoist":["**/react","**/react-dom","**/react-native","**/react-native/**","**/react-native-codegen","**/react-native-dev-menu"]}}' > package.json
yarn
mkdir packages
- name: Create RootApp
working-directory: monorepo
run: npx react-native@next init RootApp ${{ env.REACT_NATIVE_TEMPLATE }}
- name: Create PackageApp
working-directory: monorepo/packages
run: npx react-native@next init PackageApp ${{ env.REACT_NATIVE_TEMPLATE }}

- name: Install dependencies for RootApp
working-directory: monorepo/RootApp
run: yarn add github:software-mansion/react-native-reanimated#${{ github.ref }}
- name: Install dependencies for PackageApp
working-directory: monorepo/packages/PackageApp
run: yarn add github:software-mansion/react-native-reanimated#${{ github.ref }}

- name: Setup hoisted Reanimated
if: ${{ inputs.is_hoisted }}
working-directory: monorepo
run: yarn add github:software-mansion/react-native-reanimated#${{ github.ref }} -W

- name: Install Pods for RootApp
if: ${{ inputs.platform == 'iOS' }}
working-directory: monorepo/RootApp/ios
run: pod install
- name: Install Pods for PackageApp
if: ${{ inputs.platform == 'iOS' }}
working-directory: monorepo/packages/PackageApp/ios
run: pod install

- name: Build iOS app RootApp
if: ${{ inputs.platform == 'iOS' }}
working-directory: monorepo/RootApp
run: yarn react-native run-ios
- name: Build iOS app PackageApp
if: ${{ inputs.platform == 'iOS' }}
working-directory: monorepo/packages/PackageApp
run: yarn react-native run-ios

- name: Build Android RootApp
if: ${{ inputs.platform == 'Android' }}
working-directory: monorepo/RootApp/android
run: ./gradlew assembleDebug --console=plain
- name: Build Android PackageApp
if: ${{ inputs.platform == 'Android' }}
working-directory: monorepo/packages/PackageApp/android
run: ./gradlew assembleDebug --console=plain
44 changes: 44 additions & 0 deletions .github/workflows/build-monorepo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Test monorepo build
on:
pull_request:
paths:
- .github/workflows/build-monorepo.yml
- .github/workflows/build-monorepo-action.yml
- RNReanimated.podspec
- android/build.gradle
push:
branches:
- main

jobs:
build_android_reanimated_non_hoisted:
name: Android (non-hoisted Reanimated)
uses: ./.github/workflows/build-monorepo-action.yml
with:
platform: Android
concurrency_group: build_monorepo_android_in_app_reanimated-${{ github.ref }}
is_hoisted: false

build_ios_reanimated_non_hoisted:
name: iOS (non-hoisted Reanimated)
uses: ./.github/workflows/build-monorepo-action.yml
with:
platform: iOS
concurrency_group: build_monorepo_ios_in_app_reanimated-${{ github.ref }}
is_hoisted: false

build_android_reanimated_hoisted:
name: Android (hoisted Reanimated)
uses: ./.github/workflows/build-monorepo-action.yml
with:
platform: Android
concurrency_group: build_monorepo_android_reanimated_hoisted-${{ github.ref }}
is_hoisted: true

build_ios_reanimated_hoisted:
name: iOS (hoisted Reanimated)
uses: ./.github/workflows/build-monorepo-action.yml
with:
platform: iOS
concurrency_group: build_monorepo_ios_reanimated_hoisted-${{ github.ref }}
is_hoisted: true
4 changes: 2 additions & 2 deletions .github/workflows/build-nightly-npm-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ on:

jobs:
call-build-workflow-rea-v3:
uses: ./.github/workflows/build-npm-package.yml
uses: ./.github/workflows/build-npm-package-action.yml
with:
version: nightly
call-build-workflow-rea-v2:
uses: ./.github/workflows/build-npm-package.yml
uses: ./.github/workflows/build-npm-package-action.yml
with:
version: nightly
ref: Reanimated2
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/workflows/build-release-npm-package-rea2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

jobs:
call-build-workflow-rea-v2:
uses: ./.github/workflows/build-npm-package.yml
uses: ./.github/workflows/build-npm-package-action.yml
with:
version: release
ref: Reanimated2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-release-npm-package-rea3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ on:

jobs:
call-build-workflow-rea-v3:
uses: ./.github/workflows/build-npm-package.yml
uses: ./.github/workflows/build-npm-package-action.yml
with:
version: release

0 comments on commit fa04a7f

Please sign in to comment.