Prepare next release iteration v0.2.1-SNAPSHOT #104
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cross-Compile | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
android: | |
strategy: | |
matrix: | |
include: | |
- target: x86_64-linux-android | |
ndk: x86_64 | |
- target: aarch64-linux-android | |
ndk: arm64-v8a | |
- target: i686-linux-android | |
ndk: x86 | |
- target: armv7-linux-androideabi | |
ndk: armeabi-v7a | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Cache Rust | |
uses: Swatinem/rust-cache@v2 | |
- name: Install dependencies | |
run: sudo apt-get update -y | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
targets: ${{ matrix.target }} | |
- name: Install cargo-ndk | |
run: cargo install cargo-ndk | |
- name: Build | |
env: | |
RUSTFLAGS: '--cfg surrealdb_unstable' | |
run: cargo ndk -t ${{ matrix.ndk }} build --release | |
- name: Upload so lib | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.target }} | |
path: target/${{ matrix.target }}/release/*.so | |
linux: | |
strategy: | |
matrix: | |
include: | |
- target: x86_64-unknown-linux-gnu | |
linker: CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER=gcc | |
apt-get: gcc | |
- target: aarch64-unknown-linux-gnu | |
linker: CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc | |
apt-get: gcc-aarch64-linux-gnu | |
- target: i686-unknown-linux-gnu | |
linker: CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_LINKER=gcc | |
apt-get: gcc-multilib | |
- target: armv7-unknown-linux-gnueabihf | |
linker: CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc | |
apt-get: gcc-arm-linux-gnueabihf | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Cache Rust | |
uses: Swatinem/rust-cache@v2 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y ${{ matrix.apt-get }} | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
targets: ${{ matrix.target }} | |
- name: Build | |
env: | |
RUSTFLAGS: '--cfg surrealdb_unstable' | |
run: | | |
export ${{ matrix.linker }} | |
cargo build --target ${{ matrix.target }} --release | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.target }} | |
path: target/${{ matrix.target }}/release/*.so | |
windows: | |
strategy: | |
matrix: | |
arch: [ x86_64, i686 ] | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Cache Rust | |
uses: Swatinem/rust-cache@v2 | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
target: ${{ matrix.arch }}-pc-windows-msvc | |
- name: Build | |
env: | |
RUSTFLAGS: '--cfg surrealdb_unstable' | |
run: cargo build --target ${{ matrix.arch }}-pc-windows-msvc --release | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.arch }}-pc-windows-msvc | |
path: target/${{ matrix.arch }}-pc-windows-msvc/release/*.dll | |
macos: | |
strategy: | |
matrix: | |
include: | |
- arch: x86_64 | |
runs-on: macos-12 | |
- arch: aarch64 | |
runs-on: macos-latest | |
runs-on: ${{ matrix.runs-on }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Cache Rust | |
uses: Swatinem/rust-cache@v2 | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
- name: Build | |
env: | |
RUSTFLAGS: '--cfg surrealdb_unstable' | |
run: cargo build --target ${{ matrix.arch }}-apple-darwin --release | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.arch }}-apple-darwin | |
path: target/${{ matrix.arch }}-apple-darwin/release/*.dylib | |
aggregated-jar: | |
runs-on: ubuntu-latest | |
needs: | |
- android | |
- windows | |
- macos | |
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_32 | |
mkdir -p src/main/resources/natives/android_arm64 | |
mkdir -p src/main/resources/natives/android_arm32 | |
mkdir -p src/main/resources/natives/linux_64 | |
mkdir -p src/main/resources/natives/linux_32 | |
mkdir -p src/main/resources/natives/linux_arm64 | |
mkdir -p src/main/resources/natives/linux_arm32 | |
mkdir -p src/main/resources/natives/osx_64 | |
mkdir -p src/main/resources/natives/osx_arm64 | |
mkdir -p src/main/resources/natives/windows_64 | |
mkdir -p src/main/resources/natives/windows_32 | |
- name: Download Android 64 intel | |
uses: actions/download-artifact@v4 | |
with: | |
name: x86_64-linux-android | |
path: src/main/resources/natives/android_64 | |
- name: Download Android 32 intel | |
uses: actions/download-artifact@v4 | |
with: | |
name: i686-linux-android | |
path: src/main/resources/natives/android_32 | |
- name: Download Android 64 arm | |
uses: actions/download-artifact@v4 | |
with: | |
name: aarch64-linux-android | |
path: src/main/resources/natives/android_arm64 | |
- name: Download Android 32 arm | |
uses: actions/download-artifact@v4 | |
with: | |
name: armv7-linux-androideabi | |
path: src/main/resources/natives/android_arm32 | |
- name: Download Linux 64 intel | |
uses: actions/download-artifact@v4 | |
with: | |
name: x86_64-unknown-linux-gnu | |
path: src/main/resources/natives/linux_64 | |
- name: Download Linux 32 intel | |
uses: actions/download-artifact@v4 | |
with: | |
name: i686-unknown-linux-gnu | |
path: src/main/resources/natives/linux_32 | |
- name: Download Linux 64 arm | |
uses: actions/download-artifact@v4 | |
with: | |
name: aarch64-unknown-linux-gnu | |
path: src/main/resources/natives/linux_arm64 | |
- name: Download Linux 32 arm | |
uses: actions/download-artifact@v4 | |
with: | |
name: armv7-unknown-linux-gnueabihf | |
path: src/main/resources/natives/linux_arm32 | |
- name: Download Darwin 64 intel | |
uses: actions/download-artifact@v4 | |
with: | |
name: x86_64-apple-darwin | |
path: src/main/resources/natives/osx_64 | |
- name: Download Darwin 64 arm | |
uses: actions/download-artifact@v4 | |
with: | |
name: aarch64-apple-darwin | |
path: src/main/resources/natives/osx_arm64 | |
- name: Download Windows 64 intel | |
uses: actions/download-artifact@v4 | |
with: | |
name: x86_64-pc-windows-msvc | |
path: src/main/resources/natives/windows_64 | |
- name: Download Windows 32 intel | |
uses: actions/download-artifact@v4 | |
with: | |
name: i686-pc-windows-msvc | |
path: src/main/resources/natives/windows_32 | |
- name: Build JAR | |
run: ./gradlew jar | |
- name: Upload JAR artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: surrealdb | |
path: build/libs/surrealdb-0.3.0-SNAPSHOT.jar | |
- name: Linux Integration Test | |
run: ./gradlew -i integrationTest | |
integration-tests: | |
strategy: | |
matrix: | |
os: [ macos-12, macos-latest, windows-latest, ubuntu-latest ] | |
runs-on: ${{ matrix.os }} | |
needs: | |
- 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 JAR | |
uses: actions/download-artifact@v4 | |
with: | |
name: surrealdb | |
path: build/libs | |
- name: Tests | |
run: ./gradlew -i integrationTest | |
publish: | |
needs: | |
- aggregated-jar | |
- integration-tests | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 22 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 22 | |
- name: Download JAR | |
uses: actions/download-artifact@v4 | |
with: | |
name: surrealdb | |
path: build/libs | |
- name: Publish Jar (Maven) | |
run: ./gradlew publish | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
MAVEN_USERNAME: ${{ secrets.OSSRH_USER }} | |
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASS }} | |
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | |
SIGNING_KEY_PASS: ${{ secrets.SIGNING_KEY_PASS }} | |
- name: Publish release package | |
uses: softprops/action-gh-release@v2 | |
if: github.event_name == 'release' && github.event.action == 'created' | |
with: | |
name: "Release ${{ github.ref_name }}" | |
files: | | |
LICENSE | |
build/libs/*.jar |