-
Notifications
You must be signed in to change notification settings - Fork 47
286 lines (272 loc) · 15.6 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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
name: Build
on:
push:
release:
types: [published]
jobs:
athena:
name: Build for Athena
runs-on: ubuntu-22.04
steps:
# Job setup & initial build
- name: "Checkout repository"
uses: actions/checkout@v3
- name: "Setup Java"
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "11"
- name: "Build all"
run: bazelisk build --config=athena --verbose_failures ...
- name: "Release: Get version number"
id: get_version
if: github.event_name == 'release'
uses: battila7/get-version-action@v2
- name: "Release: Get release info"
id: get_release_info
if: github.event_name == 'release'
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload vendordep
- name: "Release: Generate vendordep"
if: github.event_name == 'release'
run: bazelisk build --define "publishing_version=${{ steps.get_version.outputs.version-without-v }}" //:vendordep
- name: "Release: Upload vendordep"
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: bazel-bin/AdvantageKit.json
asset_name: AdvantageKit.json
asset_content_type: application/json
# Upload example projects
- name: "Release: Generate example projects"
if: github.event_name == 'release'
run: bazelisk build --define "publishing_version=${{ steps.get_version.outputs.version-without-v }}" //example_projects
- name: "Release: Upload example project (skeleton)"
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: bazel-bin/example_projects/skeleton.zip
asset_name: AdvantageKit_SkeletonProject.zip
asset_content_type: application/zip
- name: "Release: Upload example project (diff_drive)"
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: bazel-bin/example_projects/diff_drive.zip
asset_name: AdvantageKit_DiffDriveProject.zip
asset_content_type: application/zip
- name: "Release: Upload example project (swerve_drive)"
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: bazel-bin/example_projects/swerve_drive.zip
asset_name: AdvantageKit_SwerveDriveProject.zip
asset_content_type: application/zip
- name: "Release: Upload example project (advanced_swerve_drive)"
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: bazel-bin/example_projects/advanced_swerve_drive.zip
asset_name: AdvantageKit_AdvancedSwerveDriveProject.zip
asset_content_type: application/zip
- name: "Release: Upload example project (kitbot_2024)"
if: github.event_name == 'release'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: bazel-bin/example_projects/kitbot_2024.zip
asset_name: AdvantageKit_KitBot2024.zip
asset_content_type: application/zip
# Upload conduit build
- name: "Release: Install Dependencies"
if: github.event_name == 'release'
run: pip3 install requests
- name: 'Release: Build "conduit/wpilibio:nativezip"'
if: github.event_name == 'release'
run: bazelisk build --config=athena --define "publishing_version=${{ steps.get_version.outputs.version-without-v }}" //conduit/wpilibio:nativezip
- name: 'Release: Upload "conduit/wpilibio:nativezip" to local'
if: github.event_name == 'release'
run: python3 build_tools/repo/publish_zip.py --url file://$HOME/maven_offline --group_id org.littletonrobotics.akit.conduit --artifact_id conduit-wpilibio --version ${{ steps.get_version.outputs.version-without-v }} --classifier linuxathena --file_path bazel-bin/conduit/wpilibio/wpilibio-${{ steps.get_version.outputs.version-without-v }}-linuxathena.zip
- name: 'Release: Upload "conduit/wpilibio:nativezip" to GitHub'
if: github.event_name == 'release'
run: python3 build_tools/repo/publish_zip.py --url https://maven.pkg.github.com/Mechanical-Advantage/AdvantageKit --group_id org.littletonrobotics.akit.conduit --artifact_id conduit-wpilibio --version ${{ steps.get_version.outputs.version-without-v }} --classifier linuxathena --file_path bazel-bin/conduit/wpilibio/wpilibio-${{ steps.get_version.outputs.version-without-v }}-linuxathena.zip --username Mechanical-Advantage --access_token ${{ secrets.GITHUB_TOKEN }}
- name: 'Release: Upload "conduit/wpilibio:pom" to local'
if: github.event_name == 'release'
run: bazelisk run --config=athena --define "maven_repo=file://$HOME/maven_offline" --define "publishing_version=${{ steps.get_version.outputs.version-without-v }}" //conduit/wpilibio:pom.publish
- name: 'Release: Upload "conduit/wpilibio:pom" to GitHub'
if: github.event_name == 'release'
run: bazelisk run --config=athena --define "maven_repo=https://maven.pkg.github.com/Mechanical-Advantage/AdvantageKit" --define "publishing_version=${{ steps.get_version.outputs.version-without-v }}" //conduit/wpilibio:pom.publish
env:
GITHUB_ACTOR: Mechanical-Advantage
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Upload Java packages
- name: 'Release: Upload "conduit/api" to local'
if: github.event_name == 'release'
run: bazelisk run --define "maven_repo=file://$HOME/maven_offline" --define "publishing_version=${{ steps.get_version.outputs.version-without-v }}" //conduit/api:api-export.publish
- name: 'Release: Upload "conduit/api" to GitHub'
if: github.event_name == 'release'
run: bazelisk run --define "maven_repo=https://maven.pkg.github.com/Mechanical-Advantage/AdvantageKit" --define "maven_user=Mechanical-Advantage" --define "maven_password=${{ secrets.GITHUB_TOKEN }}" --define "publishing_version=${{ steps.get_version.outputs.version-without-v }}" //conduit/api:api-export.publish
- name: 'Release: Upload "junction/core" to local'
if: github.event_name == 'release'
run: bazelisk run --define "maven_repo=file://$HOME/maven_offline" --define "publishing_version=${{ steps.get_version.outputs.version-without-v }}" //junction/core:core-export.publish
- name: 'Release: Upload "junction/core" to GitHub'
if: github.event_name == 'release'
run: bazelisk run --define "maven_repo=https://maven.pkg.github.com/Mechanical-Advantage/AdvantageKit" --define "maven_user=Mechanical-Advantage" --define "maven_password=${{ secrets.GITHUB_TOKEN }}" --define "publishing_version=${{ steps.get_version.outputs.version-without-v }}" //junction/core:core-export.publish
- name: 'Release: Upload "junction/autolog" to local'
if: github.event_name == 'release'
run: bazelisk run --define "maven_repo=file://$HOME/maven_offline" --define "publishing_version=${{ steps.get_version.outputs.version-without-v }}" //junction/autolog:autolog-export.publish
- name: 'Release: Upload "junction/autolog" to GitHub'
if: github.event_name == 'release'
run: bazelisk run --define "maven_repo=https://maven.pkg.github.com/Mechanical-Advantage/AdvantageKit" --define "maven_user=Mechanical-Advantage" --define "maven_password=${{ secrets.GITHUB_TOKEN }}" --define "publishing_version=${{ steps.get_version.outputs.version-without-v }}" //junction/autolog:autolog-export.publish
- name: 'Release: Upload "junction/shims/wpilib" to local'
if: github.event_name == 'release'
run: bazelisk run --define "maven_repo=file://$HOME/maven_offline" --define "publishing_version=${{ steps.get_version.outputs.version-without-v }}" //junction/shims/wpilib:wpilib-export.publish
- name: 'Release: Upload "junction/shims/wpilib" to GitHub'
if: github.event_name == 'release'
run: bazelisk run --define "maven_repo=https://maven.pkg.github.com/Mechanical-Advantage/AdvantageKit" --define "maven_user=Mechanical-Advantage" --define "maven_password=${{ secrets.GITHUB_TOKEN }}" --define "publishing_version=${{ steps.get_version.outputs.version-without-v }}" //junction/shims/wpilib:wpilib-export.publish
# Upload local repo
- name: 'Release: Upload local repo'
uses: actions/upload-artifact@v3
if: github.event_name == 'release'
with:
name: maven_Athena
path: ~/maven_offline/
desktop:
strategy:
matrix:
host:
- {
os: macos-12,
displayName: "macOS",
classifier: "osxuniversal",
mavenLocal: "file://$HOME/maven_offline",
mavenLocalUpload: "~/maven_offline"
}
- {
os: ubuntu-22.04,
displayName: "Linux",
classifier: "linuxx86-64",
mavenLocal: "file://$HOME/maven_offline",
mavenLocalUpload: "~/maven_offline"
}
- {
os: windows-2019,
displayName: "Windows",
classifier: "windowsx86-64",
mavenLocal: "file://%userprofile%\\maven_offline",
mavenLocalUpload: "%userprofile%/maven_offline"
}
name: Build for ${{ matrix.host.displayName }}
runs-on: ${{ matrix.host.os }}
steps:
# Job setup & initial build
- name: "Checkout repository"
uses: actions/checkout@v3
- name: "Setup Java"
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "11"
- name: "Build all"
run: bazelisk build --verbose_failures ...
- name: "Test all"
run: bazelisk test ...
- name: "Release: Get version number"
id: get_version
if: github.event_name == 'release'
uses: battila7/get-version-action@v2
# Upload conduit build
- name: "Release: Install Dependencies"
if: github.event_name == 'release'
run: pip3 install requests
- name: 'Release: Build "conduit/wpilibio:nativezip" for macOS'
if: github.event_name == 'release' && matrix.host.displayName == 'macOS'
run: bazelisk build --define "publishing_version=${{ steps.get_version.outputs.version-without-v }}" //conduit/wpilibio/osxuniversal:nativezip
- name: 'Release: Upload "conduit/wpilibio:nativezip" to local for macOS'
if: github.event_name == 'release' && matrix.host.displayName == 'macOS'
run: python3 build_tools/repo/publish_zip.py --url ${{ matrix.host.mavenLocal }} --group_id org.littletonrobotics.akit.conduit --artifact_id conduit-wpilibio --version ${{ steps.get_version.outputs.version-without-v }} --classifier ${{ matrix.host.classifier }} --file_path bazel-bin/conduit/wpilibio/osxuniversal/wpilibio-${{ steps.get_version.outputs.version-without-v }}-${{ matrix.host.classifier }}.zip
- name: 'Release: Upload "conduit/wpilibio:nativezip" to GitHub for macOS'
if: github.event_name == 'release' && matrix.host.displayName == 'macOS'
run: python3 build_tools/repo/publish_zip.py --url https://maven.pkg.github.com/Mechanical-Advantage/AdvantageKit --group_id org.littletonrobotics.akit.conduit --artifact_id conduit-wpilibio --version ${{ steps.get_version.outputs.version-without-v }} --classifier ${{ matrix.host.classifier }} --file_path bazel-bin/conduit/wpilibio/osxuniversal/wpilibio-${{ steps.get_version.outputs.version-without-v }}-${{ matrix.host.classifier }}.zip --username Mechanical-Advantage --access_token ${{ secrets.GITHUB_TOKEN }}
- name: 'Release: Build "conduit/wpilibio:nativezip"'
if: github.event_name == 'release' && matrix.host.displayName != 'macOS'
run: bazelisk build --define "publishing_version=${{ steps.get_version.outputs.version-without-v }}" //conduit/wpilibio:nativezip
- name: 'Release: Upload "conduit/wpilibio:nativezip" to local'
if: github.event_name == 'release' && matrix.host.displayName != 'macOS'
run: python3 build_tools/repo/publish_zip.py --url ${{ matrix.host.mavenLocal }} --group_id org.littletonrobotics.akit.conduit --artifact_id conduit-wpilibio --version ${{ steps.get_version.outputs.version-without-v }} --classifier ${{ matrix.host.classifier }} --file_path bazel-bin/conduit/wpilibio/wpilibio-${{ steps.get_version.outputs.version-without-v }}-${{ matrix.host.classifier }}.zip
- name: 'Release: Upload "conduit/wpilibio:nativezip" to GitHub'
if: github.event_name == 'release' && matrix.host.displayName != 'macOS'
run: python3 build_tools/repo/publish_zip.py --url https://maven.pkg.github.com/Mechanical-Advantage/AdvantageKit --group_id org.littletonrobotics.akit.conduit --artifact_id conduit-wpilibio --version ${{ steps.get_version.outputs.version-without-v }} --classifier ${{ matrix.host.classifier }} --file_path bazel-bin/conduit/wpilibio/wpilibio-${{ steps.get_version.outputs.version-without-v }}-${{ matrix.host.classifier }}.zip --username Mechanical-Advantage --access_token ${{ secrets.GITHUB_TOKEN }}
# Upload local repo
- name: 'Release: Upload local repo'
uses: actions/upload-artifact@v3
if: github.event_name == 'release'
with:
name: maven_${{ matrix.host.displayName }}
path: ${{ matrix.host.mavenLocalUpload }}
combine:
name: "Release: Combine Maven Offline"
runs-on: ubuntu-latest
if: github.event_name == 'release'
needs: [athena, desktop]
steps:
- name: "Download Athena"
uses: actions/download-artifact@v3
with:
name: maven_Athena
path: maven_Athena
- name: "Download macOS"
uses: actions/download-artifact@v3
with:
name: maven_macOS
path: maven_macOS
- name: "Download Linux"
uses: actions/download-artifact@v3
with:
name: maven_Linux
path: maven_Linux
- name: "Download Windows"
uses: actions/download-artifact@v3
with:
name: maven_Windows
path: maven_Windows
- name: Combine
run: |
rsync -a maven_Athena/* maven_offline
rsync -a maven_macOS/* maven_offline
rsync -a maven_Linux/* maven_offline
rsync -a maven_Windows/* maven_offline
zip -r maven_offline.zip maven_offline
- name: "Get release info"
id: get_release_info
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ github.token }}
- name: "Upload Maven zip"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: maven_offline.zip
asset_name: maven_offline.zip
asset_content_type: application/zip