Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: setup yarn monorepo #3246

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Setup
description: Install dependencies

inputs:
working-directory:
description: "The working directory to run the setup script in"
required: false
default: "."

runs:
using: composite
steps:
- name: Cache dependencies
id: yarn-cache
uses: actions/cache@v4
with:
path: |
**/node_modules
.yarn/install-state.gz
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
restore-keys: |
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
${{ runner.os }}-yarn-

- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
# A composite action is always run from the root of the project, no matter the default working directory
# We need to explicitly cd into the package dir, so that it will use yarn 3:
run: cd ./package && yarn install --immutable
shell: bash
59 changes: 17 additions & 42 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ on:
branches:
- main
paths:
- '.github/workflows/build-android.yml'
- 'package/android/**'
- 'package/example/android/**'
- 'package/yarn.lock'
- 'package/example/yarn.lock'
- ".github/workflows/build-android.yml"
- "package/android/**"
- "package/example/android/**"
- "package/yarn.lock"
- "package/example/yarn.lock"
pull_request:
paths:
- '.github/workflows/build-android.yml'
- 'package/android/**'
- 'package/example/android/**'
- 'package/yarn.lock'
- 'package/example/yarn.lock'
- ".github/workflows/build-android.yml"
- "package/android/**"
- "package/example/android/**"
- "package/yarn.lock"
- "package/example/yarn.lock"

jobs:
build:
Expand All @@ -31,25 +31,12 @@ jobs:
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
distribution: "zulu"
java-version: 17
java-package: jdk

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Restore node_modules from cache
uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-with-fps-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-with-fps-yarn-
- name: Install node_modules
run: yarn install --frozen-lockfile
- name: Install node_modules for example/
run: yarn install --frozen-lockfile --cwd example
- name: Setup
uses: ./.github/actions/setup

- name: Restore Gradle cache
uses: actions/cache@v4
Expand Down Expand Up @@ -78,25 +65,13 @@ jobs:
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
distribution: "zulu"
java-version: 17
java-package: jdk

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Restore node_modules from cache
uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-without-fps-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-without-fps-yarn-
- name: Install node_modules
run: yarn install --frozen-lockfile
- name: Install node_modules for example/
run: yarn install --frozen-lockfile --cwd example
- name: Setup
uses: ./.github/actions/setup

- name: Remove worklets, skia and reanimated
run: yarn remove react-native-worklets-core @shopify/react-native-skia react-native-reanimated --cwd example

Expand Down
51 changes: 18 additions & 33 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ on:
branches:
- main
paths:
- '.github/workflows/build-ios.yml'
- 'package/ios/**'
- 'package/*.podspec'
- 'package/example/ios/**'
- ".github/workflows/build-ios.yml"
- "package/ios/**"
- "package/*.podspec"
- "package/example/ios/**"
pull_request:
paths:
- '.github/workflows/build-ios.yml'
- 'package/ios/**'
- 'package/*.podspec'
- 'package/example/ios/**'
- ".github/workflows/build-ios.yml"
- "package/ios/**"
- "package/*.podspec"
- "package/example/ios/**"

jobs:
build:
Expand All @@ -26,19 +26,10 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Restore node_modules from cache
uses: actions/cache@v4
id: yarn-cache
- name: Setup
uses: ./.github/actions/setup
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-with-fps-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-with-fps-yarn-
- name: Install node_modules for example/
run: yarn install --frozen-lockfile --cwd ..
working-directory: ./package

- name: Restore buildcache
uses: mikehardy/buildcache-action@v2
Expand Down Expand Up @@ -83,21 +74,15 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Restore node_modules from cache
uses: actions/cache@v4
id: yarn-cache
- name: Setup
uses: ./.github/actions/setup
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-without-fps-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-without-fps-yarn-
- name: Install node_modules for example/
run: yarn install --frozen-lockfile --cwd ..
working-directory: ./package

- name: Remove worklets, skia and reanimated
run: yarn remove react-native-worklets-core @shopify/react-native-skia react-native-reanimated --cwd ..
run: |
yarn remove react-native-worklets-core @shopify/react-native-skia react-native-reanimated --cwd ..
yarn remove react-native-worklets-core @shopify/react-native-skia react-native-reanimated --cwd ../..

- name: Restore buildcache
uses: mikehardy/buildcache-action@v2
Expand Down
76 changes: 24 additions & 52 deletions .github/workflows/validate-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,28 @@ on:
branches:
- main
paths:
- '.github/workflows/validate-js.yml'
- 'package/src/**'
- 'package/*.json'
- 'package/*.js'
- 'package/*.lock'
- 'package/example/src/**'
- 'package/example/*.json'
- 'package/example/*.js'
- 'package/example/*.lock'
- 'package/example/*.tsx'
- ".github/workflows/validate-js.yml"
- "package/src/**"
- "package/*.json"
- "package/*.js"
- "package/*.lock"
- "package/example/src/**"
- "package/example/*.json"
- "package/example/*.js"
- "package/example/*.lock"
- "package/example/*.tsx"
pull_request:
paths:
- '.github/workflows/validate-js.yml'
- 'package/src/**'
- 'package/*.json'
- 'package/*.js'
- 'package/*.lock'
- 'package/example/src/**'
- 'package/example/*.json'
- 'package/example/*.js'
- 'package/example/*.lock'
- 'package/example/*.tsx'
- ".github/workflows/validate-js.yml"
- "package/src/**"
- "package/*.json"
- "package/*.js"
- "package/*.lock"
- "package/example/src/**"
- "package/example/*.json"
- "package/example/*.js"
- "package/example/*.lock"
- "package/example/*.tsx"

jobs:
compile:
Expand All @@ -41,22 +41,8 @@ jobs:
- name: Install reviewdog
uses: reviewdog/action-setup@v1

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Restore node_modules from cache
uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install node_modules
run: yarn install --frozen-lockfile
- name: Install node_modules (example/)
run: yarn install --frozen-lockfile --cwd example
- name: Setup
uses: ./.github/actions/setup

- name: Run TypeScript # Reviewdog tsc errorformat: %f:%l:%c - error TS%n: %m
run: |
Expand All @@ -79,22 +65,8 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Restore node_modules from cache
uses: actions/cache@v4
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-

- name: Install node_modules
run: yarn install --frozen-lockfile
- name: Install node_modules (example/)
run: yarn install --frozen-lockfile --cwd example
- name: Setup
uses: ./.github/actions/setup

- name: Run ESLint
run: yarn lint -f @jamesacarr/github-actions
Expand Down
Loading
Loading