-
Notifications
You must be signed in to change notification settings - Fork 43
199 lines (164 loc) · 5.74 KB
/
choreolib.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
name: ChoreoLib
on: [push, pull_request]
jobs:
build-docker:
strategy:
fail-fast: false
matrix:
include:
- container: wpilib/roborio-cross-ubuntu:2024-22.04
artifact-name: Athena
build-options: -Ponlylinuxathena
- container: wpilib/raspbian-cross-ubuntu:bullseye-22.04
artifact-name: Linux-arm32
build-options: -Ponlylinuxarm32
- container: wpilib/aarch64-cross-ubuntu:bullseye-22.04
artifact-name: Linux-arm64
build-options: -Ponlylinuxarm64
- container: wpilib/ubuntu-base:22.04
artifact-name: Linux-x86_64
build-options:
name: "Build C++ and Java / ${{ matrix.artifact-name }}"
runs-on: ubuntu-24.04
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Fetch all history and metadata
run: |
git config --global --add safe.directory /__w/${{ github.event.repository.name }}/${{ github.event.repository.name }}
- name: Set version (release)
if: startsWith(github.ref, 'refs/tags/v')
working-directory: choreolib
run: sed -i "s/0.0.0/${GITHUB_REF##*v}/g" publish.gradle
- name: Build with Gradle
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
working-directory: choreolib
run: ./gradlew build ${{ matrix.build-options }}
- name: Build with Gradle (release)
if: startsWith(github.ref, 'refs/tags/v')
working-directory: choreolib
run: ./gradlew build ${{ matrix.build-options }} -PreleaseMode
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: choreolib/build/allOutputs
build-host:
env:
MACOSX_DEPLOYMENT_TARGET: 13.3
strategy:
fail-fast: false
matrix:
include:
- os: windows-2022
artifact-name: Windows-x86_64
build-options:
# FIXME: Link failure on commands library
# - os: windows-2022
# artifact-name: Windows-aarch64
# build-options: -Pbuildwinarm64 -Ponlywindowsarm64
- os: macOS-13
artifact-name: macOS-x86_64
build-options:
- os: macOS-14
artifact-name: macOS-arm64
build-options:
name: "Build C++ and Java / ${{ matrix.artifact-name }}"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Fetch all history and metadata
run: git fetch --prune --unshallow
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 17
- name: Set version (Windows release)
if: startsWith(matrix.os, 'windows') && startsWith(github.ref, 'refs/tags/v')
run: |
sed -i "s/0.0.0/${GITHUB_REF##*v}/g" publish.gradle
./gradlew spotlessApply # Undo line ending changes from sed
working-directory: choreolib
- name: Set version (macOS release)
if: startsWith(matrix.os, 'macOS') && startsWith(github.ref, 'refs/tags/v')
run: sed -i '' "s/0.0.0/${GITHUB_REF##*v}/g" publish.gradle
working-directory: choreolib
- name: Build with Gradle
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
working-directory: choreolib
run: ./gradlew build ${{ matrix.build-options }}
- name: Build with Gradle (release)
if: startsWith(github.ref, 'refs/tags/v')
working-directory: choreolib
run: ./gradlew build ${{ matrix.build-options }} -PreleaseMode
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: choreolib/build/allOutputs
combine:
name: Combine
needs: [build-docker, build-host]
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
repository: wpilibsuite/build-tools
- uses: actions/download-artifact@v4
with:
path: combiner/products/build/allOutputs
- name: Flatten Artifacts
run: rsync -a --delete combiner/products/build/allOutputs/*/* combiner/products/build/allOutputs
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: 17
- name: Combine
run: ./gradlew publish -Pthirdparty
working-directory: combiner
- uses: actions/upload-artifact@v4
with:
name: ChoreoLib-Maven
path: ~/releases
build-python:
name: "Build Python"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: 3.12
- run: pip3 install build wheel pytest
- run: python3 -m build
working-directory: ./choreolib/py
- run: pip3 install --no-cache-dir dist/*.whl
working-directory: ./choreolib/py
- run: pytest
working-directory: ./choreolib/py
- uses: actions/upload-artifact@v4
with:
name: Python
path: ./choreolib/py/dist
pypi-publish:
name: Upload release to PyPI
runs-on: ubuntu-24.04
needs: [build-python]
if: github.repository_owner == 'SleipnirGroup' && startsWith(github.ref, 'refs/tags/v')
environment:
name: pypi
url: https://pypi.org/p/sleipnirgroup-choreolib
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v4
with:
path: dist
pattern: "Python"
merge-multiple: true
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1