-
Notifications
You must be signed in to change notification settings - Fork 6
555 lines (413 loc) · 15.5 KB
/
gs1encoders.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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
name: GS1 Encoders CI
on:
push:
pull_request:
jobs:
#
# CI jobs
#
ci-clang:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: clang CI (with sanitizers)
run: |
# For llvm-symbolizer
sudo apt-get -y --no-install-recommends install llvm
# Load AI table from external Syntax Dictionary
make -C src/c-lib -j `nproc` test CC=clang SANITIZE=yes SLOW_TESTS=yes
# Re-run using the embedded AI table
rm src/c-lib/gs1-syntax-dictionary.txt
make -C src/c-lib -j `nproc` test CC=clang SANITIZE=yes SLOW_TESTS=yes
git checkout src/c-lib/gs1-syntax-dictionary.txt
make -C src/c-lib -j `nproc` lib CC=clang SANITIZE=yes
make -C src/c-lib -j `nproc` app CC=clang SANITIZE=yes
( cd src/c-lib && LD_LIBRARY_PATH=build build/gs1encoders.bin --version )
make -C src/c-lib -j `nproc` app-static CC=clang SANITIZE=yes
( cd src/c-lib && build/gs1encoders-linux.bin --version )
ci-gcc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: gcc CI
run: |
# Load AI table from external Syntax Dictionary
make -C src/c-lib -j `nproc` test CC=gcc SLOW_TESTS=yes
# Re-run using the embedded AI table
rm src/c-lib/gs1-syntax-dictionary.txt
make -C src/c-lib -j `nproc` test CC=gcc SLOW_TESTS=yes
git checkout src/c-lib/gs1-syntax-dictionary.txt
make -C src/c-lib -j `nproc` lib CC=gcc
make -C src/c-lib -j `nproc` app CC=gcc
( cd src/c-lib && LD_LIBRARY_PATH=build build/gs1encoders.bin --version )
make -C src/c-lib -j `nproc` app-static CC=gcc
( cd src/c-lib && build/gs1encoders-linux.bin --version )
ci-msvc:
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1
- name: MSVC CI
run: |
msbuild /t:Restore,Build /p:Configuration=release /p:Platform="x86" /warnaserror src\gs1encoders.sln
# Load AI table from external Syntax Dictionary
copy src\c-lib\gs1-syntax-dictionary.txt .
src\c-lib\build\test\Win32\Release\gs1encoders-test.exe
# Re-run using the embedded AI table
del gs1-syntax-dictionary.txt
src\c-lib\build\test\Win32\Release\gs1encoders-test.exe
copy src\c-lib\gs1-syntax-dictionary.txt .
src\c-lib\build\console-app\Win32\Release\gs1encoders-app.exe --version
src\dotnet-app\bin\Release\netcoreapp3.1\gs1encoders-dotnet-app.exe --version
ci-macos:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- name: clang CI
run: |
# Load AI table from external Syntax Dictionary
make -C src/c-lib -j `sysctl -n hw.logicalcpu` test SANITIZE=yes SLOW_TESTS=yes
# Re-run using the embedded AI table
rm src/c-lib/gs1-syntax-dictionary.txt
make -C src/c-lib -j `sysctl -n hw.logicalcpu` test SANITIZE=yes SLOW_TESTS=yes
git checkout src/c-lib/gs1-syntax-dictionary.txt
make -C src/c-lib -j `sysctl -n hw.logicalcpu` lib SANITIZE=yes
make -C src/c-lib -j `sysctl -n hw.logicalcpu` app SANITIZE=yes
( cd src/c-lib && DYLD_LIBRARY_PATH=build build/gs1encoders.bin --version )
make -C src/c-lib -j `sysctl -n hw.logicalcpu` app-static SANITIZE=yes
( cd src/c-lib && build/gs1encoders-linux.bin --version )
ci-scan-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: clang static analyser CI
run: |
sudo apt-get update
sudo apt-get -y --no-install-recommends install clang-tools
scan-build -o plist make -C src/c-lib -j `nproc` all CC=clang
scan-build -o plist make -C src/c-lib -j `nproc` test CC=clang SLOW_TESTS=yes
[ "$(find plist/ -name *.html)" = '' ];
- name: "clang static analyzer: Store assets on failure"
uses: actions/upload-artifact@v3
with:
name: clang-scan.tgz
path: plist/**/*.html
retention-days: 30
if: ${{ failure() }}
- name: check includes with IWYU
working-directory: src/c-lib
run: |
sudo apt-get -y --no-install-recommends install iwyu
find -name '*.c' -print0 | xargs -0 -n1 -i bash -c 'iwyu -DPRNT -DSYMBOLOGY=gs1_encoder_sNONE -DUNIT_TESTS -DGS1_LINTER_ERR_STR_EN {}; [[ $? = 2 ]] || false'
- name: cppcheck
working-directory: src/c-lib
run: |
sudo apt-get -y --no-install-recommends install cppcheck
cppcheck --enable=all --force \
-U GS1_LINTER_CUSTOM_GCP_LOOKUP \
-U GS1_LINTER_CUSTOM_GCP_LOOKUP_H \
-U GS1_LINTER_CUSTOM_ISO4217_LOOKUP \
-U GS1_LINTER_CUSTOM_ISO4217_LOOKUP_H \
-U GS1_LINTER_CUSTOM_ISO3166ALPHA2_LOOKUP \
-U GS1_LINTER_CUSTOM_ISO3166ALPHA2_LOOKUP_H \
-U GS1_LINTER_CUSTOM_ISO3166_LOOKUP \
-U GS1_LINTER_CUSTOM_ISO3166_LOOKUP_H \
-U CLOCK_MONOTONIC -U RUNNING_ON_VALGRIND -U TEST_FINI -U TEST_INIT \
-i gs1encoders-fuzzer-ais.c \
-i gs1encoders-fuzzer-dl.c \
-i gs1encoders-fuzzer-scandata.c \
-i gs1encoders-fuzzer-syn.c \
-i gs1syntaxdictionary-fuzzer-linters.c \
--suppress=missingIncludeSystem .
ci-java:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Java CI
run: |
make -C src/c-lib -j `nproc`
ant -f src/java/build.xml test
ci-wasm:
runs-on: ubuntu-latest
steps:
- uses: mymindstorm/setup-emsdk@v12
- uses: actions/checkout@v3
- name: WASM build
run: |
make -C src/c-lib -j `nproc` wasm
ls -l src/c-lib/build-wasm
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Node.js run
working-directory: src/js-wasm
run: |
node example.node.mjs --version
ci-jsonly:
runs-on: ubuntu-latest
steps:
- uses: mymindstorm/setup-emsdk@v12
- uses: actions/checkout@v3
- name: WASM build
run: |
make -C src/c-lib -j `nproc` wasm JSONLY=yes
ls -l src/c-lib/build-wasm
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Node.js run
working-directory: src/js-wasm
run: |
node example.node.mjs --version
ci-ios-app:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: src/ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: iOS app CI
working-directory: src/ios
run: |
pod install
xcodebuild -workspace GS1\ Encoders\ App.xcworkspace -scheme 'GS1 Encoders App' build CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
ci-android-app:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- name: Android app CI
working-directory: src/android
run: |
./gradlew build --no-daemon
#
# Production builds
#
build-release-windows:
needs:
- ci-msvc
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1
- name: Windows release build
run: |
msbuild /t:Restore,Build /p:Configuration=release /p:Platform="x86" /p:RuntimeIdentifier=win-x86 /warnaserror src\gs1encoders.sln
msbuild /p:Configuration=release /p:Platform="x86" /p:PublishSingleFile=True /p:SelfContained=True /p:RuntimeIdentifier=win-x86 /p:PublishDir=bin\Release\netcoreapp3.1\win-x86\publish\ /warnaserror src\gs1encoders.sln -target:gs1encoders-dotnet-app:Publish
- name: ZIP development libs
working-directory: src/c-lib/build/library/Win32/Release
run: |
7z a gs1encoders-windows-libs.zip gs1encoders.h gs1encoders.lib gs1encoders.dll ../../../../gs1-syntax-dictionary.txt
- name: Store Windows development libs
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v3
with:
name: windows-libs
path: src/c-lib/build/library/Win32/Release/gs1encoders-windows-libs.zip
- name: ZIP console application
working-directory: src/c-lib/build/console-app/Win32/Release
run: |
7z a gs1encoders-windows-console-app.zip gs1encoders-app.exe gs1encoders.dll ../../../../gs1-syntax-dictionary.txt
- name: Store Windows console app
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v3
with:
name: windows-console-app
path: src/c-lib/build/console-app/Win32/Release/gs1encoders-windows-console-app.zip
- name: ZIP GUI application
working-directory: src/dotnet-app/bin/Release\netcoreapp3.1\win-x86\publish
run: |
7z a gs1encoders-windows-gui-app.zip gs1encoders-dotnet-app.exe ../../gs1encoders.dll ../../../../../../c-lib/gs1-syntax-dictionary.txt
- name: Store Windows GUI app
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v3
with:
name: windows-gui-app
path: src/dotnet-app/bin/Release/netcoreapp3.1/win-x86/publish/gs1encoders-windows-gui-app.zip
build-release-linux:
needs:
- ci-gcc
- ci-clang
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Linux release build
run: |
make -C src/c-lib -j `nproc` CC=clang
src/c-lib/build/gs1encoders-linux.bin --version
cp src/c-lib/gs1-syntax-dictionary.txt src/c-lib/build/
cd src/c-lib/build
tar cvzf gs1encoders-linux-app.tgz gs1encoders-linux.bin gs1-syntax-dictionary.txt
- name: Store Linux build
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v3
with:
name: linux-app
path: src/c-lib/build/gs1encoders-linux-app.tgz
build-release-wasm:
needs:
- ci-wasm
runs-on: ubuntu-latest
steps:
- uses: mymindstorm/setup-emsdk@v12
- uses: actions/checkout@v3
- name: WASM release build
run: |
make -C src/c-lib -j `nproc` wasm
cp src/js-wasm/gs1encoder.mjs src/js-wasm/example.html src/js-wasm/example.mjs src/js-wasm/example.node.mjs src/c-lib/build-wasm/
cd src/c-lib/build-wasm
tar cvzf gs1encoders-wasm-app.tgz gs1encoder-wasm.wasm gs1encoder-wasm.mjs gs1encoder.mjs example.html example.mjs example.node.mjs
- name: Store WASM build
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v3
with:
name: wasm-app
path: src/c-lib/build-wasm/gs1encoders-wasm-app.tgz
build-release-jsonly:
needs:
- ci-jsonly
runs-on: ubuntu-latest
steps:
- uses: mymindstorm/setup-emsdk@v12
- uses: actions/checkout@v3
- name: JSONLY release build
run: |
make -C src/c-lib -j `nproc` wasm JSONLY=yes
cp src/js-wasm/gs1encoder.mjs src/js-wasm/example.html src/js-wasm/example.mjs src/js-wasm/example.node.mjs src/c-lib/build-wasm/
cd src/c-lib/build-wasm
tar cvzf gs1encoders-jsonly-app.tgz gs1encoder-wasm.mjs.mem gs1encoder-wasm.mjs gs1encoder.mjs example.html example.mjs example.node.mjs
- name: Store JSONLY build
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v3
with:
name: jsonly-app
path: src/c-lib/build-wasm/gs1encoders-jsonly-app.tgz
#
# Create release and upload artifacts
#
create-release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs:
- ci-gcc
- ci-clang
- ci-msvc
- ci-macos
- ci-scan-build
- ci-java
- ci-wasm
- ci-jsonly
- ci-ios-app
- ci-android-app
- build-release-linux
- build-release-windows
- build-release-wasm
- build-release-jsonly
steps:
- name: Load Windows libs
uses: actions/download-artifact@v2
with:
name: windows-libs
- name: Load Windows console app
uses: actions/download-artifact@v2
with:
name: windows-console-app
- name: Load Windows GUI app
uses: actions/download-artifact@v2
with:
name: windows-gui-app
- name: Load Linux app
uses: actions/download-artifact@v2
with:
name: linux-app
- name: Load WASM app
uses: actions/download-artifact@v2
with:
name: wasm-app
- name: Load JSONLY app
uses: actions/download-artifact@v2
with:
name: jsonly-app
- name: Get version
id: get_version
run: |
VERSION=${GITHUB_REF/refs\/tags\//}
echo ::set-output name=VERSION::$VERSION
- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: ${{ steps.get_version.outputs.VERSION }}
draft: false
prerelease: false
- name: "Upload asset: Windows development libs"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: gs1encoders-windows-libs.zip
asset_name: gs1encoders-windows-libs.zip
asset_content_type: application/zip
- name: "Upload asset: Windows console application"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: gs1encoders-windows-console-app.zip
asset_name: gs1encoders-windows-console-app.zip
asset_content_type: application/zip
- name: "Upload asset: Windows GUI application"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: gs1encoders-windows-gui-app.zip
asset_name: gs1encoders-windows-gui-app.zip
asset_content_type: application/zip
- name: "Upload asset: Linux application"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: gs1encoders-linux-app.tgz
asset_name: gs1encoders-linux-app.tgz
asset_content_type: application/octet-stream
- name: "Upload asset: WASM applications (browser and Node.js)"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: gs1encoders-wasm-app.tgz
asset_name: gs1encoders-wasm-app.tgz
asset_content_type: application/octet-stream
- name: "Upload asset: JSONLY applications (browser and Node.js)"
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: gs1encoders-jsonly-app.tgz
asset_name: gs1encoders-jsonly-app.tgz
asset_content_type: application/octet-stream