-
Notifications
You must be signed in to change notification settings - Fork 7
106 lines (89 loc) · 2.74 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
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.target }} library
runs-on: ${{ matrix.os }}
env:
target-path: ${{ matrix.platform }}-${{ matrix.arch }}
# rust flags
TARGET_DIR: ./target
# Emit backtraces on panics.
RUST_BACKTRACE: 1
strategy:
matrix:
platform: [ darwin ]
arch: [ x86-64, aarch64 ]
# exclude:
# - platform: linux
# arch: x86-64
# - platform: win32
# arch: aarch64
include:
- platform: darwin
os: macos-latest
artifact: libzwaves_jni.dylib
- platform: darwin
arch: aarch64
target: aarch64-apple-darwin
dest: osx64/aarch64
- platform: darwin
arch: x86-64
target: x86_64-apple-darwin
dest: osx
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: ${{ matrix.target }}
- name: Enable rust dependencies caching
uses: Swatinem/rust-cache@v2
- name: Run rust tests
if: matrix.arch != 'aarch64' # Architecture is x86-64 always: https://stackoverflow.com/a/71220337
run: |
cd zwaves_jni
cargo test --lib --target ${{ matrix.target }}
- name: Build native libraries
run: |
cd zwaves_jni
cargo build --release --target ${{ matrix.target }}
cd ..
cp target/${{ matrix.target }}/release/${{ matrix.artifact }} ${{ env.NATIVE_DIR }}/${{ matrix.dest }}
- 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