Skip to content

Commit

Permalink
refactor wireit cache and optimize workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
takameyer committed Feb 1, 2024
1 parent 4b5ca0f commit 9fed8d8
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 58 deletions.
47 changes: 32 additions & 15 deletions .github/workflows/pr-realm-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ concurrency:
cancel-in-progress: true

jobs:
generate-shared-artifacts:
generate-jsi:
name: Generate Shared Artifacts
runs-on: ubuntu-latest
steps:
Expand All @@ -37,8 +37,6 @@ jobs:
- name: Install dependencies
# Ignoring scripts to prevent a prebuilt from getting fetched / built
run: npm ci --ignore-scripts
- name: Bundle all packages
run: npm run bundle
- name: Generate JSI
run: |
npm run bindgen:generate:jsi --workspace realm
Expand All @@ -47,16 +45,42 @@ jobs:
- name: Upload dist artifacts
uses: actions/upload-artifact@v4
with:
name: realm-js-shared
name: realm-js-ts
path: |
README.md
packages/*/dist
generate-ts:
name: Generate Shared Artifacts
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Setup node version
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install dependencies
# Ignoring scripts to prevent a prebuilt from getting fetched / built
run: npm ci --ignore-scripts
- name: Bundle all packages
run: npm run bundle
# Due to a limitation in upload-artifact a redundant file is needed to force
# preserving paths (https://github.com/actions/upload-artifact/issues/174)
- name: Upload dist artifacts
uses: actions/upload-artifact@v4
with:
name: realm-js-jsi
path: |
README.md
packages/realm/binding/jsi/jsi_init.cpp
build:
name: Build for ${{ matrix.variant.os }} ${{ matrix.variant.arch }}
runs-on: ${{ matrix.variant.runner }}
needs: [generate-shared-artifacts]
env:
REALM_DISABLE_ANALYTICS: 1
strategy:
Expand Down Expand Up @@ -182,7 +206,7 @@ jobs:
integration-tests:
name: Test ${{ matrix.variant.environment }} on ${{ matrix.variant.os }} (${{matrix.variant.target}})
needs: [generate-shared-artifacts, build]
needs: [generate-jsi, generate-ts, build]
if: ${{ success() || failure() }}
env:
REALM_DISABLE_ANALYTICS: 1
Expand Down Expand Up @@ -241,15 +265,8 @@ jobs:
restore-keys: |
${{ runner.os }}-node-
# - name: Restore Wireit cache
# uses: takameyer/wireit@wireit-caching-gha

# - name: Restore React Native cache
# if: ${{ matrix.variant.os == 'ios' }}
# uses: actions/cache@v3
# with:
# path: '**/Pods'
# key: ${{ runner.os }}-${{matrix.variant.environment}}-${{ hashFiles('**/Podfile.lock', './packages/realm/binding/src/**', './packages/realm/bindgen/vendor/**', './packages/realm/RealmJS.podspec', './packages/realm/scripts/*') }}
- name: Restore Wireit cache
uses: takameyer/wireit@wireit-caching-gha

- name: Setup Java
if: ${{ matrix.variant.os == 'android' }}
Expand Down
53 changes: 10 additions & 43 deletions integration-tests/environments/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,51 +29,18 @@
"test": {
"command": "npm run test:android && npm run test:ios"
},
"pod-install:simulator": {
"pod-install": {
"command": "pod-install || (cd ios && bundle install && bundle exec pod install)",
"clean": "if-file-deleted",
"files": [
"ios/Podfile"
"ios/Podfile",
"../../../packages/realm/RealmJS.podspec",
"../../../packages/realm/scripts/*"
],
"output": [
"ios/Pods",
"ios/Podfile.lock"
],
"env": {
"USE_HERMES": {
"external": true
},
"RCT_NEW_ARCH_ENABLED": {
"external": true
}
}
},
"pod-install:catalyst": {
"command": "pod-install || (cd ios && bundle install && bundle exec pod install)",
"files": [
"ios/Podfile"
],
"output": [
"ios/Pods",
"ios/Podfile.lock"
],
"env": {
"USE_HERMES": {
"external": true
},
"RCT_NEW_ARCH_ENABLED": {
"external": true
}
}
},
"pod-install:ci": {
"command": "pod-install || (cd ios && bundle install && bundle exec pod install)",
"files": [
"ios/Podfile"
],
"output": [
"ios/Pods",
"ios/Podfile.lock"
"ios/Podfile.lock",
"../../../packages/realm/react-native/ios/input-files.xcfilelist",
"../../../packages/realm/react-native/ios/lib/*.a"
],
"env": {
"USE_HERMES": {
Expand Down Expand Up @@ -109,7 +76,7 @@
"command": "npm run common",
"dependencies": [
"../../../packages/realm:bindgen:generate:jsi",
"pod-install:simulator",
"pod-install",
"../../../packages/realm:bundle",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
Expand All @@ -123,7 +90,7 @@
"command": "npm run common",
"dependencies": [
"../../../packages/realm:bindgen:generate:jsi",
"pod-install:catalyst",
"pod-install",
"../../../packages/realm:bundle",
"../../../packages/mocha-reporter:bundle",
"../../../packages/realm-network-transport:bundle"
Expand All @@ -142,7 +109,7 @@
"test:ci:ios": {
"command": "npm run common:ci",
"dependencies": [
"pod-install:ci"
"pod-install"
],
"env": {
"PLATFORM": "ios"
Expand Down

0 comments on commit 9fed8d8

Please sign in to comment.