-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (106 loc) · 3.64 KB
/
deploy.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: Deploy
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
jobs:
build-rust:
name: Build Binaries
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- build: linux-x86
os: ubuntu-latest
target: i686-unknown-linux-gnu
- build: linux-x86_64
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- build: linux-aarch64
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
- build: win-x86
os: windows-latest
target: i686-pc-windows-msvc
- build: win-x86_64
os: windows-latest
target: x86_64-pc-windows-msvc
- build: mac-x86_64
os: macos-11
target: x86_64-apple-darwin
- build: mac-aarch64
os: macos-11
target: aarch64-apple-darwin
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Get the release version from the tag
shell: bash
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Install Rust
uses: dtolnay/rust-toolchain@nightly
with:
targets: ${{ matrix.target }}
- name: Install gcc-aarch64-linux-gnu
if: matrix.build == 'linux-aarch64'
run: sudo apt-get update && sudo apt-get install gcc-aarch64-linux-gnu -y
- name: Install gcc-i686-linux-gnu
if: matrix.build == 'linux-x86'
run: sudo apt-get update && sudo apt-get install gcc-i686-linux-gnu libc6-dev-i386 -y
- name: Build
uses: actions-rs/cargo@v1
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
with:
command: build
args: --release --target ${{ matrix.target }} --manifest-path rust/Cargo.toml
- name: Create platform dir
shell: bash
run: |
binary_name="rnnoise_jni_rust"
dirname="src/main/resources/natives/${{ matrix.build }}"
mkdir "$dirname"
if [ "${{ matrix.os }}" = "windows-latest" ]; then
mv "rust/target/${{ matrix.target }}/release/$binary_name.dll" "$dirname"
elif [ "${{ matrix.os }}" = "macos-11" ]; then
mv "rust/target/${{ matrix.target }}/release/lib$binary_name.dylib" "$dirname"
else
mv "rust/target/${{ matrix.target }}/release/lib$binary_name.so" "$dirname"
fi
echo "ASSET=$dirname" >> $GITHUB_ENV
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.build }}
path: ${{ env.ASSET }}
build:
name: Build & Publish Jar
runs-on: ubuntu-latest
needs: build-rust
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Download all artifacts
uses: actions/download-artifact@v3
with:
path: src/main/resources/natives
- name: Get the release version from the tag
shell: bash
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin
- name: Build with Gradle
uses: gradle/gradle-build-action@v2
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
with:
arguments: publish -x test -Pversion=${{ env.VERSION }}
- name: Upload artifact
uses: softprops/action-gh-release@v1
with:
files: |
build/libs/rnnoise-jni-rust-${{ env.VERSION }}.jar