forked from NeuronRobotics/nrjavaserial
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (65 loc) · 2.17 KB
/
build.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
name: Build
on:
- push
- pull_request
jobs:
natives-linux:
name: Linux (x86_64) native library compilation
runs-on: ubuntu-18.04
defaults:
run:
working-directory: src/main/c
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 8
- name: Install build prerequisites
run: |
sudo apt update
- name: Build the Linux native libraries (x86_64 only)
run: |
make clean-linux
make linux64
# The names of the artifacts containing native libraries correspond
# exactly to the directories inside `src/main/c/resources/native`. That
# way, the Java build job can pull down all artifacts and unpack them
# into that directory to overwrite the versions in-repo. This is sadly
# necessary because the actions/download-artifact@v2 action flattens
# paths inside artifacts. If it retained full relative paths, we could
# put Linux and Windows natives inside the same artifact, and we could be
# flexible with the artifact names. But it doesn't, so we can't, and we
# can't.
- name: Upload Linux native libraries
uses: actions/upload-artifact@v2
with:
name: linux
path: src/main/c/resources/native/linux
java:
name: Java compilation
runs-on: ubuntu-18.04
needs:
- natives-linux
steps:
- name: Checkout the code
uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v1
with:
java-version: 8
- name: Download native libraries
uses: actions/download-artifact@v2
with:
path: src/main/c/resources/native
- name: Build the Java library
run: ./gradlew build
- name: Determine commit hash for artifact filename
id: vars
run: echo "::set-output name=short-rev::$(git rev-parse --short HEAD)"
- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
name: nrjavaserial-${{steps.vars.outputs.short-rev}}
path: build/libs/*.jar