1
1
name : Build
2
2
3
3
on :
4
- push :
5
- branches :
6
- - ' main'
7
- pull_request :
8
- branches :
9
- - ' *'
4
+ [push, pull_request]
5
+
6
+ concurrency :
7
+ group : ${{ github.workflow }}-${{ github.head_ref || github.ref }}
8
+ cancel-in-progress : false
10
9
11
10
defaults :
12
11
run :
13
12
shell : bash
14
13
15
14
jobs :
16
- build :
15
+ # Use WPI provided Docker images to build for Linux ARM32 and ARM64 platforms
16
+ build-docker :
17
+ strategy :
18
+ fail-fast : false
19
+ matrix :
20
+ include :
21
+ - container : wpilib/aarch64-cross-ubuntu:bullseye-22.04
22
+ name : LinuxARM64
23
+ build-options : " -Ponlylinuxarm64"
24
+ platform-type : linuxarm64
25
+ arch : arm64
26
+ - container : wpilib/raspbian-cross-ubuntu:bullseye-22.04
27
+ name : LinuxARM32
28
+ build-options : " -Ponlylinuxarm32"
29
+ platform-type : linuxarm32
30
+ arch : arm32
31
+ runs-on : ubuntu-latest
32
+ name : " Build - ${{ matrix.name }}"
33
+ container : ${{ matrix.container }}
34
+ steps :
35
+ - name : Checkout
36
+ uses : actions/checkout@v4
37
+ with :
38
+ ref : ${{ github.sha }}
39
+
40
+ - name : Setup Java
41
+ uses : actions/setup-java@v4
42
+ with :
43
+ distribution : ' zulu'
44
+ java-version : 11
45
+
46
+ - name : Setup Gradle
47
+ uses : gradle/actions/setup-gradle@v4
48
+
49
+ - name : Build
50
+ run : |
51
+ ./gradlew outputVersions publish ${{ matrix.build-options }} -PreleaseMode
52
+
53
+ - name : Download WPILib HAL artifacts and headers for ${{ matrix.platform-type }}
54
+ run : |
55
+ halVersion=$(cat wpiHalVersion.txt)
56
+
57
+ halPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-${{ matrix.platform-type }}.zip
58
+ utilPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-${{ matrix.platform-type }}.zip
59
+
60
+ curl -o halPlatform.zip "$halPlatformUrl"
61
+ curl -o utilPlatform.zip "$utilPlatformUrl"
62
+
63
+ - name : Unzip WPILib HAL artifacts and headers
64
+ run : |
65
+ unzip halPlatform.zip -d halPlatform
66
+ unzip utilPlatform.zip -d utilPlatform
67
+ mkdir -p CANBridge-artifacts
68
+
69
+ # Put Linux ARM release files together in one directory
70
+ - name : Create Artifact
71
+ run : |
72
+ cp build/libs/cANBridge/static/release/libCANBridge.a CANBridge-artifacts/libCANBridge.a
73
+ cp build/libs/cANBridge/shared/release/libCANBridge.so CANBridge-artifacts/libCANBridge.so
74
+ cp halPlatform/linux/${{ matrix.arch }}/shared/libwpiHal.so CANBridge-artifacts/libwpiHal.so
75
+ cp utilPlatform/linux/${{ matrix.arch }}/shared/libwpiutil.so CANBridge-artifacts/libwpiutil.so
76
+
77
+ # Upload build artifact
78
+ - name : Upload build artifact
79
+ uses : actions/upload-artifact@v4
80
+ with :
81
+ name : CANBridge-${{ matrix.platform-type }}-${{ github.sha}}
82
+ path : CANBridge-artifacts/
83
+
84
+ # Use native runners to build for Windows, Linux, and macOS
85
+ build-native :
17
86
timeout-minutes : 15
18
87
strategy :
19
88
fail-fast : false
20
89
matrix :
21
90
include :
22
91
- os : windows-latest
23
- container : ' '
24
- name : windows64
25
- name : " build-${{ matrix.name }}"
92
+ name : Win64
93
+ build-options : " "
94
+ platform-type : windowsx86-64
95
+ - os : ubuntu-latest
96
+ name : Linux64
97
+ platform-type : linuxx86-64
98
+ build-options : " "
99
+ - os : macos-latest
100
+ name : macOS
101
+ platform-type : osxuniversal
102
+ build-options : " "
103
+ name : " Build - ${{ matrix.name }}"
26
104
runs-on : ${{ matrix.os }}
27
- container : ${{ matrix.container }}
28
105
steps :
29
106
- name : Checkout
30
- uses : actions/checkout@v3
107
+ uses : actions/checkout@v4
31
108
with :
32
109
ref : ${{ github.sha }}
33
110
34
111
- name : Setup Java
35
- uses : actions/setup-java@v3
112
+ uses : actions/setup-java@v4
36
113
with :
37
114
distribution : ' zulu'
38
115
java-version : 11
39
116
117
+ - name : Setup Gradle
118
+ uses : gradle/actions/setup-gradle@v4
119
+
40
120
- name : Build
41
121
run : |
42
122
./gradlew outputVersions publish ${{ matrix.build-options }} -PreleaseMode
43
123
44
- - name : Download WPILib HAL artifacts and headers, gather all needed headers
124
+ - name : Download WPILib HAL artifacts and headers for ${{ matrix.platform-type }}
45
125
run : |
46
126
halVersion=$(cat wpiHalVersion.txt)
47
-
48
- # Download WPILib artifacts from Artifactory
49
- halWindowsUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-windowsx86-64.zip
127
+
128
+ halPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-${{ matrix.platform-type }}.zip
129
+ utilPlatformUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-${{ matrix.platform-type }}.zip
130
+
131
+ curl -o halPlatform.zip "$halPlatformUrl"
132
+ curl -o utilPlatform.zip "$utilPlatformUrl"
133
+
134
+ - name : Unzip WPILib HAL artifacts and headers
135
+ run : |
136
+ unzip halPlatform.zip -d halPlatform
137
+ unzip utilPlatform.zip -d utilPlatform
138
+ mkdir -p CANBridge-artifacts
139
+
140
+ # Put release files together in one directory based on platform
141
+ - name : Create Artifact
142
+ run : |
143
+ mkdir -p CANBridge-artifacts
144
+ if [[ "${{ matrix.platform-type }}" == "windowsx86-64" ]]; then
145
+ cp build/libs/cANBridge/static/windowsx86-64/release/CANBridge.lib CANBridge-artifacts/CANBridge-static.lib
146
+ cp build/libs/cANBridge/shared/windowsx86-64/release/CANBridge.dll CANBridge-artifacts/CANBridge.dll
147
+ cp build/libs/cANBridge/shared/windowsx86-64/release/CANBridge.lib CANBridge-artifacts/CANBridge.lib
148
+ cp halPlatform/windows/x86-64/shared/wpiHal.dll CANBridge-artifacts/wpiHal.dll
149
+ cp halPlatform/windows/x86-64/shared/wpiHal.lib CANBridge-artifacts/wpiHal.lib
150
+ cp utilPlatform/windows/x86-64/shared/wpiutil.dll CANBridge-artifacts/wpiutil.dll
151
+ cp utilPlatform/windows/x86-64/shared/wpiutil.lib CANBridge-artifacts/wpiutil.lib
152
+ elif [[ "${{ matrix.platform-type }}" == "linuxx86-64" ]]; then
153
+ cp build/libs/cANBridge/static/linuxx86-64/release/libCANBridge.a CANBridge-artifacts/libCANBridge.a
154
+ cp build/libs/cANBridge/shared/linuxx86-64/release/libCANBridge.so CANBridge-artifacts/libCANBridge.so
155
+ cp halPlatform/linux/x86-64/shared/libwpiHal.so CANBridge-artifacts/libwpiHal.so
156
+ cp utilPlatform/linux/x86-64/shared/libwpiutil.so CANBridge-artifacts/libwpiutil.so
157
+ elif [[ "${{ matrix.platform-type }}" == "osxuniversal" ]]; then
158
+ cp build/libs/cANBridge/static/osxuniversal/release/libCANBridge.a CANBridge-artifacts/libCANBridge.a
159
+ cp build/libs/cANBridge/shared/osxuniversal/release/libCANBridge.dylib CANBridge-artifacts/libCANBridge.dylib
160
+ cp halPlatform/osx/universal/shared/libwpiHal.dylib CANBridge-artifacts/libwpiHal.dylib
161
+ cp utilPlatform/osx/universal/shared/libwpiutil.dylib CANBridge-artifacts/libwpiutil.dylib
162
+ fi
163
+
164
+ # Upload build artifact
165
+ - name : Upload build artifact
166
+ uses : actions/upload-artifact@v4
167
+ with :
168
+ name : CANBridge-${{ matrix.platform-type }}-${{ github.sha}}
169
+ path : CANBridge-artifacts/
170
+
171
+ # Upload combined headers for WPILib from HAL and WPIUtil
172
+ wpi-headers :
173
+ runs-on : ubuntu-latest
174
+ name : " WPILib Headers"
175
+ steps :
176
+ - name : Checkout
177
+ uses : actions/checkout@v4
178
+ with :
179
+ ref : ${{ github.sha }}
180
+ - name : Download WPILib HAL artifacts and headers
181
+ run : |
182
+ halVersion=$(cat wpiHalVersion.txt)
183
+
50
184
halHeadersUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/hal/hal-cpp/"$halVersion"/hal-cpp-"$halVersion"-headers.zip
51
- utilWindowsUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-windowsx86-64.zip
52
185
utilHeadersUrl=https://frcmaven.wpi.edu/artifactory/release/edu/wpi/first/wpiutil/wpiutil-cpp/"$halVersion"/wpiutil-cpp-"$halVersion"-headers.zip
53
- curl -o halWindows.zip "$halWindowsUrl"
186
+
54
187
curl -o halHeaders.zip "$halHeadersUrl"
55
- curl -o utilWindows.zip "$utilWindowsUrl"
56
188
curl -o utilHeaders.zip "$utilHeadersUrl"
57
- unzip halWindows.zip -d halWindows
189
+
190
+ - name : Unzip WPILib HAL artifacts and headers
191
+ run : |
58
192
unzip halHeaders.zip -d halHeaders
59
- unzip utilWindows.zip -d utilWindows
60
193
unzip utilHeaders.zip -d utilHeaders
61
194
62
- # Gather all of the the needed headers
195
+ - name : Gather all needed headers
196
+ run : |
63
197
mkdir headers-for-artifact
64
198
cp -r halHeaders/hal headers-for-artifact
65
199
cp -r utilHeaders/wpi headers-for-artifact
66
200
cp -r src/main/native/include/* headers-for-artifact
67
201
68
- # Zip the needed headers and put them in the appropriate location for artifact upload
69
- mkdir -p CANBridge-artifacts
70
- 7z a CANBridge-artifacts/headers.zip ./headers-for-artifact/*
71
-
72
- # Put release files together in one directory
73
- - name : Create Artifact
74
- run : |
75
- mkdir -p CANBridge-artifacts
76
- cp build/libs/cANBridge/static/windowsx86-64/release/CANBridge.lib CANBridge-artifacts/CANBridge-static.lib
77
- cp build/libs/cANBridge/shared/windowsx86-64/release/CANBridge.dll CANBridge-artifacts/CANBridge.dll
78
- cp build/libs/cANBridge/shared/windowsx86-64/release/CANBridge.lib CANBridge-artifacts/CANBridge.lib
79
- cp halWindows/windows/x86-64/shared/wpiHal.dll CANBridge-artifacts/wpiHal.dll
80
- cp halWindows/windows/x86-64/shared/wpiHal.lib CANBridge-artifacts/wpiHal.lib
81
- cp utilWindows/windows/x86-64/shared/wpiutil.dll CANBridge-artifacts/wpiutil.dll
82
- cp utilWindows/windows/x86-64/shared/wpiutil.lib CANBridge-artifacts/wpiutil.lib
83
-
84
202
# Upload build artifact
85
203
- name : Upload build artifact
86
- uses : actions/upload-artifact@v3
204
+ uses : actions/upload-artifact@v4
87
205
with :
88
- name : CANBridge-${{ github.sha }}
89
- path : CANBridge-artifacts/
206
+ path : headers-for-artifact
207
+ name : headers
208
+
209
+ # Upload version file, used for versioning
210
+ version :
211
+ runs-on : ubuntu-latest
212
+ name : " Version"
213
+ steps :
214
+ - name : Checkout
215
+ uses : actions/checkout@v4
216
+ with :
217
+ ref : ${{ github.sha }}
218
+
219
+ - name : Setup Java
220
+ uses : actions/setup-java@v4
221
+ with :
222
+ distribution : ' zulu'
223
+ java-version : 11
90
224
91
- # Upload version.txt
92
- - name : Upload version artifact
93
- uses : actions/upload-artifact@v3
225
+ - name : Setup Gradle
226
+ uses : gradle/actions/setup-gradle@v4
227
+
228
+ - name : Build
229
+ run : |
230
+ ./gradlew outputVersions -PreleaseMode
231
+
232
+ - name : Upload build artifact
233
+ uses : actions/upload-artifact@v4
94
234
with :
95
235
name : version
96
- path : build/allOutputs/version.txt
236
+ path : build/allOutputs/version.txt
0 commit comments