forked from jitsi/jitsi-srtp
-
Notifications
You must be signed in to change notification settings - Fork 0
216 lines (182 loc) · 5.91 KB
/
maven.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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
name: Java CI with Maven and CMake
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
# Java version to use for the release
RELEASE_JAVA_VERSION: 11
UBUNTU_MIRROR_AMD64: http://azure.archive.ubuntu.com/ubuntu
DOCKER_BUILDKIT: 1
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 11, 17, 21 ]
name: Java ${{ matrix.java }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ matrix.java }}
cache: maven
- name: Build and test with Maven
run: mvn -B verify -DperformRelease=true -Pcoverage -DskipNativeTests=true
- name: Upload coverage report
if: matrix.java == env.RELEASE_JAVA_VERSION
uses: codecov/codecov-action@v2
- name: Upload JNI headers
if: matrix.java == env.RELEASE_JAVA_VERSION
uses: actions/upload-artifact@v3
with:
name: javah
path: target/native
ubuntu_natives:
needs: test
runs-on: ubuntu-latest
name: Ubuntu Natives (${{ matrix.arch }}, OpenSSL ${{ matrix.dist.libssl }})
strategy:
matrix:
dist:
- { dist: focal, libssl: "1.1" }
- { dist: jammy, libssl: "3" }
arch:
- amd64
- arm64
- ppc64el
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get JNI headers
uses: actions/download-artifact@v3
with:
name: javah
path: target/native
- name: Build natives with CMake in Docker
run: resources/ubuntu-build-docker.sh ${{ matrix.arch }} ${{ matrix.dist.dist }} ${{ env.RELEASE_JAVA_VERSION }} ${{ matrix.dist.libssl }}
- name: Upload lib as artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.dist.dist }}-${{ matrix.arch }}
path: src/main/resources/*
mac_natives:
needs: test
name: Mac Natives (${{ matrix.arch.arch }}, OpenSSL ${{ matrix.libssl }})
strategy:
fail-fast: false
matrix:
libssl:
- "1.1"
- "3"
arch:
- { arch: x86_64, runner: macos-13 }
- { arch: arm64, runner: macos-14 }
runs-on: ${{ matrix.arch.runner }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get JNI headers
uses: actions/download-artifact@v3
with:
name: javah
path: target/native
- name: Set up JDK ${{ env.RELEASE_JAVA_VERSION }}
id: install_java
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: ${{ env.RELEASE_JAVA_VERSION }}
architecture: ${{ matrix.arch.arch }}
- name: Install OpenSSL ${{ matrix.libssl }}
run: brew install openssl@${{ matrix.libssl }}
- name: Build natives with CMake
run: resources/mac-cmake.sh "${{ steps.install_java.outputs.path }}" "${{ matrix.arch.arch }}" "${{ matrix.libssl }}"
- name: Upload lib as artifact
uses: actions/upload-artifact@v3
with:
name: darwin-${{ matrix.arch }}
path: src/main/resources/*
release:
name: Test including natives and release
needs:
- test
- ubuntu_natives
- mac_natives
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: ${{ env.RELEASE_JAVA_VERSION }}
cache: maven
server-id: ossrh
server-username: SONATYPE_USER
server-password: SONATYPE_PW
- name: Download natives
uses: actions/download-artifact@v3
with:
path: target
- name: Copy natives for Maven
run: |
BASEDIR=$(pwd)/src/main/resources
mkdir -p $BASEDIR
cd target
for dist in */*/ ; do
last_dir=$(basename $dist)
if [[ "$last_dir" =~ ^(linux|darwin) ]]; then
mkdir -p "$BASEDIR/$last_dir" || true
cp "$dist"/*.{so,dylib} "$BASEDIR/$last_dir" || true
fi;
done;
- name: Set version
run: |
VERSION=`git describe --match "v[0-9\.]*" --long --dirty --always`
mvn -B versions:set -DnewVersion=${VERSION:1} -DgenerateBackupPoms=false
- name: Run Maven tests with native (if PR)
if: github.ref != 'refs/heads/master'
run: mvn -B verify -Dosgi-native=true -DperformRelease=true
- name: Run Maven tests with native (if release)
if: github.ref == 'refs/heads/master'
run: mvn -B test -Dosgi-native=true
- name: Attach final jars (if PR)
uses: actions/upload-artifact@v3
if: github.ref != 'refs/heads/master'
with:
name: jars
path: target/*.jar
- name: Test including natives and release to Maven Central
if: github.ref == 'refs/heads/master'
env:
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PW: ${{ secrets.SONATYPE_PW }}
run: |
cat <(echo -e "${{ secrets.GPG_KEY }}") | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
mvn \
--no-transfer-progress \
--batch-mode \
-Dgpg.passphrase="${{ secrets.GPG_PW }}" \
-DperformRelease=true \
-Drelease=true \
-DskipTests \
-Dosgi-native=true \
deploy
- name: Attach final jars (after releasing to Maven Central)
uses: actions/upload-artifact@v3
if: github.ref == 'refs/heads/master'
with:
name: jars
path: target/*.jar