-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
1051 lines (974 loc) · 35.2 KB
/
.gitlab-ci.yml
File metadata and controls
1051 lines (974 loc) · 35.2 KB
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
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# SPDX-License-Identifier: FSFAP
# Copyright (C) 2019 John Hsu
# Copyright (C) 2019-2026 Colin B. Macdonald
# Copyright (C) 2021 Peter Lee
# Copyright (C) 2021 Morgan Arnold
# Copyright (C) 2022-2023 Edith Coates
# Copyright (C) 2023 Natalie Balashov
# Copyright (C) 2023 Julian Lapenna
# Copyright (C) 2023-2024 Andrew Rechnitzer
# Copyright (C) 2024 Aidan Murphy
#
# Copying and distribution of this file, with or without modification,
# are permitted in any medium without royalty provided the copyright
# notice and this notice are preserved. This file is offered as-is,
# without any warranty.
# This the CI configuration for Plom Client
# Issue #1654: This stops multiple pipelines on merge-requests from forks
# But it seems to prevent forks from running their own CI jobs pre-MR
# include:
# - template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
# workflow:
# rules:
# - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
# - if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS'
# when: never
# - if: '$CI_COMMIT_BRANCH'
image: docker:28.5.2
services:
- docker:28.5.2-dind
variables:
DOCKER_DRIVER: overlay2
PLOM_NO_SSL_VERIFY: 1
MACBIN_PY_MAJOR_MINOR_VER: "3.12"
MACBIN_PY_VER: 3.12.9
QT_QPA_PLATFORM: offscreen
PYINSTALLER_VER: 6.16.0
stages:
- static_analysis
- build
- test
- packaging
- prep
- release
codespell:
image: python:3
stage: static_analysis
before_script:
- python3 -m pip install codespell~=2.4.2
script:
- echo "Need an exception? See the .codespell-ignore* files"
- codespell
allow_failure: true
artifacts:
reports:
dotenv: release_info.env
# sometimes we write everything twice: this job ensures dupe file/info stay same
wet_no_drift:
stage: static_analysis
image: alpine
before_script:
- apk add bash
script:
- echo "Version info duplicated in two places, ensure same"
- export VER0=`sed -nr 's/^__version__ = \"(.+)\"/\1/p' plomclient/client/__init__.py`
- export VER1=`sed -nr 's/^__version__ = \"(.+)\"/\1/p' plomclient/common.py`
- export VER2=`sed -nr 's/^\s+version. (.+)/\1/p' AppImageBuilder.yml`
- echo $VER0
- echo $VER1
- echo $VER2
- bash -c "[[ x$VER0 == x$VER1 ]]"
- bash -c "[[ x$VER0 == x$VER2 ]]"
# By default we assume the target is origin/main but if a MR is open,
# we try to determine the target branch and use that instead.
copyright_year:
image: fedora:42
stage: static_analysis
rules:
# Tags don't have this defined and non-empty. This job doesn't run on releases
- if: $CI_COMMIT_BRANCH
before_script:
- dnf install -y python3 glab git
- git --version
- glab --version
- echo $CI_COMMIT_TAG
- echo $CI_COMMIT_BRANCH
# Note that "upstream" is used as the local name for plom/plom-client
- git remote add upstream https://gitlab.com/plom/plom-client.git
- echo "Consider these various open merge requests"
- glab mr list --source-branch=$CI_COMMIT_BRANCH --repo=plom/plom-client
- read TARGET_REPO_NAME TARGET_BRANCH_NAME <<< $(./maint/find-MR-target-branch.py --source $CI_COMMIT_BRANCH --repo plom/plom-client --default "origin main")
# we expect to find at most one MR
- NUM_MRS=$(./maint/find-MR-target-branch.py --source $CI_COMMIT_BRANCH --repo plom/plom-client --default "origin main" | wc -l)
- TARGET_BRANCH=${TARGET_REPO_NAME}/${TARGET_BRANCH_NAME}
- echo "We think the target branch is '$TARGET_BRANCH'"
- echo "Next ensure we have that target branch for comparing"
# TODO: trying without --depth=1000
- git fetch ${TARGET_REPO_NAME} ${TARGET_BRANCH_NAME}
- git checkout ${TARGET_BRANCH}
# TODO: what is these are the same branch?
- git checkout $CI_COMMIT_BRANCH -- || true
- git branch -avv
script:
- echo "Considering the following commits to this branch (since '${TARGET_BRANCH}'):"
- git shortlog ${TARGET_BRANCH}..${CI_COMMIT_BRANCH} --
- echo "Those commits touch the following files:"
# git show --pretty="" --name-only ${TARGET_BRANCH}..${CI_COMMIT_BRANCH} -- | uniq -u
- git diff --name-only ${TARGET_BRANCH}...${CI_COMMIT_BRANCH} --
- ./maint/is-copyright-uptodate.py `git diff --name-only ${TARGET_BRANCH}...$CI_COMMIT_BRANCH --`
- echo "Note that there are some files that do not have/need copyright headers"
- if [ ${NUM_MRS} -gt 1 ]; then echo "'NUM_MRS' ('${NUM_MRS}' is greater than 1, exiting...)"; exit 1; fi
allow_failure: true
# modules (__init__ and __main__) should show current year in copyright
copyright_visible:
image: fedora
stage: static_analysis
script:
- YEAR=`date +"%Y"`
- echo $YEAR
- echo "Each new year, must bump some copyright notices"
- grep "© ....-${YEAR}" plomclient/client/about_dialog.py
- grep "__copyright__ = \"Copyright (C) ....-${YEAR}" plomclient/client/__init__.py
- grep "__copyright__ = \"Copyright (C) ....-${YEAR}" plomclient/client/__main__.py
- grep "__copyright__ = \"Copyright (C) ....-${YEAR}" plomclient/client/randoIDer.py
- grep "__copyright__ = \"Copyright (C) ....-${YEAR}" plomclient/client/randoMarker.py
# to ensure the pypi job works, make sure we can package
# TODO: we make these again during pypi push: better to use these artifacts?
build-package:
image: python:3
stage: build
script:
- pip install --upgrade build
- python3 -m build
- ls dist
- md5sum dist/*
# mv dist dist_TODO
artifacts:
paths:
# dist_TODO/plom*.tar.gz
# dist_TODO/plom*.whl
- dist/
expire_in: 16 days
# If we have a tag, then push to PyPI using OIDC, no TWINE_* env vars
# https://docs.pypi.org/trusted-publishers/using-a-publisher/#gitlab-cicd
pypi-publish:
image: python:3
stage: packaging
dependencies:
- build-package
rules:
- if: $CI_COMMIT_TAG
cache: {}
id_tokens:
PYPI_ID_TOKEN:
aud: pypi
script:
- apt update && apt install -y jq
- pip install --upgrade twine id
# pip install --upgrade wheel setuptools packaging build
# python3 -m build
- ls dist
- pushd dist
- md5sum *
- sha256sum *
- popd
# Retrieve the OIDC token from GitLab CI/CD, and exchange it for a PyPI API token
- oidc_token=$(python -m id pypi)
- resp=$(curl -X POST https://pypi.org/_/oidc/mint-token -d "{\"token\":\"${oidc_token}\"}")
- api_token=$(jq --raw-output '.token' <<< "${resp}")
# Upload to PyPI authenticating via the newly-minted token
- twine upload -u __token__ -p ${api_token} --verbose dist/*
release_job:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG
script:
- echo 'running release_job'
- echo "Draft of release notes follows (newlines eaten)"
- cat release_desc.md
- echo "Just debugging:"
- echo $LINKNAME0
- echo $URL0
- echo $FILENAME0
- echo $LINKNAME1
- echo $URL1
- echo $FILENAME1
- echo $LINKNAME2
- echo $URL2
- echo $FILENAME2
- echo $LINKNAME3
- echo $URL3
- echo $FILENAME4
release:
name: 'Release $CI_COMMIT_TAG'
description: './release_desc.md'
tag_name: '$CI_COMMIT_TAG'
ref: '$CI_COMMIT_TAG'
milestones:
# ${CI_COMMIT_TAG:1} might strip the leading v
- $CI_COMMIT_TAG
assets:
links:
- name: $LINKNAME0
filepath: "/$FILENAME0"
url: $URL0
link_type: "package"
- name: $LINKNAME1
filepath: "/$FILENAME1"
url: $URL1
link_type: "package"
- name: $LINKNAME2
filepath: "/$FILENAME2"
url: $URL2
link_type: "package"
- name: $LINKNAME3
filepath: "/$FILENAME3"
url: $URL3
link_type: "package"
- name: $OTHER_LINKNAME1
url: $OTHER_URL1
link_type: "other"
- name: $OTHER_LINKNAME2
url: $OTHER_URL2
link_type: "other"
- name: $OTHER_LINKNAME3
url: $OTHER_URL3
link_type: "other"
# block release unless tag matches in-source version
tag_matches_ver:
stage: static_analysis
image: python:3
rules:
- if: $CI_COMMIT_TAG
script:
- export VER=`sed -nr 's/^__version__ = \"(.+)\"/\1/p' plomclient/client/__init__.py`
- echo "Extracted version string '$VER'"
- echo "Now comparing to CI_COMMIT_TAG '$CI_COMMIT_TAG'"
- echo $VER
- echo $CI_COMMIT_TAG
# note reversed logic and extra "v"
- python3 -c "exit(not 'v$VER' == '$CI_COMMIT_TAG')"
# Should keep version same or close to that in .pre-commit-config.yaml
black:
stage: static_analysis
image: python:3.12
before_script:
- pip3 install "black~=25.12.0"
script:
- black --check --diff .
allow_failure: true
# image: python:3.12?
unittests:
stage: test
needs: []
image: ubuntu:24.04
before_script:
- apt-get -y update
- DEBIAN_FRONTEND=noninteractive apt-get -y install tzdata
- apt-get --no-install-recommends -y install
libpango-1.0-0 libpangocairo-1.0-0
python3
python3-pip
python3-setuptools
python3-wheel
python3-pytest python3-pytestqt
python3-pyqt6 python3-pyqt6.qtsvg pyqt6-dev-tools
python3-platformdirs python3-packaging python3-requests-toolbelt
python3-tomlkit python3-arrow
python3-pillow
- apt-get -yq autoclean
- pip install --break-system-packages pyspellchecker stdiomask
script:
- pytest --version
- pytest -l --pyargs plomclient
# TODO how to run only doctests? here we just ignore-glib on "test_*"
# pip install --upgrade pytest
- pytest --version
- pytest -l --doctest-modules --doctest-continue-on-failure --ignore-glob="*/test_*.py" plomclient
# TODO: from the Containerfile, maybe Ubuntu 22.04 needs this?
# apt-get --no-install-recommends -y install libglib2.0-0 libgl1-mesa-glx \
# libegl1 libxkbcommon0 libdbus-1-3 && \
coverage:
stage: test
needs: []
image: ubuntu:24.04
before_script:
- apt-get -y update
- DEBIAN_FRONTEND=noninteractive apt-get -y install tzdata
- apt-get --no-install-recommends -y install
libpango-1.0-0 libpangocairo-1.0-0
python3
python3-dev
python3-pip
python3-setuptools
python3-wheel
python3-pytest python3-pytestqt
python3-pyqt6 python3-pyqt6.qtsvg pyqt6-dev-tools
python3-platformdirs python3-packaging python3-requests-toolbelt
python3-tomlkit python3-arrow
python3-pillow
- apt-get -yq autoclean
- pip install --break-system-packages pyspellchecker stdiomask
script:
- pip install --break-system-packages pytest pytest-cov coverage[toml]~=7.13.4
- coverage run -m pytest
- coverage report --precision=2
- coverage xml
coverage: '/^TOTAL\s+.*\s(\d+\.\d+)%$/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
# needs full dependencies, cannot easily run with other early static analysis
pylint:
stage: test
needs: []
image: ubuntu:24.04
before_script:
- apt-get -y update
- DEBIAN_FRONTEND=noninteractive apt-get -y install tzdata
- apt-get --no-install-recommends -y install
libpango-1.0-0 libpangocairo-1.0-0
python3
python3-pip
python3-setuptools
python3-wheel
python3-pytest python3-pytestqt
python3-pyqt6 python3-pyqt6.qtsvg pyqt6-dev-tools
python3-platformdirs python3-packaging python3-requests-toolbelt
python3-tomlkit python3-arrow
python3-pillow
- apt-get -yq autoclean
- pip install --break-system-packages pyspellchecker stdiomask
- pip install --break-system-packages astroid~=4.1.1 # codespell:ignore astroid
- pip install --break-system-packages pylint~=4.0.5
script:
- pylint plomclient
allow_failure: true
# needs full dependencies, cannot easily run with other early static analysis
# If exceptions are needed, see "tool.mypy" sections in pyproject.toml
mypy-type-checking:
stage: test
needs: []
image: ubuntu:24.04
before_script:
- apt-get -y update
- DEBIAN_FRONTEND=noninteractive apt-get -y install tzdata
- apt-get --no-install-recommends -y install
libpango-1.0-0 libpangocairo-1.0-0
python3
python3-pip
python3-setuptools
python3-wheel
python3-pytest python3-pytestqt
python3-pyqt6 python3-pyqt6.qtsvg pyqt6-dev-tools
python3-platformdirs python3-packaging python3-requests-toolbelt
python3-tomlkit python3-arrow
python3-pillow
- apt-get -y install python3-tomli # else mypy fails, unsure why as Python 3.12
- apt-get -yq autoclean
- pip install --break-system-packages pyspellchecker stdiomask
# mypy was failing with the Ubuntu built-in one
- pip install --break-system-packages -U pillow
# mypy 1.17.x cannot check against Python 3.8 code
- pip install --break-system-packages mypy~=1.16.1
script:
- mypy --version
- export PIP_BREAK_SYSTEM_PACKAGES=1
- mypy plomclient --python-ver 3.8 --install-types --non-interactive || true
- mypy plomclient --python-ver 3.8
allow_failure: true
pyright:
stage: test
needs: []
image: ubuntu:24.04
before_script:
- apt-get -y update
- DEBIAN_FRONTEND=noninteractive apt-get -y install tzdata
- apt-get --no-install-recommends -y install
libpango-1.0-0 libpangocairo-1.0-0
python3
python3-pip
python3-setuptools
python3-wheel
python3-pytest python3-pytestqt
python3-pyqt6 python3-pyqt6.qtsvg pyqt6-dev-tools
python3-platformdirs python3-packaging python3-requests-toolbelt
python3-tomlkit python3-arrow
python3-pillow
- apt-get -yq autoclean
- pip install --break-system-packages pyspellchecker stdiomask
- pip install --break-system-packages pyright~=1.1.407
script:
# for now, just display errors but don't fail (Issue #3237)
- pyright || true
allow_failure: true
flake8:
image: python:3
stage: static_analysis
before_script:
- python3 -m pip install flake8~=7.3.0
script:
# first show all errors and warnings but don't fail
- flake8 --exit-zero
- flake8
# TODO: does this fully replace flake8?
# TODO: `ruff format` seems not completely compatible with black
ruff:
image: python:3
stage: static_analysis
before_script:
- python3 -m pip install ruff~=0.15.5
script:
- ruff check .
# ruff format .
# Note: $EXCEPTIONS matches an ignore list in pyproject.toml
count-no-docstring:
image: python:3
stage: static_analysis
before_script:
- python3 -m pip install ruff~=0.15.5
script:
# run once just for log out but don't fail
- EXCEPTIONS="D101,D102,D103,D104,D106"
- ruff check --select $EXCEPTIONS --exit-zero
- HOWMANY=`ruff check --select $EXCEPTIONS --exit-zero | grep "Found .* errors" | grep -o "[0-9]*"`
- echo $EXCEPTIONS
- ruff check --select $EXCEPTIONS --statistics --exit-zero
- echo "Total $HOWMANY things without docstrings, please don't increase it"
# Dear hackers: please try to decrease this number
- bash -c "[[ $HOWMANY -le 402 ]]"
allow_failure: true
appstream-valid:
stage: static_analysis
image: alpine
before_script:
- apk add appstream
- apk add appstream-glib
script:
- appstream-util --version || true
- appstream-util validate org.plomgrading.PlomClient.metainfo.xml
- appstreamcli --version
# TODO: consider adding --strict on 0.16.4 which supports <developer> tag
- appstreamcli validate --pedantic --explain org.plomgrading.PlomClient.metainfo.xml
# get latest pip deps, doesn't use docker, closer to user install
# allowed to fail (some pip stuff might be new) but we want to know
newOS_newdeps_legacy:
stage: test
image: ubuntu:22.04
allow_failure: true
before_script:
- apt-get update
- DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata curl
- apt-get --no-install-recommends --yes install
make g++ imagemagick
libgl1-mesa-glx libsm6 libxrender1 libegl1 libxkbcommon0 libdbus-1-3
libxcb-cursor0 libpango-1.0-0 libpangocairo-1.0-0
python3-pytest python3-dev
python3-pip
iproute2 psmisc file
# apt-get --no-install-recommends --yes install libimage-exiftool-perl
- python3 -m pip install --upgrade pip setuptools packaging wheel
- pip --version
script:
- pip install .
# First, run the unit tests
- pytest-3 -l --pyargs plomclient
# Ensure minimum listed dependency versions actually work on older system
# 1. oldest reasonably supported popular OS
# 2. take python deps from package manager
# 3. force the minimum version from setup.py
# Goal here is to catch changes that need newer features of a dependency.
oldOS_mindeps:
stage: test
image: ubuntu:20.04
before_script:
- apt-get update
- DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata curl
- apt-get --no-install-recommends --yes install
make g++ imagemagick
libgl1-mesa-glx libsm6 libxrender1 libegl1 libxkbcommon0 libdbus-1-3
libpango-1.0-0 libpangocairo-1.0-0
python3 python3-dev
python3-pip python3-setuptools python3-wheel
python3-requests-toolbelt python3-pil
python3-defusedxml python3-jsmin python3-packaging
iproute2 psmisc file
# TODO: is it possible to run with OOTB pip etc?
- python3 -m pip install --upgrade pip setuptools packaging wheel
- python3 -m pip --version
script:
- python3 -m pip install -r requirements.txt.tempminima
- python3 -m pip install .
# First, run the unit tests
- pytest -l --pyargs plomclient
# Minimum Python, minimum deps
minpy_mindeps:
stage: test
image: python:3.8
before_script:
- apt-get update
- apt-get --no-install-recommends --yes install
make imagemagick g++
libgl1-mesa-glx libsm6 libxrender1 libegl1 libxkbcommon0 libdbus-1-3
- pip install pytest
script:
- pip install -r requirements.txt.tempminima
- pip install .
- pytest -l --pyargs plomclient
# upload binaries are generic gitlab packages
binary_upload:
stage: prep
image: curlimages/curl:latest
rules:
- if: $CI_COMMIT_TAG
script:
- ls
- md5sum PlomClient*
- |
tee release_desc.md <<EOF
## Installation instructions
Please see [plomgrading.org](https://plomgrading.org).
If you're here looking for Clients, see "Plom Client" packages above.
#### macOS versions
We build binaries for macOS using macOS 14. They might also work on macOS 13.
Users of older versions of macOS will need to upgrade their OS.
#### Changes in this release
See [the Changelog](https://gitlab.com/plom/plom-client/-/blob/$CI_COMMIT_TAG/CHANGELOG.md).
EOF
# strip the leading v in v0.x.y: don't see how to do this without dotenv
- export VER=${CI_COMMIT_TAG:1}
- echo $VER
- export LINKNAME0="Plom Client for GNU/Linux (AppImage)"
- export LINKNAME1="Plom Client for Windows (Windows ≥ 10, x86-64)"
- export LINKNAME2="Plom Client for older Mac (x86_64, macOS ≥ 14)"
- export LINKNAME3="Plom Client for newer Mac (arm64, macOS ≥ 14)"
- export FILENAME0="PlomClient-$VER-x86_64.AppImage"
- export FILENAME1="PlomClient-$VER.exe"
- export FILENAME2="PlomClient-$VER-macos14-x86_64.zip"
- export FILENAME3="PlomClient-$VER-macos14-arm64.zip"
- echo "#### artifact md5 hashes" >> "release_desc.md"
- echo "" >> "release_desc.md"
- md5sum dist/plom*.tar.gz | sed -e "s/^/ /" | sed -e "s/dist\///" >> "release_desc.md"
- md5sum $FILENAME0 | sed -e "s/^/ /" >> "release_desc.md"
- md5sum $FILENAME1 | sed -e "s/^/ /" >> "release_desc.md"
- md5sum $FILENAME2 | sed -e "s/^/ /" >> "release_desc.md"
- md5sum $FILENAME3 | sed -e "s/^/ /" >> "release_desc.md"
- echo "" >> "release_desc.md"
- echo "" >> "release_desc.md"
- echo "#### artifact sha256 hashes" >> "release_desc.md"
- echo "" >> "release_desc.md"
- sha256sum dist/plom*.tar.gz | sed -e "s/^/ /" | sed -e "s/dist\///" >> "release_desc.md"
- sha256sum $FILENAME0 | sed -e "s/^/ /" >> "release_desc.md"
- sha256sum $FILENAME1 | sed -e "s/^/ /" >> "release_desc.md"
- sha256sum $FILENAME2 | sed -e "s/^/ /" >> "release_desc.md"
- sha256sum $FILENAME3 | sed -e "s/^/ /" >> "release_desc.md"
- export URL0="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/PlomClient-linux/$VER/$FILENAME0"
- export URL1="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/PlomClient-windows/$VER/$FILENAME1"
- export URL2="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/PlomClient-macos/$VER/$FILENAME2"
- export URL3="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/PlomClient-macos/$VER/$FILENAME3"
- export OTHER_URL1="https://pypi.org/project/plom-client"
- export OTHER_URL2="https://flathub.org/apps/details/org.plomgrading.PlomClient"
- export OTHER_URL3="https://hub.docker.com/r/plomgrading/server"
- export OTHER_LINKNAME1="Find Plom Client on PyPI"
- export OTHER_LINKNAME2="Install Plom Client from Flathub (GNU/Linux)"
- export OTHER_LINKNAME3="Plom Server on DockerHub"
- echo "OTHER_URL1=$OTHER_URL1" >> release_info.env
- echo "OTHER_URL2=$OTHER_URL2" >> release_info.env
- echo "OTHER_URL3=$OTHER_URL3" >> release_info.env
- echo "OTHER_LINKNAME1=$OTHER_LINKNAME1" >> release_info.env
- echo "OTHER_LINKNAME2=$OTHER_LINKNAME2" >> release_info.env
- echo "OTHER_LINKNAME3=$OTHER_LINKNAME3" >> release_info.env
- echo "LINKNAME0=$LINKNAME0" >> release_info.env
- echo "LINKNAME1=$LINKNAME1" >> release_info.env
- echo "LINKNAME2=$LINKNAME2" >> release_info.env
- echo "LINKNAME3=$LINKNAME3" >> release_info.env
- echo "URL0=$URL0" >> release_info.env
- echo "URL1=$URL1" >> release_info.env
- echo "URL2=$URL2" >> release_info.env
- echo "URL3=$URL3" >> release_info.env
- echo "FILENAME0=$FILENAME0" >> release_info.env
- echo "FILENAME1=$FILENAME1" >> release_info.env
- echo "FILENAME2=$FILENAME2" >> release_info.env
- echo "FILENAME3=$FILENAME3" >> release_info.env
# actually do the uploads
- |
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file $FILENAME0 "$URL0"
- |
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file $FILENAME1 "$URL1"
- |
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file $FILENAME2 "$URL2"
- |
curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file $FILENAME3 "$URL3"
- cat release_desc.md
artifacts:
paths:
- release_desc.md
reports:
dotenv: release_info.env
expire_in: 16 days
# Build Client Binaries
# These are run once tests pass: to change re-add `needs: []`
linux_client_appimage:
stage: packaging
script:
- docker build --tag appimagebuilder_tmp -f AppImageBuilder.Containerfile .
- docker create -ti --name dummy appimagebuilder_tmp bash
- export VER=`sed -nr 's/^__version__ = \"(.+)\"/\1/p' plomclient/client/__init__.py`
- export NAME=PlomClient-$VER-x86_64.AppImage
- docker cp dummy:/app/$NAME .
- docker rm -f dummy
- md5sum $NAME > md5sum
- ls $NAME
- cat md5sum
artifacts:
paths:
- PlomClient*.AppImage
- md5sum
expire_in: 16 days
# TODO: broken by the upgrade to PyQt6, currently set to manual
linuxbin_ubuntu2004:
stage: packaging
when: manual
allow_failure: true
image: ubuntu:20.04
before_script:
- apt-get update
- DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata curl
- apt-get --no-install-recommends --yes install iproute2 psmisc file binutils
python3 python3-dev python3-wheel python3-setuptools python3-pip
- apt-get install -y libglib2.0 libgl1-mesa-glx libsm6 libxrender1 libegl1 libxkbcommon0 libdbus-1-3 libxcb-cursor0
- pip install --upgrade pip
- pip install pyinstaller~=$PYINSTALLER_VER
script:
- pip install -r requirements.txt
- pyinstaller client.linux.spec
- export VER=$(python3 -c "from plomclient.client import __version__; print(__version__)")
- echo "Extracted version string '$VER'"
- export NAME=PlomClient-$VER-linux-ubuntu2004.bin
- mv dist/PlomClient*.bin $NAME
- chmod 755 $NAME
- md5sum $NAME > md5sum
- ls $NAME
- cat md5sum
artifacts:
paths:
- PlomClient*.bin
- md5sum
expire_in: 16 days
linuxbin_ubuntu2204:
stage: packaging
image: ubuntu:22.04
before_script:
- apt-get update
- DEBIAN_FRONTEND=noninteractive apt-get install -y tzdata curl
- apt-get --no-install-recommends --yes install iproute2 psmisc file binutils
python3 python3-dev python3-wheel python3-setuptools python3-pip
- apt-get --yes install
libglib2.0-0
libxkbcommon0 libgl1 libegl1
libgl1-mesa-glx libsm6 libxrender1 libdbus-1-3
libxcb-cursor0 libpango-1.0-0 libpangocairo-1.0-0
- pip install --upgrade pip
- pip install pyinstaller~=$PYINSTALLER_VER
- pip install . --no-deps # pyinstaller spec needs version
script:
- pip install -r requirements.txt
- pyinstaller client.linux.spec
- export VER=$(python3 -c "from plomclient.client import __version__; print(__version__)")
- echo "Extracted version string '$VER'"
# ensure its not empty
- if [[ -z "$VER" ]]; then exit 1; fi
- export NAME=PlomClient-$VER-linux-ubuntu2204.bin
- mv dist/PlomClient*.bin $NAME
- chmod 755 $NAME
- md5sum $NAME > md5sum
- ls $NAME
- cat md5sum
artifacts:
paths:
- PlomClient*.bin
- md5sum
expire_in: 16 days
# Notes on macOS client builds
# - June 2023, we now have only M1 (arm64) runners:
# - goal remains universal2 binary: Issue #1655
# - for now, we use Rosetta2 to cross compile onto x86_64
# - Aug 2021, based on https://github.com/danhper/asdf-python/issues/38 we used:
# - PYTHON_CONFIGURE_OPTS="--enable-framework" asdf install python $MACBIN_PY_VER
# Not sure what this was for but it broke in 2023-Jan (Issue #2478). I tried:
# "--enable-framework=/Users/gitlab/.asdf/installs/Library/Frameworks" asdf ...
# Also "--enable-shared", but it seems to work without any of these things?
# - macOS <= 10.14: older asdf, use `asdf local` not `asdf shell`
# - to get hardcoded path: verbose `pip install -v -v pyinstaller`
macos14_universal_client:
image: macos-14-xcode-15
tags:
- saas-macos-medium-m1
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- if: $CI_PROJECT_PATH == "plom/plom-client"
when: manual
allow_failure: true
stage: packaging
needs: []
variables:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
MINIMUM_MACOS_VER: 14
script:
- pwd
- sw_vers
- uname -a
- uname -m
- echo $SHELL
- which python
- python --version
- pip --version
- uname -m
- arch -x86_64 uname -m
- brew --version
- brew install ninja
- brew install numpy
# quite likely the built-in python would work... but below we install latest
- arch -x86_64 /usr/bin/python3 --version
- arch -arm64 /usr/bin/python3 --version
- /usr/bin/python3 -m pip --version
# install specific python
- curl https://www.python.org/ftp/python/$MACBIN_PY_VER/python-$MACBIN_PY_VER-macos11.pkg --output python.pkg
- sudo installer -pkg python.pkg -target /
- python3 --version
- /usr/bin/python3 --version
- /usr/local/bin/python3 --version
- arch -x86_64 /usr/local/bin/python3 --version
- /usr/local/bin/python3 -m pip install --upgrade pip
- which pip
- which pip3
- pip --version
# hacks for charset_normalizer, following https://github.com/machawk1/wail/pull/562/
- arch -x86_64 /usr/local/bin/python3 -m pip install "charset_normalizer<3.0"
# /usr/local/bin/python3 -m pip install "charset_normalizer<3.0"
# arch -x86_64 /usr/local/bin/python3 -m pip install Pillow --no-binaries
# numpy fails complaining about blas, try from brew instead?
# /usr/local/bin/python3 -m pip install numpy --no-binary ":all:"
- /usr/local/bin/python3 -m pip install Pillow --no-binary ":all:"
- /usr/local/bin/python3 -m pip install -r requirements.txt
- arch -x86_64 /usr/local/bin/python3 -m pip install -r requirements.txt
- /usr/local/bin/python3 -m pip install pyinstaller~=$PYINSTALLER_VER
- /usr/local/bin/python3 -m pip install . --no-deps # pyinstaller spec needs version
- /Library/Frameworks/Python.framework/Versions/${MACBIN_PY_MAJOR_MINOR_VER}/bin/pyinstaller client.macos-universal2.spec
- ls dist/
- export VER=`sed -nr 's/^__version__ = \"(.+)\"/\1/p' plomclient/client/__init__.py`
- echo "Extracted version string '$VER'"
# ensure its not empty
- if [[ -z "$VER" ]]; then exit 1; fi
- export ZIPNAME=PlomClient-$VER-macos14.zip
- pushd dist
- ls
- ls -sklR PlomClient-$VER-universal2.app
- zip -r $ZIPNAME PlomClient-$VER.app
- popd
- mv dist/$ZIPNAME $ZIPNAME
- md5 $ZIPNAME > md5sum
- ls $ZIPNAME
- cat md5sum
artifacts:
paths:
- PlomClient*.zip
- md5sum
expire_in: 16 days
macos14_arm64_client:
image: macos-14-xcode-15
tags:
- saas-macos-medium-m1
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- if: $CI_PROJECT_PATH == "plom/plom-client"
stage: packaging
variables:
# Maybe it works on macOS 13...?
MINIMUM_MACOS_VER: 13
script:
- pwd
- sw_vers
- uname -a
- uname -m
- echo $SHELL
- which python
- python --version
- pip --version
- uname -m
- /usr/bin/python3 -m pip --version
- curl https://www.python.org/ftp/python/$MACBIN_PY_VER/python-$MACBIN_PY_VER-macos11.pkg --output python.pkg
- sudo installer -pkg python.pkg -target /
- python3 --version
- /usr/bin/python3 --version
- /usr/local/bin/python3 --version
- /usr/local/bin/python3 -m pip install --upgrade pip
- /usr/local/bin/python3 -m pip install -r requirements.txt
- /usr/local/bin/python3 -m pip install pyinstaller~=$PYINSTALLER_VER
- /usr/local/bin/python3 -m pip install . --no-deps # pyinstaller spec needs version
- /Library/Frameworks/Python.framework/Versions/${MACBIN_PY_MAJOR_MINOR_VER}/bin/pyinstaller client.macos.spec
- ls dist/
- export VER=`sed -nr 's/^__version__ = \"(.+)\"/\1/p' plomclient/client/__init__.py`
- echo "Extracted version string '$VER'"
# ensure its not empty
- if [[ -z "$VER" ]]; then exit 1; fi
- export ZIPNAME=PlomClient-$VER-macos14-arm64.zip
- pushd dist
- ls
- ls -sklR PlomClient-$VER-arm64.app
- zip -r $ZIPNAME PlomClient-$VER-arm64.app
- popd
- mv dist/$ZIPNAME $ZIPNAME
- md5 $ZIPNAME > md5sum
- ls $ZIPNAME
- cat md5sum
artifacts:
paths:
- PlomClient*.zip
- md5sum
expire_in: 16 days
macos14_x86_64_client:
image: macos-14-xcode-15
tags:
- saas-macos-medium-m1
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- if: $CI_PROJECT_PATH == "plom/plom-client"
stage: packaging
variables:
# 2025-10-07: Colin tested on x86_64 macOS 13.7.4.
MINIMUM_MACOS_VER: 13
script:
- pwd
- sw_vers
- uname -a
- uname -m
- echo $SHELL
- which python
- python --version
- pip --version
- uname -m
- arch -x86_64 uname -m
# quite likely the built-in python would work... but below we install latest
- arch -x86_64 /usr/bin/python3 --version
# install specific python
- curl https://www.python.org/ftp/python/$MACBIN_PY_VER/python-$MACBIN_PY_VER-macos11.pkg --output python.pkg
- sudo installer -pkg python.pkg -target /
- python3 --version
- /usr/bin/python3 --version
- /usr/local/bin/python3 --version
- arch -x86_64 /usr/local/bin/python3 --version
- arch -x86_64 /usr/local/bin/python3 -m pip install --upgrade pip
# hacks for charset_normalizer, following https://github.com/machawk1/wail/pull/562/
- arch -x86_64 /usr/local/bin/python3 -m pip install "charset_normalizer<3.0"
- arch -x86_64 /usr/local/bin/python3 -m pip install -r requirements.txt
- arch -x86_64 /usr/local/bin/python3 -m pip install pyinstaller~=$PYINSTALLER_VER
- arch -x86_64 /usr/local/bin/python3 -m pip install . --no-deps # pyinstaller spec needs version
- arch -x86_64 /Library/Frameworks/Python.framework/Versions/${MACBIN_PY_MAJOR_MINOR_VER}/bin/pyinstaller client.macos-x86_64.spec
- ls dist/
- export VER=`sed -nr 's/^__version__ = \"(.+)\"/\1/p' plomclient/client/__init__.py`
- echo "Extracted version string '$VER'"
# ensure its not empty
- if [[ -z "$VER" ]]; then exit 1; fi
- export ZIPNAME=PlomClient-$VER-macos14-x86_64.zip
- pushd dist
- ls
- ls -sklR PlomClient-$VER-x86_64.app
- zip -r $ZIPNAME PlomClient-$VER-x86_64.app
- popd
- mv dist/$ZIPNAME $ZIPNAME
- md5 $ZIPNAME > md5sum
- ls $ZIPNAME
- cat md5sum
artifacts:
paths:
- PlomClient*.zip
- md5sum
expire_in: 16 days
macos15_arm64_client:
image: macos-15-xcode-16
tags:
- saas-macos-medium-m1
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- if: $CI_PROJECT_PATH == "plom/plom-client"
stage: packaging
variables:
MINIMUM_MACOS_VER: 15
script:
- pwd
- sw_vers
- uname -a
- uname -m
- echo $SHELL
- which python
- python --version
- pip --version
- uname -m
- /usr/bin/python3 -m pip --version
- curl https://www.python.org/ftp/python/$MACBIN_PY_VER/python-$MACBIN_PY_VER-macos11.pkg --output python.pkg
- sudo installer -pkg python.pkg -target /
- python3 --version
- /usr/bin/python3 --version
- /usr/local/bin/python3 --version
- /usr/local/bin/python3 -m pip install --upgrade pip
- /usr/local/bin/python3 -m pip install -r requirements.txt
- /usr/local/bin/python3 -m pip install pyinstaller~=$PYINSTALLER_VER
- /usr/local/bin/python3 -m pip install . --no-deps # pyinstaller spec needs version
- /Library/Frameworks/Python.framework/Versions/${MACBIN_PY_MAJOR_MINOR_VER}/bin/pyinstaller client.macos.spec
- ls dist/
- export VER=`sed -nr 's/^__version__ = \"(.+)\"/\1/p' plomclient/client/__init__.py`
- echo "Extracted version string '$VER'"
# ensure its not empty
- if [[ -z "$VER" ]]; then exit 1; fi
- export ZIPNAME=PlomClient-$VER-macos15-arm64.zip
- pushd dist
- ls