Skip to content

Commit 879bd20

Browse files
committed
fix all ci builds using a composite action
1 parent e2285d7 commit 879bd20

File tree

4 files changed

+52
-93
lines changed

4 files changed

+52
-93
lines changed

.github/actions/setup/action.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Setup
2+
description: Install dependencies
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Cache dependencies
8+
id: yarn-cache
9+
uses: actions/cache@v4
10+
with:
11+
path: |
12+
**/node_modules
13+
.yarn/install-state.gz
14+
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
15+
restore-keys: |
16+
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
17+
${{ runner.os }}-yarn-
18+
19+
- name: Install dependencies
20+
if: steps.yarn-cache.outputs.cache-hit != 'true'
21+
run: yarn install --immutable
22+
shell: bash

.github/workflows/build-android.yml

Lines changed: 14 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ on:
55
branches:
66
- main
77
paths:
8-
- '.github/workflows/build-android.yml'
9-
- 'package/android/**'
10-
- 'package/example/android/**'
11-
- 'package/yarn.lock'
12-
- 'package/example/yarn.lock'
8+
- ".github/workflows/build-android.yml"
9+
- "package/android/**"
10+
- "package/example/android/**"
11+
- "package/yarn.lock"
12+
- "package/example/yarn.lock"
1313
pull_request:
1414
paths:
15-
- '.github/workflows/build-android.yml'
16-
- 'package/android/**'
17-
- 'package/example/android/**'
18-
- 'package/yarn.lock'
19-
- 'package/example/yarn.lock'
15+
- ".github/workflows/build-android.yml"
16+
- "package/android/**"
17+
- "package/example/android/**"
18+
- "package/yarn.lock"
19+
- "package/example/yarn.lock"
2020

2121
jobs:
2222
build:
@@ -31,7 +31,7 @@ jobs:
3131
- name: Setup JDK 17
3232
uses: actions/setup-java@v4
3333
with:
34-
distribution: 'zulu'
34+
distribution: "zulu"
3535
java-version: 17
3636
java-package: jdk
3737

@@ -78,25 +78,12 @@ jobs:
7878
- name: Setup JDK 17
7979
uses: actions/setup-java@v4
8080
with:
81-
distribution: 'zulu'
81+
distribution: "zulu"
8282
java-version: 17
8383
java-package: jdk
8484

85-
- name: Get yarn cache directory path
86-
id: yarn-cache-dir-path
87-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
88-
- name: Restore node_modules from cache
89-
uses: actions/cache@v4
90-
id: yarn-cache
91-
with:
92-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
93-
key: ${{ runner.os }}-without-fps-yarn-${{ hashFiles('**/yarn.lock') }}
94-
restore-keys: |
95-
${{ runner.os }}-without-fps-yarn-
96-
- name: Install node_modules
97-
run: yarn install --frozen-lockfile
98-
- name: Install node_modules for example/
99-
run: yarn install --frozen-lockfile --cwd example
85+
- name: Setup
86+
uses: ./.github/actions/setup
10087
- name: Remove worklets, skia and reanimated
10188
run: yarn remove react-native-worklets-core @shopify/react-native-skia react-native-reanimated --cwd example
10289

.github/workflows/build-ios.yml

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ on:
55
branches:
66
- main
77
paths:
8-
- '.github/workflows/build-ios.yml'
9-
- 'package/ios/**'
10-
- 'package/*.podspec'
11-
- 'package/example/ios/**'
8+
- ".github/workflows/build-ios.yml"
9+
- "package/ios/**"
10+
- "package/*.podspec"
11+
- "package/example/ios/**"
1212
pull_request:
1313
paths:
14-
- '.github/workflows/build-ios.yml'
15-
- 'package/ios/**'
16-
- 'package/*.podspec'
17-
- 'package/example/ios/**'
14+
- ".github/workflows/build-ios.yml"
15+
- "package/ios/**"
16+
- "package/*.podspec"
17+
- "package/example/ios/**"
1818

1919
jobs:
2020
build:
@@ -26,19 +26,8 @@ jobs:
2626
steps:
2727
- uses: actions/checkout@v4
2828

29-
- name: Get yarn cache directory path
30-
id: yarn-cache-dir-path
31-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
32-
- name: Restore node_modules from cache
33-
uses: actions/cache@v4
34-
id: yarn-cache
35-
with:
36-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
37-
key: ${{ runner.os }}-with-fps-yarn-${{ hashFiles('**/yarn.lock') }}
38-
restore-keys: |
39-
${{ runner.os }}-with-fps-yarn-
40-
- name: Install node_modules for example/
41-
run: yarn install --frozen-lockfile --cwd ..
29+
- name: Setup
30+
uses: ./.github/actions/setup
4231

4332
- name: Restore buildcache
4433
uses: mikehardy/buildcache-action@v2
@@ -83,19 +72,8 @@ jobs:
8372
steps:
8473
- uses: actions/checkout@v4
8574

86-
- name: Get yarn cache directory path
87-
id: yarn-cache-dir-path
88-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
89-
- name: Restore node_modules from cache
90-
uses: actions/cache@v4
91-
id: yarn-cache
92-
with:
93-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
94-
key: ${{ runner.os }}-without-fps-yarn-${{ hashFiles('**/yarn.lock') }}
95-
restore-keys: |
96-
${{ runner.os }}-without-fps-yarn-
97-
- name: Install node_modules for example/
98-
run: yarn install --frozen-lockfile --cwd ..
75+
- name: Setup
76+
uses: ./.github/actions/setup
9977
- name: Remove worklets, skia and reanimated
10078
run: yarn remove react-native-worklets-core @shopify/react-native-skia react-native-reanimated --cwd ..
10179

.github/workflows/validate-js.yml

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,8 @@ jobs:
4141
- name: Install reviewdog
4242
uses: reviewdog/action-setup@v1
4343

44-
- name: Restore node_modules from cache
45-
uses: actions/cache@v4
46-
id: yarn-cache
47-
with:
48-
path: |
49-
**/node_modules
50-
.yarn/install-state.gz
51-
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
52-
restore-keys: |
53-
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
54-
${{ runner.os }}-yarn-
55-
56-
- name: Install dependencies
57-
if: steps.yarn-cache.outputs.cache-hit != 'true'
58-
run: yarn install --immutable
59-
shell: bash
44+
- name: Setup
45+
uses: ./.github/actions/setup
6046

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

82-
- name: Get yarn cache directory path
83-
id: yarn-cache-dir-path
84-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
85-
- name: Restore node_modules from cache
86-
uses: actions/cache@v4
87-
id: yarn-cache
88-
with:
89-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
90-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
91-
restore-keys: |
92-
${{ runner.os }}-yarn-
93-
94-
- name: Install node_modules
95-
run: yarn install --frozen-lockfile
96-
- name: Install node_modules (example/)
97-
run: yarn install --frozen-lockfile --cwd example
68+
- name: Setup
69+
uses: ./.github/actions/setup
9870

9971
- name: Run ESLint
10072
run: yarn lint -f @jamesacarr/github-actions

0 commit comments

Comments
 (0)