-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
969 lines (880 loc) · 30.4 KB
/
.gitlab-ci.yml
File metadata and controls
969 lines (880 loc) · 30.4 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
# 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-2025 Andrew Rechnitzer
# Copyright (C) 2024-2025 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
# 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
# $CI_REGISTRY_IMAGE is:
# registry.gitlab.com/plom/plom
variables:
DOCKER_DRIVER: overlay2
IM: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
IM_LATEST: $CI_REGISTRY_IMAGE:latest
PLOM_NO_SSL_VERIFY: 1
QT_QPA_PLATFORM: offscreen
PLOMCLIENT_BRANCHNAME: main
stages:
- static_analysis
- build
- alt_build
- test
- packaging
- prep
- release
# Attention maintainers: if you start to see errors in the CI runs like:
# E: Failed to fetch http://security.ubuntu.com... 404 Not Found [IP: 91...]
# Run with DOCKER_USE_CACHE set to 0, under Pipeline -> Run pipeline
container-image:
stage: build
script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- echo $DOCKER_USE_CACHE
- >
if [ "$DOCKER_USE_CACHE" == "1" ]; then
docker pull $IM_LATEST || true
fi
- >
if [ "$DOCKER_USE_CACHE" == "1" ]; then
docker build --cache-from $IM_LATEST --tag $IM . -f Containerfile
else
docker build --tag $IM . -f Containerfile
fi
- docker push $IM
# Get fast results by running tests in a copy-pasta of the container-image job
# TODO: why is this failing? check if client-building works by commenting out
# quick-pytests:
# stage: build
# needs: []
# script:
# - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
# - docker pull $IM_LATEST || true
# - docker build --cache-from $IM_LATEST --tag $IM .
# - docker run $IM pytest-3 -l --pyargs plom
codespell:
image: python:3
stage: static_analysis
before_script:
- 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 "Issue #2402: ensure two identical copies of the latex template"'
- diff -s plom/latexTemplate.tex testTemplates/latexTemplate.tex
- diff -s plom/latexTemplatev2.tex testTemplates/latexTemplatev2.tex
- echo "If version info duplicated, ensure same"
- export VER0=`sed -nr 's/^__version__ = \"(.+)\"/\1/p' plom/common.py`
- echo $VER0
- export VER1=`sed -nr 's/^__version__ = \"(.+)\"/\1/p' plom_server/__init__.py`
- echo $VER1
- bash -c "[[ x$VER0 == x$VER1 ]]"
wet_css_js_3rd_party:
stage: static_analysis
image: python:3
before_script:
- pip install requests
script:
- python3 plom_server/get_js.py
- ls plom_extra_static/js3rdparty/
- ls plom_extra_static/css3rdparty/
# 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:43
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
# Note that "upstream" is used as the local name for plom/plom
- git remote add upstream https://gitlab.com/plom/plom.git
- echo "Consider these various open merge requests"
- glab mr list --source-branch=$CI_COMMIT_BRANCH --repo=plom/plom
- read TARGET_REPO_NAME TARGET_BRANCH_NAME <<< $(./maint/find-MR-target-branch.py --source $CI_COMMIT_BRANCH --repo plom/plom --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 --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"
- git fetch ${TARGET_REPO_NAME} ${TARGET_BRANCH_NAME}
- git checkout ${TARGET_BRANCH}
- git checkout $CI_COMMIT_BRANCH --
- 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
djlint:
image: python:3
stage: static_analysis
before_script:
- pip install djlint~=1.36.4
script:
- djlint plom_server/templates/*/*.html plom_server/templates/*/*/*.html --profile django
djlint-check:
image: python:3
stage: static_analysis
before_script:
- pip install djlint~=1.36.4
script:
- djlint plom_server/templates/*/*.html plom_server/templates/*/*/*.html --check
# If on main branch, tag earlier image as "latest" (in Gitlab Container Registry)
# TODO: Issue #3573: did adding `tags` here make this run during the big release on tags pipeline?
gitlab-container-registry-tag-latest:
stage: packaging
needs: ["container-image"]
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script:
- docker pull $IM
- docker tag $IM $IM_LATEST
- docker push $IM_LATEST
only:
- main
- tags
# push to the image to the docker.io container registry, using credentials from GitLab's secrets
push-to-docker-io:
stage: prep
rules:
- if: $CI_COMMIT_TAG
before_script:
- docker login -u $REGISTRY_USER_DOCKER_IO -p $REGISTRY_PASSWORD_DOCKER_IO docker.io
script:
- echo $CI_COMMIT_TAG
- docker pull $IM
# strip the leading v in vx.y.z
- export VER=${CI_COMMIT_TAG:1}
# strip the .z in x.y.z
- export VER_MINOR=`echo $VER | sed -e "s/^\(\d*\.\d*\).\d*/\1/"`
- docker tag $IM plomgrading/server:$VER
- docker tag plomgrading/server:$VER plomgrading/server:$VER_MINOR
- docker tag plomgrading/server:$VER plomgrading/server:latest
- docker push plomgrading/server:$VER
- docker push plomgrading/server:$VER_MINOR
- docker push plomgrading/server:latest
# to ensure the pypi job works, make sure we can package
# TODO: we make these again during pypi push: better to use these artifacts?
make_package:
image: python:3.12
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
expire_in: 16 days
# If we have a tag, then push to PyPI using TWINE_* env vars
# Debug: `upload -r testpypi`, comment `only`, change and unprotect token
# TODO: maybe we can bring the artifacts we built earlier in `make_package`?
pypi:
image: python:3.12
stage: packaging
rules:
- if: $CI_COMMIT_TAG
cache: {}
script:
- pip install --upgrade twine wheel setuptools packaging build
- python3 -m build
- ls dist
- pushd dist
- md5sum *
- sha256sum *
- popd
- python3 -m twine check dist/*
- python3 -m twine upload --verbose dist/*
artifacts:
paths:
- dist/plom-*.tar.gz
expire_in: 16 days
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
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: $OTHER_LINKNAME1
url: $OTHER_URL1
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' plom_server/__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
unittests:
stage: test
needs: ["container-image"]
image: $IM
script:
- pytest-3 -l --pyargs plom
# TODO: may consider merging with unittests job above
# Issue #2291: fix coverage calculations for plom_server/
coverage:
stage: test
needs: ["container-image"]
image: $IM
script:
- pip install pytest pytest-cov coverage[toml]~=7.13.4
- coverage run -m pytest --ignore plom_server
- coverage report --precision=2
- coverage xml
coverage: '/^TOTAL\s+.*\s(\d+\.\d+)%$/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: coverage.xml
# Notes:
# masked out some stuff that deps on tensorflow
doctests:
stage: test
needs: ["container-image"]
image: $IM
before_script:
- pip install --ignore-installed -U pytest
script:
# TODO how to run only doctests? here we just ignore-glib on "test_*"
- pytest --version
- pytest -l --doctest-modules --doctest-continue-on-failure --ignore-glob="*digitHunter.py" --ignore-glob="*/test_*.py" plom
# Ensure the migrations have been updated
# needs full dependencies, cannot easily run with other early static analysis
# Note to devs: if this job is failing, it probably means you have made database changes.
# You should probably run `./maint/maint-wipe-rebuild-migrations.sh` and commit the results.
migrations-uptodate:
stage: test
needs: ["container-image"]
image: $IM
before_script:
- apt-get update
- apt-get --no-install-recommends --yes install git
- pip install black
script:
- PYTHONPATH=. python3 manage.py makemigrations --update --check
- echo "Now check we can wipe and rebuild migrations"
- ./maint/maint-wipe-rebuild-migrations.sh
- echo "We expect there to be no changes - its a potential problem if there are"
- git diff
- echo "So we measure the length of the diff"
- DIFF_LENGTH=`git diff | wc -l`
- echo $DIFF_LENGTH
- echo "... and the test fails if the diff is too long"
- bash -c "[[ $DIFF_LENGTH -le 5 ]]"
# needs full dependencies, cannot easily run with other early static analysis
pylint:
stage: test
needs: ["container-image"]
image: $IM
before_script:
- pip install astroid~=4.1.1 # codespell:ignore astroid
- pip install pylint~=4.0.5
script:
- pylint plom
- pylint plom_server
- pylint plom_ml
- pylint contrib
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
# Note: currently allowed to fail because of partial adoption of type hints and safety in this project.
# Will make not allowed to fail in the future, once types are more widely adopted in the project.
mypy-type-checking:
stage: test
needs: ["container-image"]
image: $IM
before_script:
- pip install mypy~=1.19.1
script:
- mypy --version
- mypy plom plom_server --python-ver 3.10 --install-types --non-interactive || true
- mypy plom plom_server --python-ver 3.10
- mypy plom_ml --python-ver 3.10 --install-types --non-interactive || true
- mypy plom_ml --python-ver 3.10
allow_failure: true
pyright:
stage: test
needs: ["container-image"]
image: $IM
before_script:
- pip install pyright~=1.1.408
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:
- 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:
- 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:
- pip install ruff~=0.15.5
script:
- EXCEPTIONS="D101,D102,D103,D104"
# run once just for log out but don't fail
- 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 635 ]]"
allow_failure: true
# Detect if someone adds a model but forget to add it to the admin interface
# TODO: we could use our own container image and then use:
# from django.apps import apps
# apps.get_models()
# This would avoid the complexities of subclasses
models-in-admin:
image: ubuntu
stage: static_analysis
before_script:
- apt-get update
- apt-get install --no-install-recommends --yes ripgrep colordiff less
script:
- pushd plom_server
- rg models.Model .
- rg admin.site.register .
- rg "admin.site.register\((.*)\)" . -r "\$1" --no-filename | sort > in_admin.txt
- rg "class (.*)\(models.Model\):" . -r "\$1" --no-filename
- SUPERCLASSES="models.Model Tag HueyTaskTracker SingletonABCModel"
- for SUPER in $SUPERCLASSES; do
rg "class (.*)\($SUPER\):" . -r "\$1" --no-filename >> models1.txt;
done
- cat models1.txt | sort > models2.txt
# Special cases, ABCs cannot be in admin site
- cat models2.txt | grep -v SingletonABCModel | grep -v "^Tag" > models3.txt
# Special case, TmpAbstractQuestion uses decorator
- cat models3.txt | grep -v TmpAbstractQuestion > models.txt
- HOW_MANY_MODELS=`cat models.txt | wc -l`
- HOW_MANY_IN_ADMIN=`cat in_admin.txt | wc -l`
- echo $HOW_MANY_MODELS
- echo $HOW_MANY_IN_ADMIN
- echo "Models NOT in the admin site appear in red"
- diff -u100 models.txt in_admin.txt | cdiff
no-question-numbers:
image: python:3.12
stage: static_analysis
script:
# TODO: consider adding "plom" here too
- grep plom_server -rie "question.num" || true
- echo "Question number is ambiguous; generally we prefer index or the question label"
- HOW_MANY=`grep plom_server -rie "question.num" | wc -l || true`
# For now, just ensure the total does not increase
- echo $HOW_MANY
# Future hackers: consider trying to decrease this number
- bash -c "[[ $HOW_MANY -le 0 ]]"
allow_failure: true
eslint:
image: node:24
stage: static_analysis
script:
- npm install [email protected] globals @eslint/[email protected] @stylistic/eslint-plugin
- npx eslint plom_server/**/*.js
webplom_test:
stage: test
needs: ["container-image"]
image: $IM
before_script:
- pip install coverage~=7.13.4
- pip install pytest pytest-mock pytest-django
script:
- export PYTHONPATH=$PWD
- export PLOM_DATABASE_BACKEND=sqlite
# need to migrate before tests but probably not makemigrations (Issue #3826)
# python3 manage.py makemigrations
- python3 manage.py migrate
- coverage run --source="." manage.py test
# -i ignores an error caused by openCV's config-3.py file
- coverage report -i --precision=2
- coverage xml -i -o django_coverage.xml
coverage: '/^TOTAL\s+.*\s(\d+\.\d+)%$/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: django_coverage.xml
webplom_api_test:
stage: test
needs: ["container-image"]
image: $IM
before_script:
- pip install coverage~=7.13.4
- pip install pytest pytest-mock pytest-django
script:
- export PYTHONPATH=$PWD
- export PLOM_DATABASE_BACKEND=sqlite
- export DJANGO_SETTINGS_MODULE=plom_server.settings
# migrate the test database (skip makemigrations per #3826)
- python3 manage.py migrate
# run only the API tests and collect coverage for plom_server/API
- coverage run --source=plom_server/API -m pytest plom_server/API/tests
# ignore any coverage errors (e.g. OpenCV) and print summary
- coverage report -i --precision=2
# output Cobertura XML for GitLab
- coverage xml -i -o django_api_coverage.xml
coverage: '/^TOTAL\s+.*\s(\d+\.\d+)%$/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: django_api_coverage.xml
webplom_demo:
services:
- postgres
variables:
POSTGRES_DB: "plom_db"
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "postgres"
POSTGRES_HOST_AUTH_METHOD: trust
PLOM_DATABASE_HOSTNAME: "postgres"
stage: test
needs: ["container-image"]
image: $IM
before_script:
- apt-get update
- apt-get --no-install-recommends --yes install git
# pip install plom-client
# but we might need a more recent one if API recently changed
- pip install -U git+https://gitlab.com/plom/plom-client.git@$PLOMCLIENT_BRANCHNAME
script:
- export PYTHONPATH=$PWD
- echo $PYTHONPATH
- ./plom_server/scripts/launch_plom_demo_server.py --length quick --stop-after reports
# ensure we can run the code somewhere other than inside itself!
out-of-tree:
services:
- postgres
variables:
POSTGRES_DB: "plom_db"
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "postgres"
POSTGRES_HOST_AUTH_METHOD: trust
PLOM_DATABASE_HOSTNAME: "postgres"
stage: test
needs: ["container-image"]
image: $IM
script:
- cd ${HOME}
- mkdir somewhere
- pushd somewhere
- export DJANGO_SETTINGS_MODULE=plom_server.settings
- django-admin --version
- django-admin -h
- django-admin -h | grep plom
- django-admin plom_preparation_spec -h
- django-admin test plom_server
- popd
allow_failure: true
# ensure we can run the code somewhere other than inside itself!
out-of-tree-scratch:
services:
- postgres
variables:
POSTGRES_DB: "plom_db"
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "postgres"
POSTGRES_HOST_AUTH_METHOD: trust
PLOM_DATABASE_HOSTNAME: "postgres"
stage: alt_build
needs: []
image: fedora:43
# when: manual
before_script:
- dnf install -y --setopt=install_weak_deps=False
gcc gcc-c++ cmake
latexmk tex-dvipng texlive-scheme-basic
tex-preview tex-charter tex-exam tex-preprint
python3-devel
python3-passlib python3-pyqt6
python3-jsmin python3-defusedxml python3-yaml
python3-urllib3 python3-more-itertools
python3-seaborn python3-pandas python3-requests-toolbelt
python3-pip python3-wheel python3-setuptools
python3-tomlkit python3-pillow python3-tqdm
python3-appdirs python3-arrow
python3-cryptography
python3-zxing-cpp
python3-psycopg3
python3-pytest
python3-PyMuPDF
python3-PyMySQL
python3-scikit-learn python3-scikit-image
python3-numpy python3-scipy
python3-weasyprint python3-whitenoise
python3-huggingface-hub python3-onnxruntime
file python3-file-magic
iproute
- pip --version
script:
# temporary, see https://gitlab.com/plom/plom/-/merge_requests/1634
- pip install --ignore-installed -U pytest
# TODO: python3-django doesn't work, unsure why, instead get from pip (Issue #3830)
- pip install django
- pwd
- ls
# install twice, first for dependencies
- pip install .
- pwd
- cd ${HOME}
- mkdir somewhere
- pushd somewhere
- python3 -c "import plom_server; print(plom_server.__version__); print(plom_server.__path__)"
- export DJANGO_SETTINGS_MODULE=plom_server.settings
- django-admin --version
- django-admin -h
- django-admin -h | grep plom
- django-admin plom_preparation_spec -h
- django-admin test plom_server
- popd
allow_failure: true
# TODO: perhaps all deps should be in the docker image?
# Commented-out latex/pdf for now as unused (and a bit slow?)
docs_sphinx:
stage: test
needs: ["container-image"]
image: $IM
before_script:
- apt-get update
- apt-get --no-install-recommends --yes install tex-gyre
- pip install -r doc/requirements.txt
script:
- pushd doc
- ls
- make autodocs
- make html
- make linkcheck
# make latexpdf
- popd
artifacts:
paths:
# doc/build/latex/plom.pdf
- doc/build/html/
expire_in: 16 days
# 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
# TODO: `dnf install python3-opencv`, and `sed` out the setup.py dep
fedora-django-tests:
services:
- postgres
variables:
POSTGRES_DB: "plom_db"
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "postgres"
POSTGRES_HOST_AUTH_METHOD: trust
PLOM_DATABASE_HOSTNAME: "postgres"
stage: alt_build
needs: []
image: fedora:43
when: manual
before_script:
- dnf install -y --setopt=install_weak_deps=False
gcc gcc-c++ cmake
latexmk tex-dvipng texlive-scheme-basic
tex-preview tex-charter tex-exam tex-preprint
python3-passlib python3-pyqt6
python3-jsmin python3-defusedxml python3-yaml
python3-urllib3 python3-more-itertools
python3-seaborn python3-pandas python3-requests-toolbelt
python3-pip python3-wheel python3-setuptools
python3-tomlkit python3-pillow python3-tqdm
python3-appdirs python3-arrow
python3-cryptography
python3-zxing-cpp
python3-psycopg3
python3-pytest
python3-PyMuPDF
python3-PyMySQL
python3-scikit-learn python3-scikit-image
python3-weasyprint python3-whitenoise
python3-huggingface-hub python3-onnxruntime
file python3-file-magic
iproute
- pip --version
script:
# temporary, see https://gitlab.com/plom/plom/-/merge_requests/1634
- pip install -U pytest
# TODO: python3-django doesn't work, unsure why, instead get from pip (Issue #3830)
- pip install django
- pip install .
- PYTHONPATH="." ./plom_server/scripts/launch_plom_demo_server.py --stop-after reports
- python3 manage.py test
# 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_django_tests:
services:
- postgres
variables:
POSTGRES_DB: "plom_db"
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "postgres"
POSTGRES_HOST_AUTH_METHOD: trust
PLOM_DATABASE_HOSTNAME: "postgres"
PIP_BREAK_SYSTEM_PACKAGES: 1
stage: alt_build
image: ubuntu:24.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
cmake make g++
dvipng latexmk texlive-latex-extra texlive-fonts-recommended
libgl1 libxcb-cursor0 libegl1 libxkbcommon0 libdbus-1-3
libsm6 libxrender1
libpango-1.0-0 libpangocairo-1.0-0
python3-pytest python3-dev
python3-pip
iproute2 psmisc file python3-magic git
# apt-get --no-install-recommends --yes install libimage-exiftool-perl
- python3 -m pip install --upgrade --ignore-installed pip setuptools packaging wheel
- pip --version
script:
# pip install plom-client
# but we might need a more recent one if API recently changed
- pip install -U git+https://gitlab.com/plom/plom-client.git@$PLOMCLIENT_BRANCHNAME
# we can run in-tree but we need pip for dependencies
- pip install .
- pip uninstall -y plom
- PYTHONPATH=. ./plom_server/scripts/launch_plom_demo_server.py --length quick --stop-after randomarking
- python3 manage.py test
# Minimum Python, minimum deps
# generally keep things as old as possible for this job
minpy_mindeps_django_tests:
services:
- postgres
variables:
POSTGRES_DB: "plom_db"
POSTGRES_USER: "postgres"
POSTGRES_PASSWORD: "postgres"
POSTGRES_HOST_AUTH_METHOD: trust
PLOM_DATABASE_HOSTNAME: "postgres"
# ideally we'd test with OOTB pip so hide pip upgrade msg
PIP_DISABLE_PIP_VERSION_CHECK: 1
stage: alt_build
image: python:3.10
before_script:
# Note: Python image based on Debian (can install deps)
- apt-get update
- apt-get --no-install-recommends --yes install
cmake make g++ dvipng
texlive-latex-extra latexmk texlive-fonts-recommended
libgl1 libxcb-cursor0 libegl1 libxkbcommon0 libdbus-1-3
libsm6 libxrender1
git
- pip install pytest
script:
- pip install -r requirements.txt.tempminima
- pip install .
# pip install plom-client
# but we might need a more recent one if API recently changed
- pip install -U git+https://gitlab.com/plom/plom-client.git@$PLOMCLIENT_BRANCHNAME
# TODO: do we want full demo or just makemigrate?
- PYTHONPATH="." python3 plom_server/scripts/launch_plom_demo_server.py --length quick --stop-after randomarking
- python3 manage.py test
# alternative is we have nothing pip installed, that should work too (although need to install once for deps)
- pip uninstall -y plom
- python3 manage.py test
# upload binaries are generic gitlab packages
binary_upload:
stage: prep
image: curlimages/curl:latest
rules:
- if: $CI_COMMIT_TAG
script:
- ls
- |
tee release_desc.md <<EOF
## Installation instructions
Please see [plomgrading.org](https://plomgrading.org).
If you're here looking for Clients, see the
"[Plom Client packages](https://gitlab.com/plom/plom-client/-/releases)" instead.
#### Changes in this release
See [the Changelog](https://gitlab.com/plom/plom/-/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
- 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"
- 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"
- export OTHER_URL1="https://pypi.org/project/plom"
- export OTHER_URL3="https://hub.docker.com/r/plomgrading/server"
- export OTHER_LINKNAME1="Find Plom on PyPI"
- export OTHER_LINKNAME3="Plom Server on DockerHub"
- echo "OTHER_URL1=$OTHER_URL1" >> release_info.env
- echo "OTHER_URL3=$OTHER_URL3" >> release_info.env
- echo "OTHER_LINKNAME1=$OTHER_LINKNAME1" >> release_info.env
- echo "OTHER_LINKNAME3=$OTHER_LINKNAME3" >> release_info.env
- cat release_desc.md
artifacts:
paths:
- release_desc.md
reports:
dotenv: release_info.env
expire_in: 16 days
# this was slow and failed, went back to "brew"
# asdf plugin-add imagemagick
# asdf install imagemagick 7.0.11-5
# Runs Python 3.10 as of 2023-10
# As of 2023-10, we only try to run webplom tests, see TODO about legacy
# TODO: as of 2025-03, no way to build migrations without demo and without postgres
macos-server-django-tests:
variables:
HOMEBREW_NO_AUTO_UPDATE: 1
HOMEBREW_NO_INSTALL_CLEANUP: 1
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1
image: macos-13-xcode-14
tags:
- saas-macos-medium-m1
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- if: $CI_PROJECT_PATH == "plom/plom"
when: manual
allow_failure: true
stage: alt_build
needs: []
script:
- sw_vers
- echo $SHELL
- which python
- python --version
- pip --version
- python -m pip install --upgrade pip
- pip --version
- echo $USER
- brew --version
# brew update
# brew --version
- brew install cmake pango
- brew install gobject-introspection
- brew install cffi
- time brew install basictex
- echo $PATH
# pdflatex et al not in path until we do this:
- eval "$(/usr/libexec/path_helper)"
- echo $PATH
# alternative slower tex install:
# time brew install mactex-no-gui
- ls /Library/TeX/texbin/
- which pdflatex
- which tlmgr
# need sudo, "You don't have permission to change the installation in any way"
- time sudo tlmgr update --self
- sudo tlmgr install latexmk
- sudo tlmgr install dvipng
- sudo tlmgr install preview exam preprint
- which latexmk
- pip install pytest
- pip install .
- python -m plom.create --version
- python -m plom.server --version
# TODO this fails b/c it runs python3, which is not the right Python
# python -m pytest -l --pyargs plom
# Instead test webplom
# no postgres yet
# ./plom_server/scripts/launch_plom_demo_server.py --length quick --stop-after randomarking
# export PLOM_DATABASE_BACKEND=sqlite
# python manage.py test