-
Notifications
You must be signed in to change notification settings - Fork 5
262 lines (224 loc) · 11 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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
name: Build
on:
[push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: false
defaults:
run:
shell: bash
jobs:
# Use WPI provided Docker images to build for Linux ARM32 and ARM64 platforms
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: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- 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)
sharedHalPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-${{ matrix.platform-type }}.zip
sharedUtilPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-${{ matrix.platform-type }}.zip
curl -L -o sharedHalPlatform.zip "$sharedHalPlatformUrl"
curl -L -o sharedUtilPlatform.zip "$sharedHtilPlatformUrl"
staticHalPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-${{ matrix.platform-type }}static.zip
staticUtilPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-${{ matrix.platform-type }}static.zip
curl -L -o staticHalPlatform.zip "$staticHalPlatformUrl"
curl -L -o staticUtilPlatform.zip "$staticHtilPlatformUrl"
- name: Unzip WPILib HAL artifacts and headers
run: |
unzip sharedHalPlatform.zip -d sharedHalPlatform
unzip sharedUtilPlatform.zip -d sharedUtilPlatform
unzip staticHalPlatform.zip -d staticHalPlatform
unzip staticUtilPlatform.zip -d staticUtilPlatform
mkdir -p CANBridge-artifacts/static
mkdir -p CANBridge-artifacts/shared
# Put Linux ARM release files together in one directory
- name: Create Artifact
run: |
cp build/libs/cANBridge/shared/release/libCANBridge.so CANBridge-artifacts/shared/libCANBridge.so
cp sharedHalPlatform/linux/${{ matrix.arch }}/shared/libwpiHal.so CANBridge-artifacts/shared/libwpiHal.so
cp sharedUtilPlatform/linux/${{ matrix.arch }}/shared/libwpiutil.so CANBridge-artifacts/shared/libwpiutil.so
cp build/libs/cANBridge/static/release/libCANBridge.a CANBridge-artifacts/static/libCANBridge.a
cp staticHalPlatform/linux/${{ matrix.arch }}/static/libwpiHal.a CANBridge-artifacts/static/libwpiHal.a
cp staticUtilPlatform/linux/${{ matrix.arch }}/static/libwpiutil.a CANBridge-artifacts/static/libwpiutil.a
# Upload build artifact
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: CANBridge-${{ matrix.platform-type }}-${{ github.sha}}
path: CANBridge-artifacts/
# Use native runners to build for Windows, Linux, and macOS
build-native:
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
name: Win64
build-options: ""
platform-type: windowsx86-64
- os: ubuntu-latest
name: Linux64
platform-type: linuxx86-64
build-options: ""
- os: macos-latest
name: macOS
platform-type: osxuniversal
build-options: ""
name: "Build - ${{ matrix.name }}"
runs-on: ${{ matrix.os }}
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: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- 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)
sharedHalPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-${{ matrix.platform-type }}.zip
sharedUtilPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-${{ matrix.platform-type }}.zip
curl -L -o sharedHalPlatform.zip "$sharedHalPlatformUrl"
curl -L -o sharedUtilPlatform.zip "$sharedHtilPlatformUrl"
staticHalPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-${{ matrix.platform-type }}static.zip
staticUtilPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-${{ matrix.platform-type }}static.zip
curl -L -o staticHalPlatform.zip "$staticHalPlatformUrl"
curl -L -o staticUtilPlatform.zip "$staticHtilPlatformUrl"
- name: Unzip WPILib HAL artifacts and headers
run: |
unzip sharedHalPlatform.zip -d sharedHalPlatform
unzip sharedUtilPlatform.zip -d sharedUtilPlatform
unzip staticHalPlatform.zip -d staticHalPlatform
unzip staticUtilPlatform.zip -d staticUtilPlatform
mkdir -p CANBridge-artifacts/static
mkdir -p CANBridge-artifacts/shared
# Put release files together in one directory based on platform
- name: Create Artifact
run: |
mkdir -p CANBridge-artifacts
if [[ "${{ matrix.platform-type }}" == "windowsx86-64" ]]; then
cp build/libs/cANBridge/shared/windowsx86-64/release/CANBridge.dll CANBridge-artifacts/shared/
cp build/libs/cANBridge/shared/windowsx86-64/release/CANBridge.lib CANBridge-artifacts/shared/
cp sharedHalPlatform/windows/x86-64/shared/wpiHal.dll CANBridge-artifacts/shared/
cp sharedHalPlatform/windows/x86-64/shared/wpiHal.lib CANBridge-artifacts/shared/
cp sharedUtilPlatform/windows/x86-64/shared/wpiutil.dll CANBridge-artifacts/shared/
cp sharedUtilPlatform/windows/x86-64/shared/wpiutil.lib CANBridge-artifacts/shared/
cp build/libs/cANBridge/static/windowsx86-64/release/CANBridge.lib CANBridge-artifacts/static/
cp staticHalPlatform/windows/x86-64/static/wpiHal.lib CANBridge-artifacts/static/
cp staticUtilPlatform/windows/x86-64/static/wpiutil.lib CANBridge-artifacts/static/
elif [[ "${{ matrix.platform-type }}" == "linuxx86-64" ]]; then
cp build/libs/cANBridge/shared/linuxx86-64/release/libCANBridge.so CANBridge-artifacts/shared/
cp sharedHalPlatform/linux/x86-64/shared/libwpiHal.so CANBridge-artifacts/shared/
cp sharedUtilPlatform/linux/x86-64/shared/libwpiutil.so CANBridge-artifacts/shared/
cp build/libs/cANBridge/static/linuxx86-64/release/libCANBridge.a CANBridge-artifacts/static/
cp staticHalPlatform/linux/x86-64/static/libwpiHal.a CANBridge-artifacts/static/
cp staticUtilPlatform/linux/x86-64/static/libwpiutil.a CANBridge-artifacts/static/
elif [[ "${{ matrix.platform-type }}" == "osxuniversal" ]]; then
cp build/libs/cANBridge/shared/osxuniversal/release/libCANBridge.dylib CANBridge-artifacts/shared/
cp sharedHalPlatform/osx/universal/shared/libwpiHal.dylib CANBridge-artifacts/shared/
cp sharedUtilPlatform/osx/universal/shared/libwpiutil.dylib CANBridge-artifacts/shared
cp build/libs/cANBridge/static/osxuniversal/release/libCANBridge.a CANBridge-artifacts/static/
cp staticHalPlatform/osx/universal/static/libwpiHal.a CANBridge-artifacts/static/
cp staticUtilPlatform/osx/universal/static/libwpiutil.a CANBridge-artifacts/static/
fi
# Upload build artifact
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: CANBridge-${{ matrix.platform-type }}-${{ github.sha}}
path: CANBridge-artifacts/
# Upload combined headers for WPILib from HAL and WPIUtil
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
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 -L -o halHeaders.zip "$halHeadersUrl"
curl -L -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
# Upload version file, used for versioning
version:
runs-on: ubuntu-latest
name: "Version"
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: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Build
run: |
./gradlew outputVersions -PreleaseMode
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: version
path: build/allOutputs/version.txt