Skip to content

Commit

Permalink
Monorepo [0/?] - move move github actions to root (#5993)
Browse files Browse the repository at this point in the history
## About

This pull request is a part of the effort of migrating to monorepo
structure:
- #5992

## Summary

Moving `.github` directory to the root of the project, alongside with
fixes that regard new repository structures.

This pull request won't fix CIs which are being tackled in
- #5996 

## Test plan

No CI should fail on a step related to the change of the monorepo
structure.

## Steps achieved towards monorepo

- [ ] All CI pass
- [ ] Precommit scripts work properly
- [ ] react-native-reanimated is a separate workspace which uses hoisted
node_modules
- [ ] app is a separate workspace which uses hoisted node_modules
- [ ] paper example is a separate workspace which uses hoisted
node_modules
- [ ] fabric example is a separate workspace which uses hoisted
node_modules
- [ ] web example is a separate workspace which uses hoisted
node_modules
- [ ] macos example is a separate workspace which uses hoisted
node_modules
- [ ] example is a separate workspace which uses hoisted node_modules
- [ ] reanimated eslint plugin is a separate workspace which uses
hoisted node_modules
- [ ] the npm package builds and works as expected
- [ ] reanimated2 directory is removed
- [ ] TypeScript, ESLint and Prettier configs are unified and only
extended when necessary in workspaces
  • Loading branch information
tjzel committed Jun 5, 2024
1 parent d5a4fa9 commit 04171e3
Show file tree
Hide file tree
Showing 46 changed files with 393 additions and 357 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ on:
pull_request:
paths:
- .github/workflows/android-build.yml
- android/**
- Common/**
- Example/package.json
- Example/android/**
- FabricExample/package.json
- FabricExample/android/**
- packages/react-native-reanimated/android/**
- packages/react-native-reanimated/Common/**
- packages/react-native-reanimated/Example/package.json
- packages/react-native-reanimated/Example/android/**
- packages/react-native-reanimated/FabricExample/package.json
- packages/react-native-reanimated/FabricExample/android/**
merge_group:
branches:
- main
Expand All @@ -19,20 +19,24 @@ on:
- main
paths:
- .github/workflows/android-build.yml
- android/**
- Common/**
- Example/package.json
- Example/android/**
- FabricExample/package.json
- FabricExample/android/**
- packages/react-native-reanimated/android/**
- packages/react-native-reanimated/Common/**
- packages/react-native-reanimated/Example/package.json
- packages/react-native-reanimated/Example/android/**
- packages/react-native-reanimated/FabricExample/package.json
- packages/react-native-reanimated/FabricExample/android/**

jobs:
build:
if: github.repository == 'software-mansion/react-native-reanimated'
runs-on: ubuntu-latest
strategy:
matrix:
working-directory: [Example, FabricExample]
working-directory:
[
packages/react-native-reanimated/Example,
packages/react-native-reanimated/FabricExample,
]
fail-fast: false
concurrency:
group: android-${{ matrix.working-directory }}-${{ github.ref }}
Expand All @@ -41,20 +45,24 @@ jobs:
- name: Check out Git repository
uses: actions/checkout@v4

- name: Install dependencies in root
run: yarn install --immutable

- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
distribution: "zulu"
java-version: 17

- name: Restore Reanimated node_modules from cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.os }}-android-node-modules-reanimated-${{ hashFiles('yarn.lock') }}
path: packages/react-native-reanimated/node_modules
key: ${{ runner.os }}-android-node-modules-reanimated-${{ hashFiles('packages/react-native-reanimated/yarn.lock') }}
restore-keys: ${{ runner.os }}-android-node-modules-reanimated-

- name: Install Reanimated node_modules
working-directory: packages/react-native-reanimated
run: yarn install --immutable

- name: Restore app node_modules from cache
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
name: Test monorepo build
env:
YARN_ENABLE_HARDENED_MODE: 0
on:
pull_request:
paths:
- .github/workflows/build-monorepo.yml
- .github/workflows/build-monorepo-action.yml
- RNReanimated.podspec
- scripts/reanimated_utils.rb
- android/build.gradle
- packages/react-native-reanimated/scripts/reanimated_utils.rb
- packages/react-native-reanimated/android/build.gradle
merge_group:
branches:
- main
Expand All @@ -18,9 +16,9 @@ on:
paths:
- .github/workflows/build-monorepo.yml
- .github/workflows/build-monorepo-action.yml
- RNReanimated.podspec
- scripts/reanimated_utils.rb
- android/build.gradle
- packages/react-native-reanimated/RNReanimated.podspec
- packages/react-native-reanimated/scripts/reanimated_utils.rb
- packages/react-native-reanimated/android/build.gradle
workflow_call:

jobs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ on:
pull_request:
paths:
- .github/workflows/build-next-example.yml
- 'src/**'
- 'NextExample/**'
- "packages/react-native-reanimated/src/**"
- "packages/react-native-reanimated/NextExample/**"
push:
branches:
- master
- main

jobs:
check:
Expand All @@ -20,21 +20,23 @@ jobs:
steps:
- name: Checkout Git repository
uses: actions/checkout@v4

- name: Install Reanimated node_modules
- name: Install monorepo node dependencies
run: yarn install --immutable

- name: Build package
- name: Install Reanimated node dependencies
working-directory: packages/react-native-reanimated
run: yarn install --immutable
- name: Build Reanimated package
working-directory: packages/react-native-reanimated
run: yarn build

- name: Install NextExample node_modules
working-directory: NextExample
working-directory: packages/react-native-reanimated/NextExample
run: yarn install --immutable

- name: Compile production build
working-directory: NextExample
working-directory: packages/react-native-reanimated/NextExample
run: yarn build

- name: Run e2e tests
working-directory: NextExample
working-directory: packages/react-native-reanimated/NextExample
run: yarn e2e:headless
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@ on:
ref:
required: false
type: string
upload_binaries:
required: false
type: boolean
publish_on_npm:
required: false
type: boolean
secrets:
NODE_AUTH_TOKEN:
required: false
workflow_dispatch:
inputs:
option:
required: false
type: string
ref:
required: false
type: string

jobs:
build:
Expand All @@ -36,72 +41,41 @@ jobs:
node-version: 20
registry-url: https://registry.npmjs.org/
- name: Clear annotations
run: scripts/clear-annotations.sh

- name: Set up JDK 11
if: ${{ inputs.ref == 'Reanimated2' }}
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'

- name: Install NDK
if: ${{ inputs.ref == 'Reanimated2' }}
uses: nttld/setup-ndk@v1
id: setup-ndk
with:
ndk-version: r21d
run: .github/workflows/helper/clear-annotations.sh

- name: Build package
working-directory: packages/react-native-reanimated
id: build
env:
ANDROID_NDK: ${{ steps.setup-ndk.outputs.ndk-path }}
run: >-
./createNPMPackage.sh ${{ inputs.option }} 2> build.log
./createNPMPackage.sh ${{ inputs.option }}
- name: Check if any node_modules were packed
working-directory: packages/react-native-reanimated
id: node_modules
run: >-
! grep --silent -E "node_modules/.+"
- name: Check if size is over 1MB
if: ${{ inputs.ref != 'Reanimated2' }}
id: size
run: grep --silent -E "npm notice package size:\s*[0-9][0-9]?[0-9]?(\.[0-9]*)?\s*kB" build.log
! grep --silent -E "node_modules/.+" build.log
- name: Show build log
working-directory: packages/react-native-reanimated
if: failure() && steps.build.outcome == 'failure'
run: >-
cat build.log
- name: Show packed node_modules
working-directory: packages/react-native-reanimated
if: failure() && steps.node_modules.outcome == 'failure'
run: >-
! grep -E "node_modules/.+"
! grep -E "node_modules/.+" build.log
- name: Show exceeded package size
if: failure() && steps.size.outcome == 'failure'
run: grep -E "npm notice package size:" build.log

- run: echo "PACKAGE_NAME=$(ls -l | egrep -o "react-native-reanimated-(.*)(=?\.tgz)")" >> $GITHUB_ENV
- name: Add package name to env
working-directory: packages/react-native-reanimated
run: echo "PACKAGE_NAME=$(ls -l | egrep -o "react-native-reanimated-(.*)(=?\.tgz)")" >> $GITHUB_ENV

- name: Upload npm package
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}
path: '*.tgz'

- name: Compress Android build output
if: ${{ inputs.upload_binaries }}
run: zip -r android-build-output.zip build_output

- name: Upload Android build folder
if: ${{ inputs.upload_binaries }}
uses: actions/upload-artifact@v4
with:
name: android-build-output
path: android-build-output.zip
retention-days: 5
path: "packages/react-native-reanimated/${{ env.PACKAGE_NAME }}"

- run: npm publish $PACKAGE_NAME --tag nightly
if: ${{ inputs.publish_on_npm }}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
paths:
- .github/workflows/check-TS-react-native.yml
schedule:
- cron: '37 19 * * *'
- cron: "37 19 * * *"
workflow_dispatch:

jobs:
Expand All @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
react-native-version: ['0.71', '0.72', '0.73', '0.74.0-rc.6', nightly]
react-native-version: ["0.71", "0.72", "0.73", "0.74", nightly]
fail-fast: false
concurrency:
group: TS-react-native-nightly-${{ matrix.react-native-version }}-${{ github.ref }}
Expand All @@ -26,23 +26,35 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v4
with:
cache: 'yarn'
cache: "yarn"
- name: Clear annotations
run: scripts/clear-annotations.sh
- name: Install dependencies
run: .github/workflows/helper/clear-annotations.sh

- name: Install monorepo node dependencies
run: yarn install
- name: Install Reanimated node dependencies
working-directory: packages/react-native-reanimated
run: yarn install
- name: Build repo
- name: Build Reanimated node dependencies
working-directory: packages/react-native-reanimated
run: yarn build
- name: Install react-native ${{ matrix.react-native-version }}
working-directory: packages/react-native-reanimated
run: yarn add --dev react-native@${{ matrix.react-native-version }}

- name: Check source types
working-directory: packages/react-native-reanimated
run: yarn type:check:src
- name: Check plugin types
working-directory: packages/react-native-reanimated
run: yarn type:check:plugin
- name: Check API
working-directory: packages/react-native-reanimated
run: yarn type:check:app
- name: Run common type tests
working-directory: packages/react-native-reanimated
run: yarn type:check:tests:common
- name: Run 0.72+ type tests
working-directory: packages/react-native-reanimated
if: matrix.react-native-version != '0.71'
run: yarn type:check:tests:0.72+
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: Check React Native nightly build
env:
YARN_ENABLE_HARDENED_MODE: 0
on:
pull_request:
paths:
- .github/workflows/check-react-native-nightly.yml
schedule:
- cron: '37 19 * * *'
- cron: "37 19 * * *"
workflow_dispatch:

jobs:
Expand All @@ -15,17 +13,20 @@ jobs:
runs-on: macos-14
strategy:
matrix:
react-native-architecture: ['Paper', 'Fabric']
react-native-architecture: ["Paper", "Fabric"]
fail-fast: false
concurrency:
group: ios-react-native-nightly-${{ matrix.react-native-architecture }}-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Create app
run: npx react-native init app --skip-install --version nightly
- name: Download Reanimated from commit
working-directory: app
run: curl -LJO https://codeload.github.com/software-mansion/react-native-reanimated/tar.gz/${{ github.sha }}
- name: Install Reanimated
working-directory: app
run: yarn add github:software-mansion/react-native-reanimated
run: yarn add react-native-reanimated@file:./react-native-reanimated-${{ github.sha }}.tar.gz
- name: Install Paper Pods
if: ${{ matrix.react-native-architecture == 'Paper' }}
working-directory: app/ios
Expand All @@ -43,7 +44,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
react-native-architecture: ['Paper', 'Fabric']
react-native-architecture: ["Paper", "Fabric"]
fail-fast: false
concurrency:
group: android-react-native-nightly-${{ matrix.react-native-architecture }}-${{ github.ref }}
Expand All @@ -52,13 +53,16 @@ jobs:
- name: Set up JDK 18
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '18'
distribution: "zulu"
java-version: "18"
- name: Create app
run: npx react-native init app --skip-install --version nightly
- name: Download Reanimated from commit
working-directory: app
run: curl -LJO https://codeload.github.com/software-mansion/react-native-reanimated/tar.gz/${{ github.sha }}
- name: Install Reanimated
working-directory: app
run: yarn add github:software-mansion/react-native-reanimated
run: yarn add react-native-reanimated@file:./react-native-reanimated-${{ github.sha }}.tar.gz
- name: Setup Fabric
if: ${{ matrix.react-native-architecture == 'Fabric' }}
working-directory: app/android
Expand Down
Loading

0 comments on commit 04171e3

Please sign in to comment.