forked from REVrobotics/CANBridge
-
Notifications
You must be signed in to change notification settings - Fork 0
220 lines (191 loc) · 8.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
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
217
218
219
220
name: Build
on:
push:
branches:
- 'main'
pull_request:
branches:
- '*'
defaults:
run:
shell: bash
jobs:
build-docker:
strategy:
fail-fast: false
matrix:
include:
- container: wpilib/aarch64-cross-ubuntu:bullseye-22.04
name: LinuxARM64
build-options: "-Ponlylinuxarm64"
platform-type: linuxarm64
arch: arm64
- container: wpilib/raspbian-cross-ubuntu:bullseye-22.04
name: LinuxARM32
build-options: "-Ponlylinuxarm32"
platform-type: linuxarm32
arch: arm32
runs-on: ubuntu-latest
name: "Build - ${{ matrix.name }}"
container: ${{ matrix.container }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11
- name: Build
run: |
./gradlew outputVersions publish ${{ matrix.build-options }} -PreleaseMode
- name: Download WPILib HAL artifacts and headers for ${{ matrix.platform-type }}
run : |
halVersion=$(cat wpiHalVersion.txt)
halPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-${{ matrix.platform-type }}.zip
utilPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-${{ matrix.platform-type }}.zip
curl -o halPlatform.zip "$halPlatformUrl"
curl -o utilPlatform.zip "$utilPlatformUrl"
- name: Unzip WPILib HAL artifacts and headers
run: |
unzip halPlatform.zip -d halPlatform
unzip utilPlatform.zip -d utilPlatform
mkdir -p CANBridge-artifacts
# Put Linux ARM release files together in one directory
- name: Create Artifact
run: |
cp build/libs/cANBridge/static/release/libCANBridge.a CANBridge-artifacts/libCANBridge.a
cp build/libs/cANBridge/shared/release/libCANBridge.so CANBridge-artifacts/libCANBridge.so
cp halPlatform/linux/${{ matrix.arch }}/shared/libwpiHal.so CANBridge-artifacts/libwpiHal.so
cp utilPlatform/linux/${{ matrix.arch }}/shared/libwpiutil.so CANBridge-artifacts/libwpiutil.so
# Upload build artifact
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: CANBridge-${{ matrix.platform-type }}
path: CANBridge-artifacts/
build-native:
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
container: ''
name: Win64
build-options: ""
platform-type: windowsx86-64
- os: ubuntu-latest
container: ''
name: Linux64
platform-type: linuxx86-64
build-options: ""
- os: macos-latest
container: ''
name: macOS
platform-type: osxuniversal
build-options: ""
name: "Build - ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 11
- name: Cache
uses: actions/cache@v4
with:
path: |
.gradle
bin
build
key: ${{ matrix.name }}-build-${{ github.sha }}
restore-keys: |
${{ matrix.name }}-build-
- name: Build
run: |
./gradlew outputVersions publish ${{ matrix.build-options }} -PreleaseMode
- name: Download WPILib HAL artifacts and headers for ${{ matrix.platform-type }}
run : |
halVersion=$(cat wpiHalVersion.txt)
halPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-${{ matrix.platform-type }}.zip
utilPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-${{ matrix.platform-type }}.zip
curl -o halPlatform.zip "$halPlatformUrl"
curl -o utilPlatform.zip "$utilPlatformUrl"
- name: Unzip WPILib HAL artifacts and headers
run: |
unzip halPlatform.zip -d halPlatform
unzip utilPlatform.zip -d utilPlatform
mkdir -p CANBridge-artifacts
# Put Windows release files together in one directory
- name: Create Artifact (windows64)
if: matrix.platform-type == 'windowsx86-64'
run: |
cp build/libs/cANBridge/static/windowsx86-64/release/CANBridge.lib CANBridge-artifacts/CANBridge-static.lib
cp build/libs/cANBridge/shared/windowsx86-64/release/CANBridge.dll CANBridge-artifacts/CANBridge.dll
cp build/libs/cANBridge/shared/windowsx86-64/release/CANBridge.lib CANBridge-artifacts/CANBridge.lib
cp halPlatform/windows/x86-64/shared/wpiHal.dll CANBridge-artifacts/wpiHal.dll
cp halPlatform/windows/x86-64/shared/wpiHal.lib CANBridge-artifacts/wpiHal.lib
cp utilPlatform/windows/x86-64/shared/wpiutil.dll CANBridge-artifacts/wpiutil.dll
cp utilPlatform/windows/x86-64/shared/wpiutil.lib CANBridge-artifacts/wpiutil.lib
# Put Linux release files together in one directory
- name: Create Artifact (linux64)
if: matrix.platform-type == 'linuxx86-64'
run: |
cp build/libs/cANBridge/static/linuxx86-64/release/libCANBridge.a CANBridge-artifacts/libCANBridge.a
cp build/libs/cANBridge/shared/linuxx86-64/release/libCANBridge.so CANBridge-artifacts/libCANBridge.so
cp halPlatform/linux/x86-64/shared/libwpiHal.so CANBridge-artifacts/libwpiHal.so
cp utilPlatform/linux/x86-64/shared/libwpiutil.so CANBridge-artifacts/libwpiutil.so
# Put macOS release files together in one directory
- name: Create Artifact (osxuniversal)
if: matrix.platform-type == 'osxuniversal'
run: |
cp build/libs/cANBridge/static/osxuniversal/release/libCANBridge.a CANBridge-artifacts/libCANBridge.a
cp build/libs/cANBridge/shared/osxuniversal/release/libCANBridge.dylib CANBridge-artifacts/libCANBridge.dylib
cp halPlatform/osx/universal/shared/libwpiHal.dylib CANBridge-artifacts/libwpiHal.dylib
cp utilPlatform/osx/universal/shared/libwpiutil.dylib CANBridge-artifacts/libwpiutil.dylib
# Upload build artifact
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: CANBridge-${{ matrix.platform-type }}-${{ matrix.name }}
path: CANBridge-artifacts/
wpi-headers:
runs-on: ubuntu-latest
name: "WPILib Headers"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.sha }}
- name: Download WPILib HAL artifacts and headers for linuxx86-64
run : |
halVersion=$(cat wpiHalVersion.txt)
halHeadersUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-headers.zip
utilHeadersUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-headers.zip
curl -o halHeaders.zip "$halHeadersUrl"
curl -o utilHeaders.zip "$utilHeadersUrl"
- name: Unzip WPILib HAL artifacts and headers
run: |
unzip halHeaders.zip -d halHeaders
unzip utilHeaders.zip -d utilHeaders
- name: Gather all needed headers
run: |
mkdir headers-for-artifact
cp -r halHeaders/hal headers-for-artifact
cp -r utilHeaders/wpi headers-for-artifact
cp -r src/main/native/include/* headers-for-artifact
# Upload build artifact
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
path: headers-for-artifact
name: headers