Skip to content

Fixes windows integration test #36

Fixes windows integration test

Fixes windows integration test #36

Workflow file for this run

name: Cross-Compile
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-cross:
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- aarch64-unknown-linux-gnu
- x86_64-linux-android
- aarch64-linux-android
- x86_64-pc-windows-gnu
include:
- target: x86_64-unknown-linux-gnu
runs-on: ubuntu-latest
optional: false
- target: aarch64-unknown-linux-gnu
runs-on: ubuntu-latest
optional: false
- target: x86_64-linux-android
runs-on: ubuntu-24.04
optional: true
- target: aarch64-linux-android
runs-on: ubuntu-24.04
optional: true
- target: x86_64-pc-windows-gnu
runs-on: ubuntu-latest
optional: false
runs-on: ${{ matrix.runs-on }}
continue-on-error: ${{ matrix.optional }}
steps:
- name: Install dependencies
run: sudo apt-get update
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Install cross
run: cargo install cross
- name: Cache Rust
uses: Swatinem/rust-cache@v2
- name: Pull cross Docker image
run: docker pull rustembedded/cross:${{ matrix.target }}
- name: Cross compile
run: cross build --target ${{ matrix.target }} --release
- name: Upload so lib
if: matrix.target == 'x86_64-unknown-linux-gnu' || matrix.target == 'aarch64-unknown-linux-gnu'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}-build
path: target/${{ matrix.target }}/release/*.so
- name: Upload dll lib
if: matrix.target == 'x86_64-pc-windows-gnu'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}-build
path: target/${{ matrix.target }}/release/*.dll
build-macos-intel:
runs-on: macos-12
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Cache Rust
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --target x86_64-apple-darwin --release
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: x86_64-apple-darwin-build
path: target/x86_64-apple-darwin/release/*.dylib
build-macos-arm:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Cache Rust
uses: Swatinem/rust-cache@v2
- name: Build
run: cargo build --target aarch64-apple-darwin --release
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: aarch64-apple-darwin-build
path: target/aarch64-apple-darwin/release/*.dylib
build-aggregated-jar:
runs-on: ubuntu-latest
needs:
- build-cross
- build-macos-intel
- build-macos-arm
steps:
- name: Install dependencies
run: sudo apt-get update
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 22
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 22
- name: Gradle
run: chmod +x gradlew
- name: Create directories for artifacts
run: |
mkdir -p src/main/resources/natives/android_64
mkdir -p src/main/resources/natives/android_arm64
mkdir -p src/main/resources/natives/linux_64
mkdir -p src/main/resources/natives/linux_arm64
mkdir -p src/main/resources/natives/osx_64
mkdir -p src/main/resources/natives/osx_arm64
mkdir -p src/main/resources/natives/windows_64
# - name: Download Android artifacts
# uses: actions/download-artifact@v4
# with:
# name: x86_64-linux-android-build
# path: src/main/resources/natives/android_64
#
# - name: Download Arm Android artifacts
# uses: actions/download-artifact@v4
# with:
# name: aarch64-linux-android-build
# path: src/main/resources/natives/android_arm64
- name: Download Linux artifacts
uses: actions/download-artifact@v4
with:
name: x86_64-unknown-linux-gnu-build
path: src/main/resources/natives/linux_64
- name: Download AArch64 Linux artifacts
uses: actions/download-artifact@v4
with:
name: aarch64-unknown-linux-gnu-build
path: src/main/resources/natives/linux_arm64
- name: Download macOS Intel artifacts
uses: actions/download-artifact@v4
with:
name: x86_64-apple-darwin-build
path: src/main/resources/natives/osx_64
- name: Download macOS ARM64 artifacts
uses: actions/download-artifact@v4
with:
name: aarch64-apple-darwin-build
path: src/main/resources/natives/osx_arm64
- name: Download Windows artifacts
uses: actions/download-artifact@v4
with:
name: x86_64-pc-windows-gnu-build
path: src/main/resources/natives/windows_64
- name: Build JAR
run: ./gradlew jar
- name: Upload JAR artifact
uses: actions/upload-artifact@v4
with:
name: surrealdb-jni
path: build/libs/surrealdb-jni-0.2-SNAPSHOT.jar
- name: Linux Integration Test
run: ./gradlew -i integrationTest
windows-integration-test:
runs-on: windows-latest
needs:
- build-aggregated-jar
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 22
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 22
- name: Gradle
run: chmod +x gradlew
- name: Create directory build/libs
run: mkdir -p build/libs
- name: Download lib
uses: actions/download-artifact@v4
with:
name: surrealdb-jni
path: build/libs
- name: Windows Integration Test
run: ./gradlew -i integrationTest
mac-intel-integration-test:
runs-on: macos-12
needs:
- build-aggregated-jar
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 22
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 22
- name: Gradle
run: chmod +x gradlew
- name: Create directory build/libs
run: mkdir -p build/libs
- name: Download lib
uses: actions/download-artifact@v4
with:
name: surrealdb-jni
path: build/libs
- name: Mac Integration Test
run: ./gradlew -i integrationTest
mac-arm-integration-test:
runs-on: macos-latest
needs:
- build-aggregated-jar
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 22
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 22
- name: Gradle
run: chmod +x gradlew
- name: Create directory build/libs
run: mkdir -p build/libs
- name: Download lib
uses: actions/download-artifact@v4
with:
name: surrealdb-jni
path: build/libs
- name: Mac Integration Test
run: ./gradlew -i integrationTest