Skip to content

Build fix (14): windows build #53

Build fix (14): windows build

Build fix (14): windows build #53

Workflow file for this run

name: Publish artifacts to Sonatype Repo
on: [ push ]
env:
NATIVE_DIR: zwaves_jni/javalib/src/main/resources/META-INF/native
jobs:
build-native:
name: ${{ matrix.platform }}/${{ matrix.arch }} library
runs-on: ${{ matrix.os }}
env:
# Where a library should be
target-path: ${{ matrix.platform }}/${{ matrix.arch }}
# Rust build target
build-target: ${{ matrix.build-arch }}-${{ matrix.build-platform }}
# Rust target directory
TARGET_DIR: ./target
# Emit backtraces on panics.
RUST_BACKTRACE: 1
strategy:
matrix:
platform: [ windows ]
# platform: [ linux, osx, windows ]
arch: [ aarch64, amd64, x86 ]
exclude:
# - platform: osx
# arch: x86
- platform: windows
arch: aarch64
include:
# - platform: linux
# os: ubuntu-20.04
# build-platform: unknown-linux-gnu
# artifact: libzwaves_jni.so
#
# - platform: linux
# arch: aarch64
# extra-packages: gcc-9-aarch64-linux-gnu gcc-aarch64-linux-gnu # TODO do we need gcc-9?
#
# - platform: linux
# arch: x86
# extra-packages: gcc-multilib
#
# - platform: osx
# os: macos-latest
# build-platform: apple-darwin
# artifact: libzwaves_jni.dylib
- platform: windows
os: ubuntu-20.04
extra-packages: mingw-w64
build-platform: pc-windows-gnu
artifact: libzwaves_jni.dll
# - arch: aarch64
# build-arch: aarch64
- arch: amd64
build-arch: x86_64
- arch: x86
build-arch: i686
steps:
- name: Debug
run: |
echo "Build target: ${{ env.build-target }}"
echo "Target path: ${{ env.target-path }}"
- name: Checkout sources
uses: actions/checkout@v4
- name: Install build tools
if: ${{ matrix.extra-packages }}
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.extra-packages }}
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: ${{ env.build-target }}
- name: Enable Rust dependencies caching
uses: Swatinem/rust-cache@v2
- name: Run Rust tests
# Architecture is x86-64 always: https://stackoverflow.com/a/71220337
if: matrix.arch == 'amd64'
run: |
cd zwaves_jni
cargo test --lib --target ${{ env.build-target }}
- name: Build native libraries
run: |
cd zwaves_jni
cargo build --release --target ${{ env.build-target }}
cd ..
cp target/${{ env.build-target }}/release/${{ matrix.artifact }} ${{ env.NATIVE_DIR }}/${{ env.target-path }}
- name: Upload result
uses: actions/upload-artifact@v3
with:
name: native-libraries
path: ${{ env.NATIVE_DIR }}/**/*
build-jni:
name: Build JNI library
runs-on: ubuntu-latest
needs: build-native
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 8
distribution: temurin
cache: gradle
- uses: actions/download-artifact@v3
with:
name: native-libraries
path: ${{ env.NATIVE_DIR }}
- name: Run tests
run: |
cd zwaves_jni/javalib
./gradlew publishToMavenLocal
- name: Publish Snapshot
run: |
cd zwaves_jni/javalib
./gradlew publishToMavenLocal
- name: Upload result
uses: actions/upload-artifact@v3
with:
name: javalib
path: ~/.m2/repository/com/wavesplatform