Skip to content

Commit

Permalink
Merge 73373d0 into 41c3b5b
Browse files Browse the repository at this point in the history
  • Loading branch information
takameyer committed Feb 6, 2024
2 parents 41c3b5b + 73373d0 commit 4f01d8a
Show file tree
Hide file tree
Showing 27 changed files with 405 additions and 725 deletions.
175 changes: 76 additions & 99 deletions .github/workflows/pr-realm-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,45 @@ concurrency:
cancel-in-progress: true

jobs:
bundle:
name: Bundle TypeScript
generate-jsi:
name: Generate JSI
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Setup node version
uses: actions/setup-node@v3
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: Generate JSI
run: |
npm run bindgen:generate:jsi --workspace realm
# 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@v3
with:
name: realm-js-jsi
path: |
README.md
packages/realm/binding/jsi/jsi_init.cpp
generate-ts:
name: Generate TS Bundle
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
Expand All @@ -44,17 +73,17 @@ jobs:
- name: Upload dist artifacts
uses: actions/upload-artifact@v3
with:
name: realm-js-bundles
name: realm-js-ts
path: |
README.md
packages/*/dist
build:
name: Build for ${{ matrix.variant.os }} ${{ matrix.variant.arch }}
runs-on: ${{ matrix.variant.runner }}
needs: [generate-ts]
env:
REALM_DISABLE_ANALYTICS: 1
NDK_VERSION: 25.1.8937393
strategy:
fail-fast: false
matrix:
Expand All @@ -64,23 +93,16 @@ jobs:
- { os: linux, runner: ubuntu-latest, arch: arm64, artifact-path: packages/realm/prebuilds }
- { os: windows, runner: windows-latest, arch: x64, artifact-path: packages/realm/prebuilds, test-node: true, test-electron: true }
- { os: windows, runner: windows-2019, arch: ia32, artifact-path: packages/realm/prebuilds }
- { os: android, runner: ubuntu-latest, arch: x86_64, artifact-path: packages/realm/react-native/android/src/main/jniLibs }
- { os: android, runner: ubuntu-latest, arch: armeabi-v7a, artifact-path: packages/realm/react-native/android/src/main/jniLibs }
- { os: android, runner: ubuntu-latest, arch: arm64-v8a, artifact-path: packages/realm/react-native/android/src/main/jniLibs }
- { os: android, runner: ubuntu-latest, arch: x86, artifact-path: packages/realm/react-native/android/src/main/jniLibs }
- { os: darwin, runner: macos-latest, arch: x64, artifact-path: packages/realm/prebuilds, test-node: true, test-electron: true }
- { os: darwin, runner: macos-latest, arch: arm64, artifact-path: packages/realm/prebuilds, test-node: true, test-electron: true }
- { os: ios, runner: macos-latest-xlarge, arch: simulator, artifact-path: packages/realm/react-native/ios/realm-js-ios.xcframework }
- { os: ios, runner: macos-latest-xlarge, arch: catalyst, artifact-path: packages/realm/react-native/ios/realm-js-ios.xcframework }
- { os: ios, runner: macos-latest-xlarge, arch: ios, artifact-path: packages/realm/react-native/ios/realm-js-ios.xcframework }
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: "recursive"

- name: Setup node version
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
Expand All @@ -92,13 +114,18 @@ jobs:

- name: Restore NPM cache
id: npm-cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Download TS Bundle
uses: actions/download-artifact@v3
with:
name: realm-js-ts

- name: Setup Wireit cache
uses: google/wireit@setup-github-actions-caching/v1

Expand All @@ -113,20 +140,6 @@ jobs:
if: ${{ (matrix.variant.runner == 'ubuntu-latest') }}
run: sudo apt-get install ccache ninja-build

- name: Setup Java
if: ${{ matrix.variant.os == 'android' }}
uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '11'

- name: Setup Android SDK
if: ${{ matrix.variant.os == 'android' }}
uses: android-actions/setup-android@v2

- name: Install NDK
if: ${{ matrix.variant.os == 'android' }}
run: sdkmanager --install "ndk;${{ env.NDK_VERSION }}"

# The ccache installed by github doesn't want to be moved around. Let the ccache action download a new one.
- name: Remove pre-installed ccache
Expand Down Expand Up @@ -187,21 +200,6 @@ jobs:
if: ${{ (matrix.variant.os != 'ios') && (matrix.variant.os != 'android') }}
run: npm run build:node:prebuild:${{matrix.variant.arch}} --workspace realm

# build the c++ library for IOS
# the Info.plist needs to be regenerated with all libraries in place
- name: Build iOS
if: ${{ (matrix.variant.os == 'ios') }}
run: |
npm run build:ios --workspace realm
rm -vf ${{ matrix.variant.artifact-path }}/Info.plist
env:
PLATFORMS: ${{ matrix.variant.arch }}

# build the c++ library for Android
- name: Build Android
if: ${{ (matrix.variant.os == 'android') }}
run: npm run build:android --workspace realm -- --arch=${{matrix.variant.arch}}

# 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 prebuild artifact
Expand All @@ -212,49 +210,22 @@ jobs:
README.md
${{ matrix.variant.artifact-path }}
ios-xcframework:
name: Generate Info.plist with all frameworks in place
needs: [build]
if: ${{ success() || failure() }}
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: "recursive"

- name: Download prebuilds
uses: actions/download-artifact@v3
with:
name: realm-js-prebuilds

- name: Regenerate Info.plist
run: scripts/regen-info-plist.sh packages/realm/react-native/ios/realm-js-ios.xcframework

# 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 prebuild artifact
uses: actions/upload-artifact@v3
with:
name: realm-js-prebuilds
path: |
README.md
packages/realm/react-native/ios/realm-js-ios.xcframework/Info.plist
integration-tests:
name: Test ${{ matrix.variant.environment }} on ${{ matrix.variant.os }} (${{matrix.variant.target}})
needs: [bundle, build, ios-xcframework]
needs: [generate-jsi, generate-ts, build]
if: ${{ success() || failure() }}
env:
REALM_DISABLE_ANALYTICS: 1
NDK_VERSION: 25.1.8937393
JAVA_VERSION: 17
MOCHA_REMOTE_TIMEOUT: 60000
LONG_TIMEOUT: 300000 # 5 minutes
MOCHA_REMOTE_REPORTER: mocha-github-actions-reporter
MOCHA_REMOTE_EXIT_ON_ERROR: true
SPAWN_LOGCAT: true
BAAS_BRANCH: master
# Pin the Xcode version
DEVELOPER_DIR: /Applications/Xcode_14.3.1.app
DEVELOPER_DIR: /Applications/Xcode_14.2.app
IOS_DEVICE_NAME: iPhone 14
runs-on: ${{ matrix.variant.runner }}
strategy:
Expand All @@ -264,9 +235,9 @@ jobs:
- { os: linux, target: "test:ci", runner: ubuntu-latest, environment: node }
- { os: linux, target: "test:ci:main", runner: ubuntu-latest, environment: electron }
- { os: linux, target: "test:ci:renderer", runner: ubuntu-latest, environment: electron }
#- { os: windows, target: "test:ci", runner: windows-latest, environment: node}
#- { os: windows, target: "test:ci:main", runner: windows-latest, environment: electron }
#- { os: windows, target: "test:ci:renderer", runner: windows-latest, environment: electron }
# - { os: windows, target: "test:ci", runner: windows-latest, environment: node}
# - { os: windows, target: "test:ci:main", runner: windows-latest, environment: electron }
# - { os: windows, target: "test:ci:renderer", runner: windows-latest, environment: electron }
- { os: darwin, target: "test:ci:main", runner: macos-latest, environment: electron }
- { os: darwin, target: "test:ci:renderer", runner: macos-latest, environment: electron }
- { os: darwin, target: "test:ci", runner: macos-latest, environment: node }
Expand All @@ -276,12 +247,12 @@ jobs:
timeout-minutes: 60
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: "recursive"

- name: Setup node version
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
Expand All @@ -293,7 +264,7 @@ jobs:

- name: Restore NPM cache
id: npm-cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
Expand All @@ -303,14 +274,20 @@ jobs:
- name: Restore Wireit cache
uses: google/wireit@setup-github-actions-caching/v1

- name: Restore React Native cache
if: ${{ matrix.variant.environment == 'react-native' }}
uses: actions/cache@v3
- name: Setup Java
if: ${{ matrix.variant.os == 'android' }}
uses: actions/setup-java@v3
with:
path: '**/Pods'
key: ${{ runner.os }}-${{matrix.variant.environment}}-${{ hashFiles('**/Podfile.lock', './src/**', './vendor/**') }}
restore-keys: |
${{ runner.os }}-${{matrix.variant.environment}}-
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '${{env.JAVA_VERSION }}'

- name: Setup Android SDK
if: ${{ matrix.variant.os == 'android' }}
uses: android-actions/setup-android@v2

- name: Install NDK
if: ${{ matrix.variant.os == 'android' }}
run: sdkmanager --install "ndk;${{ env.NDK_VERSION }}"

- name: MSVC Setup
if: ${{ runner.os == 'Windows' }}
Expand Down Expand Up @@ -340,10 +317,16 @@ jobs:
sudo apt-get install xvfb
echo "wrapper=xvfb-run" >> $GITHUB_ENV
- name: Download bundles
- name: Download JSI
uses: actions/download-artifact@v3
if: ${{ matrix.variant.environment == 'react-native' }}
with:
name: realm-js-bundles
name: realm-js-jsi

- name: Download TS Bundle
uses: actions/download-artifact@v3
with:
name: realm-js-ts

- name: Download prebuilds
uses: actions/download-artifact@v3
Expand Down Expand Up @@ -394,7 +377,7 @@ jobs:

- name: Setup Java Gradle cache for android test app
if: ${{ (matrix.variant.os == 'android') }}
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
Expand All @@ -405,20 +388,14 @@ jobs:
- name: Setup Android Emulator cache
if: ${{ (matrix.variant.os == 'android') }}
uses: actions/cache@v3
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-29

- uses: actions/setup-java@v3
if: ${{ (matrix.variant.os == 'android') }}
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '17'

- name: Run ${{matrix.variant.target}} (${{ matrix.variant.os}} / ${{ matrix.variant.environment }})
if: ${{ (matrix.variant.os == 'android') }}
env:
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,25 @@ jobs:
github_token: ${{ secrets.REALM_CI_PAT }}
name: realm-js-prebuilds

- name: Download bundle artifacts from PR
- name: Download ts bundle artifacts from PR
uses: dawidd6/action-download-artifact@d0f291cf39bd21965ea9c4c6e210fc355c3844ed
with:
workflow: pr-realm-js.yml
commit: ${{ inputs.commit || github.sha }}
path: ${{ github.workspace }}
workflow_conclusion: "" # Ignores workflow conclusion
github_token: ${{ secrets.REALM_CI_PAT }}
name: realm-js-bundles
name: realm-js-ts

- name: Download jsi artifacts from PR
uses: dawidd6/action-download-artifact@d0f291cf39bd21965ea9c4c6e210fc355c3844ed
with:
workflow: pr-realm-js.yml
commit: ${{ inputs.commit || github.sha }}
path: ${{ github.workspace }}
workflow_conclusion: "" # Ignores workflow conclusion
github_token: ${{ secrets.REALM_CI_PAT }}
name: realm-js-jsi

- name: Read version
id: get-version
Expand Down
11 changes: 3 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ yarn.lock
/android
/packages/realm/react-native/android/src/main/jni/core
/packages/realm/react-native/android/.cxx/
/packages/realm/build-android/
.idea
.gradle
local.properties
Expand Down Expand Up @@ -96,15 +95,9 @@ coverage/
**/imported-apps/
**/realm-config

#Ignore symlinked directories (otherwise on Windows they are shown as untracked files)
/react-native/android/src/main/jni/vendor/
/react-native/android/src/main/jni/src/
/build-tmp*/
/cmakebuild/
/react-native/android/src/main/java/io/realm/react/Version.java
/react-native/android/src/main/jniLibs/
/realm*.tgz
/react-native/ios/realm-js-ios.xcframework/

# Ignore template package-lock.json files
/templates/*/package-lock.json
Expand All @@ -113,13 +106,15 @@ coverage/
# Generated artifacts
/packages/realm/bindgen/vendor/bindgen-lib/generated/
/packages/realm/generated/
/packages/realm/binding/jsi/jsi_init.cpp

# Build artifacts
/packages/realm/dist/
/packages/realm/prebuilds/
/packages/realm/react-native/android/src/main/java/io/realm/react/Version.java
/packages/realm/react-native/android/src/main/jniLibs/
/packages/realm/react-native/ios/realm-js-ios.xcframework/
/packages/realm/react-native/ios/lib/
/packages/realm/react-native/ios/input-files.xcfilelist

# Wireit repo caches
.wireit
Expand Down

0 comments on commit 4f01d8a

Please sign in to comment.