Skip to content

Commit

Permalink
fix all ci builds using a composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
hannojg committed Oct 16, 2024
1 parent e2285d7 commit 879bd20
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 93 deletions.
22 changes: 22 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Setup
description: Install dependencies

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'
run: yarn install --immutable
shell: bash
41 changes: 14 additions & 27 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,7 +31,7 @@ jobs:
- name: Setup JDK 17
uses: actions/setup-java@v4
with:
distribution: 'zulu'
distribution: "zulu"
java-version: 17
java-package: jdk

Expand Down Expand Up @@ -78,25 +78,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 }}-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
46 changes: 12 additions & 34 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,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 }}-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 ..
- name: Setup
uses: ./.github/actions/setup

- name: Restore buildcache
uses: mikehardy/buildcache-action@v2
Expand Down Expand Up @@ -83,19 +72,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 }}-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 ..
- 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 ..

Expand Down
36 changes: 4 additions & 32 deletions .github/workflows/validate-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,8 @@ jobs:
- name: Install reviewdog
uses: reviewdog/action-setup@v1

- name: Restore node_modules from cache
uses: actions/cache@v4
id: yarn-cache
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'
run: yarn install --immutable
shell: bash
- 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

0 comments on commit 879bd20

Please sign in to comment.