-
Notifications
You must be signed in to change notification settings - Fork 11
313 lines (263 loc) · 7.93 KB
/
ci.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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
name: CI
on:
pull_request:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
verify-versions:
name: Verify Versions
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 0
- run: npm i -g pnpm @antfu/ni
- name: Setup Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
with:
node-version: 18.x
cache: pnpm
- name: Install Dependencies
run: nci
- name: Verify Versions
run: nr verify-versions
format-csharp:
name: Format C#
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
submodules: true
- name: Install .NET Core
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4
with:
dotnet-version: 6.x
- name: Install ReSharper
run: |
dotnet tool install -g JetBrains.ReSharper.GlobalTools --version 2022.2.2
- name: Restore
run: |
cd packages/csharp
dotnet restore ArmoniK.Api.sln
- name: Reformat
run: |
cd packages/csharp
jb cleanupcode ArmoniK.Api.sln
- name: Check Diff
run: |
DIFF="$(git diff --name-only)"
if [ -z "$DIFF" ]; then
echo "OK: Format is clean"
else
echo "Error: Format was not clean"
echo "List of files:"
echo "$DIFF"
git diff
exit 1
fi
format-python:
name: Check linting, formatting and typing
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/python
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 0
- name: pip update and add build package
run: bash proto2python.sh ~/pyvenv
- name: Install dependencies
run: |
source ~/pyvenv/bin/activate
python -m pip install uv
python -m uv pip install "$(echo pkg/armonik*.whl)[dev]"
- name: Lint
run: |
source ~/pyvenv/bin/activate
python -m ruff check .
# - name: Check typing
# run: |
# source ~/pyvenv/bin/activate
# python -m mypy --exclude src/armonik/protogen/ src/
- name: Check format
run: |
source ~/pyvenv/bin/activate
python -m ruff format .
- name: Check Diff
run: |
DIFF="$(git diff --name-only)"
if [ -z "$DIFF" ]; then
echo "OK: Format is clean"
else
echo "Error: Format was not clean"
echo "List of files:"
echo "$DIFF"
git diff
exit 1
fi
format-cpp:
name: Format C++
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Run clang-format
run: |
sudo apt-get update
sudo apt-get install -y clang-format
- name: Check Diff
id: check-diff
run: |
cd packages/cpp
git ls-files *.{c,h,hpp,cpp,cc} | xargs clang-format -style=file:.clang-format -i
DIFF="$(git diff --name-only)"
if [ -z "$DIFF" ]; then
echo "OK: Format is clean"
else
echo "Error: Format was not clean"
echo "List of files:"
echo "$DIFF"
git diff
exit 1
fi
- name: Generate patch
if: ${{ failure() && steps.check-diff.conclusion == 'failure' }}
run: |
git diff > patch-cpp.diff
- uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a
if: ${{ failure() && steps.check-diff.conclusion == 'failure' }}
with:
name: patch-cpp
path: ./patch-cpp.diff
format-protobuf:
name: Format Protobuf
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
ref: ${{ github.ref }}
fetch-depth: 0
submodules: true
- name: Check Diff
run: docker run --rm --volume "$(pwd)/Protos/V1:/workspace" --workdir /workspace bufbuild/buf:1.8.0 format -d --exit-code
lint-js:
name: Lint JS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 0
- run: npm install -g [email protected]
- run: corepack enable
- uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
with:
node-version: 20
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm run lint
build-web:
name: Build Web
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/web
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 0
- run: npm i -g pnpm @antfu/ni
- name: Setup Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
with:
node-version: 18.x
cache: pnpm
- name: Install Dependencies
run: nci
- name: Install Protoc
run: sudo apt install -y protobuf-compiler
- name: Build protos
run: nr proto:generate:linux
- name: Build
run: nr build
build-angular:
name: Build Angular
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/angular
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 0
- run: npm i -g pnpm @antfu/ni
- name: Setup Node.js
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4
with:
node-version: 18.x
cache: pnpm
- name: Install Dependencies
run: nci
- name: Install Protoc
run: sudo apt install -y protobuf-compiler
- name: Build protos
run: nr proto:generate:linux
- name: Build
run: nr build
build-cpp-packages:
strategy:
fail-fast: false
matrix:
type: [tar.gz, deb, rpm]
name: Build C++ Packages [${{ matrix.type }}]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
ref: ${{ github.ref }}
- name: Build the package
run: |
cd packages/cpp/tools/packaging
./make-${{ matrix.type }}.sh
- name: Publish package as artefact
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a
with:
if-no-files-found: error
path: packages/cpp/tools/packaging/*.${{ matrix.type }}
name: libarmonik.${{ matrix.type }}
build-java-packages:
name: Build Java
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/java
steps:
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
with:
fetch-depth: 0
- name: Set up java 17
uses: actions/setup-java@v4
with:
distribution: oracle
java-version: 17
cache: maven
gpg-private-key: ${{ secrets.GPG_SIGNING_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Build the package
run: mvn clean install -DskipTests
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_SIGNING_KEY_PASSWORD }}