Skip to content

Commit

Permalink
fixing SWIG
Browse files Browse the repository at this point in the history
  • Loading branch information
nhachicha committed Feb 20, 2024
1 parent e373c8c commit f389090
Showing 1 changed file with 33 additions and 56 deletions.
89 changes: 33 additions & 56 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ jobs:
- name: Build JNI Stub
working-directory: ./packages
run: ./gradlew -i :jni-swig-stub:assemble -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=false
run: ./gradlew :jni-swig-stub:assemble -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=false

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: jni-stub-${{ needs.check-cache.outputs.version-label }}
path: ./packages/jni-swig-stub/build/generated/sources/**/*
path: ./packages/jni-swig-stub/build/generated/sources/jni/*
retention-days: 1

build-jvm-linux-native-lib:
Expand Down Expand Up @@ -122,7 +122,7 @@ jobs:
uses: actions/download-artifact@v3
with:
name: jni-stub-${{ needs.check-cache.outputs.version-label }}
path: ./packages/jni-swig-stub/build/generated/sources
path: ./packages/jni-swig-stub/build/generated/sources/jni

- name: Build Docker image
uses: docker/build-push-action@v3
Expand Down Expand Up @@ -195,7 +195,7 @@ jobs:
uses: actions/download-artifact@v3
with:
name: jni-stub-${{ needs.check-cache.outputs.version-label }}
path: ${{ github.workspace }}/packages/jni-swig-stub/build/generated/sources
path: ${{ github.workspace }}/packages/jni-swig-stub/build/generated/sources/jni

- name: Build native lib
shell: powershell
Expand Down Expand Up @@ -296,7 +296,7 @@ jobs:
uses: actions/download-artifact@v3
with:
name: jni-stub-${{ needs.check-cache.outputs.version-label }}
path: ${{ github.workspace }}/packages/jni-swig-stub/build/generated/sources
path: ${{ github.workspace }}/packages/jni-swig-stub/build/generated/sources/jni

- name: Build packages
working-directory: packages
Expand All @@ -311,7 +311,7 @@ jobs:

build-kotlin-metadata-package:
runs-on: ubuntu-latest
needs: [check-cache, build-jni-swig-stub]
needs: [check-cache]
if: |
always() &&
!cancelled() &&
Expand Down Expand Up @@ -375,15 +375,9 @@ jobs:
path: ./packages/build/m2-buildrepo
key: packages-m2-metadata-${{ needs.check-cache.outputs.packages-sha }}

- name: Restore JNI Swig Stubs
uses: actions/download-artifact@v3
with:
name: jni-stub-${{ needs.check-cache.outputs.version-label }}
path: ./packages/jni-swig-stub/build/generated/sources

- name: Build Kotlin Metadata and Gradle and Compiler Plugin
working-directory: packages
run: ./gradlew -x :jni-swig-stub:realmWrapperJvm publishCIPackages -Prealm.kotlin.targets=gradlePlugin,compilerPlugin -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=true
run: ./gradlew publishCIPackages -Prealm.kotlin.targets=gradlePlugin,compilerPlugin -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=true

- name: Upload artifacts
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -438,13 +432,6 @@ jobs:
key: 'jvm-package'
max-size: '2.0G'

- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master

- name: Install tree command
run: brew install tree

- name: Prepend ccache executables to the PATH
run: echo "/usr/lib/ccache:/usr/local/opt/ccache/libexec" >> $GITHUB_PATH

Expand All @@ -469,18 +456,6 @@ jobs:
path: ./packages/build/m2-buildrepo
key: packages-m2-jvm-sync-${{ needs.check-cache.outputs.packages-sha }}

- name: Tree before restore
run: tree ${{ github.workspace }}/packages/jni-swig-stub

- name: Restore JNI Swig Stubs
uses: actions/download-artifact@v3
with:
name: jni-stub-${{ needs.check-cache.outputs.version-label }}
path: ${{ github.workspace }}/packages/jni-swig-stub/build/generated/sources

- name: Tree after restore
run: tree ${{ github.workspace }}/packages/jni-swig-stub

- name: Restore Linux JNI lib
uses: actions/download-artifact@v3
with:
Expand All @@ -501,7 +476,7 @@ jobs:

- name: Build JVM Package
working-directory: packages
run: ./gradlew -x :jni-swig-stub:realmWrapperJvm publishCIPackages -Prealm.kotlin.targets=jvm -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.copyNativeJvmLibs=linux,windows,macos -Prealm.kotlin.mainHost=false
run: ./gradlew publishCIPackages -Prealm.kotlin.targets=jvm -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.copyNativeJvmLibs=linux,windows,macos -Prealm.kotlin.mainHost=false

- name: Upload artifacts
uses: actions/upload-artifact@v3
Expand All @@ -510,22 +485,10 @@ jobs:
path: ./packages/build/m2-buildrepo/**/*
retention-days: 1

- name: Tree after failure
if: always()
run: tree ${{ github.workspace }}/packages/jni-swig-stub

- name: Upload swig dir
uses: actions/upload-artifact@v3
if: always()
with:
name: swig-dir-${{ needs.check-cache.outputs.version-label }}
path: ./packages/jni-swig-stub/build/**/*
retention-days: 1


build-android-packages:
runs-on: ubuntu-latest
needs: [check-cache, build-jni-swig-stub]
needs: check-cache
outputs:
baas-container-id: ${{ steps.baas_cli_start.outputs.baas_container_id }}
if: |
Expand Down Expand Up @@ -556,6 +519,26 @@ jobs:
with:
cache-read-only: false

# Manually install SWIG 4.2. as only 4.0.2 is pre-installed
# 4.2.0 is not available in apt-get, so use brew instead
# We need to use the formulae directly from GitHub to pin the version as Homebrew does not have
# all versions available.
# https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md#ubuntu-22041-lts
# It seems to be required to manually add brew dirs to the PATH. This does not happen automatically.
- name: Install SWIG
run: |
test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
test -r ~/.bash_profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bash_profile
echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.profile
echo "/home/linuxbrew/.linuxbrew/sbin" >> $GITHUB_PATH
echo "/home/linuxbrew/.linuxbrew/bin" >> $GITHUB_PATH
cd ~
curl -L ${{ vars.VERSION_SWIG}} > swig.rb && HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=true brew install swig.rb
- name: Install JSON parser
run: brew install jq

- name: Setup cmake
uses: jwlawson/[email protected]
with:
Expand Down Expand Up @@ -589,12 +572,6 @@ jobs:
with:
ndk-version: r23c

- name: Restore JNI Swig Stubs
uses: actions/download-artifact@v3
with:
name: jni-stub-${{ needs.check-cache.outputs.version-label }}
path: ./packages/jni-swig-stub/build/generated/sources

- name: Build Android Base Test Apk
working-directory: packages
run: ./gradlew :test-base:assembleAndroidTest -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=false
Expand All @@ -605,7 +582,7 @@ jobs:

- name: Build packages
working-directory: packages
run: ./gradlew -x :jni-swig-stub:realmWrapperJvm publishCIPackages -Prealm.kotlin.targets=android -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=false
run: ./gradlew publishCIPackages -Prealm.kotlin.targets=android -Prealm.kotlin.buildRealmCore=false -Prealm.kotlin.mainHost=false

- name: Store build cache
uses: actions/cache@v3
Expand Down Expand Up @@ -706,7 +683,7 @@ jobs:
- name: Build packages
working-directory: packages
run: ./gradlew -x :jni-swig-stub:realmWrapperJvm publishCIPackages -Prealm.kotlin.targets=macosX64 -Prealm.kotlin.mainHost=false
run: ./gradlew publishCIPackages -Prealm.kotlin.targets=macosX64 -Prealm.kotlin.mainHost=false

# We cannot use artifacts as they cannot be shared between workflows, so use cache instead.
- name: Store build cache
Expand Down Expand Up @@ -775,7 +752,7 @@ jobs:
- name: Build packages
working-directory: packages
run: ./gradlew -x :jni-swig-stub:realmWrapperJvm publishCIPackages -Prealm.kotlin.targets=macosArm64 -Prealm.kotlin.mainHost=false
run: ./gradlew publishCIPackages -Prealm.kotlin.targets=macosArm64 -Prealm.kotlin.mainHost=false

- name: Store build cache
uses: actions/cache@v3
Expand Down Expand Up @@ -843,7 +820,7 @@ jobs:
- name: Build packages
working-directory: packages
run: ./gradlew -x :jni-swig-stub:realmWrapperJvm publishCIPackages -Prealm.kotlin.targets=iosX64 -Prealm.kotlin.mainHost=false
run: ./gradlew publishCIPackages -Prealm.kotlin.targets=iosX64 -Prealm.kotlin.mainHost=false

# We cannot use artifacts as they cannot be shared between workflows, so use cache instead.
- name: Store build cache
Expand Down

0 comments on commit f389090

Please sign in to comment.