-
Notifications
You must be signed in to change notification settings - Fork 3
/
.gitlab-ci.yml
1613 lines (1505 loc) · 51.8 KB
/
.gitlab-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
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-2024 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
# 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:27.3.1
services:
- docker:27.3.1-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
MACBIN_PY_MAJOR_MINOR_VER: "3.11"
MACBIN_PY_VER: 3.11.9
QT_QPA_PLATFORM: offscreen
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.bulk
else
docker build --tag $IM . -f Containerfile.bulk
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:
- python3 -m pip install codespell~=2.3.0
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 "Version info duplicated in two places, ensure same"
- export VER0=`sed -nr 's/^__version__ = \"(.+)\"/\1/p' plom/__init__.py`
- export VER1=`sed -nr 's/^\s+version. (.+)/\1/p' AppImageBuilder.yml`
- echo $VER0
- echo $VER1
- bash -c "[[ x$VER0 == x$VER1 ]]"
copyright_year:
image: python:3
stage: static_analysis
before_script:
- git --version
- echo "ensure we have the main branch for comparing"
- git fetch origin main
- git checkout main
- git checkout $CI_COMMIT_BRANCH --
- git branch -avv
script:
- echo "Considering the following commits to this branch (since main):"
- git shortlog origin/main..${CI_COMMIT_BRANCH} --
- echo "Those commits touch the following files:"
# git show --pretty="" --name-only origin/main..${CI_COMMIT_BRANCH} -- | uniq -u
# TODO: tried ${CI_MERGE_REQUEST_TARGET_BRANCH_NAME} instead of main?
- git diff --name-only origin/main..${CI_COMMIT_BRANCH} --
- ./contrib/is_copyright_uptodate.py `git diff --name-only origin/main..$CI_COMMIT_BRANCH --`
- echo "Note that there are some files that do not have/need copyright headers"
allow_failure: true
djlint:
image: python:3
stage: static_analysis
before_script:
- pip install djlint~=1.35.3
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.35.3
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
- 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' plom/__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~=24.10.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.6.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:
- pip3 install --upgrade 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
# needs full dependencies, cannot easily run with other early static analysis
pylint:
stage: test
needs: ["container-image"]
image: $IM
before_script:
# These are pinned at 3.x.*: should be manually bumped sometimes
- python3 -m pip install astroid~=3.3.5 # codespell:ignore astroid
- python3 -m pip install pylint~=3.3.1
script:
- pylint plom
- pylint plom_server
- 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:
- python3 -m pip install mypy~=1.13.0
script:
- mypy --version
- mypy plom --python-ver 3.8 --install-types --non-interactive || true
- mypy plom --python-ver 3.8
- mypy plom_server --python-ver 3.8 --install-types --non-interactive || true
- mypy plom_server --python-ver 3.8
allow_failure: true
pyright:
stage: test
needs: ["container-image"]
image: $IM
before_script:
- python3 -m pip install pyright~=1.1.387
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.1.1
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.7.1
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.7.1
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 1533 ]]"
allow_failure: true
no-question-numbers:
image: python:3.12
stage: static_analysis
script:
- grep plom_server -rie "question.num"
- echo "Question number is ambiguous; generally we prefer index or the question label"
- HOW_MANY=`grep plom_server -rie "question.num" | wc -l`
# 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 31 ]]"
allow_failure: true
# TODO: why do we need to run makemigrations/migrate before tests?
webplom_test:
stage: test
needs: ["container-image"]
image: $IM
script:
- export PYTHONPATH=$PWD
- python3 -m pip install coverage~=7.6.4
- pushd plom_server
- export PLOM_DATABASE_BACKEND=sqlite
- 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
- popd
coverage: '/^TOTAL\s+.*\s(\d+\.\d+)%$/'
artifacts:
reports:
coverage_report:
coverage_format: cobertura
path: plom_server/django_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
script:
- export PYTHONPATH=$PWD
- echo $PYTHONPATH
- pushd plom_server
- ./Launcher/launch_scripts/launch_plom_demo_server.py --length quick --stop-after reports
- popd
# a legacy-only job
demoserver:
stage: test
needs: ["container-image"]
image: $IM
before_script:
- apt-get update
- apt-get --no-install-recommends --yes install iproute2 psmisc file curl
script:
- mkdir demo
- pushd demo
- plom-server init
- plom-server users --demo
- plom-create newspec --demo
# Start server
- ip addr
- plom-server launch &
- sleep 2
- sleep 2
- echo "Server should be in background"
- jobs -l
- echo "We should be able to connect to it"
- curl -k https://localhost:41984/Version
- plom-create uploadspec demoSpec.toml -w 1234
- plom-create class --demo -w 1234
- plom-create make -w 1234
- plom-solutions extract solutionSpec.toml -w 1234
- plom-solutions extract --upload -w 1234
- python3 -m plom.create.exam_scribbler -w 1234
- plom-scan process -w 4567 fake_scribbled_exams1.pdf
- plom-scan upload -w 4567 fake_scribbled_exams1.pdf
- plom-scan status -w 4567
- plom-scan process -w 4567 fake_scribbled_exams2.pdf
- plom-scan upload -w 4567 fake_scribbled_exams2.pdf
- plom-scan status -w 4567
- plom-scan process -w 4567 fake_scribbled_exams3.pdf
- plom-scan upload -w 4567 fake_scribbled_exams3.pdf
- plom-scan status -w 4567
- echo "Now take down the server"
# https://gitlab.com/gitlab-org/gitlab-runner/issues/2880
- jobs -l
- kill %1
- sleep 2
- echo "Should be no jobs and this should succeed"
- jobs -l
- popd
# a legacy-only job
hwdemoserver:
stage: test
needs: ["container-image"]
image: $IM
before_script:
- apt-get update
- apt-get --no-install-recommends --yes install iproute2 psmisc file curl
script:
- mkdir demo
- pushd demo
- plom-server init
- plom-server users --demo
- plom-create newspec --demo
# Start server
- ip addr
- plom-server launch &
- sleep 2
- sleep 2
- echo "Server should be in background"
- jobs -l
- echo "We should be able to connect to it"
- curl -k https://localhost:41984/Version
- export PLOM_USER=user0
- export PLOM_PASSWORD=0123
- export PLOM_MANAGER_PASSWORD=1234
- export PLOM_SCAN_PASSWORD=4567
- plom-create uploadspec demoSpec.toml
- plom-create class --demo
- plom-create make
- plom-solutions extract solutionSpec.toml
- plom-solutions extract --upload
- plom-hwscan status
- python3 -m plom.create.homework_scribbler
# TODO: the actual hwdemo script does more with qstr, semiloose
- plom-hwscan allbyq -y
- plom-hwscan missing -y
- plom-hwscan submitted
- plom-hwscan submitted -d
- python3 -m plom.client.randoMarker
- plom-finish status
- plom-finish csv
- A=`cat marks.csv | wc -l` # How many lines?
- echo $A
- A="$((A-1))"
- bash -c "[[ $A -le 10 ]]" # 10 named papers
- bash -c "[[ $A == 6 ]]" # hw_scribber makes 4 "semiloose"
- file marks.csv
- file marks.csv | grep text
- plom-finish reassemble
- B=`ls reassembled/ | wc -l` # How many files?
- echo $B
- bash -c "[[ $B == $A ]]"
- plom-finish solutions --mark
- B=`ls solutions/ | wc -l` # How many files?
- echo $B
- bash -c "[[ $B == $A ]]"
- echo "Now take down the server"
# https://gitlab.com/gitlab-org/gitlab-runner/issues/2880
- jobs -l
- kill %1
- sleep 2
- echo "Should be no jobs and this should succeed"
- jobs -l
- popd
# a legacy-only job
fullworkflow:
stage: test
needs: ["container-image"]
image: $IM
before_script:
- apt-get update
- apt-get --no-install-recommends --yes install iproute2 psmisc file curl
script:
- pwd
- ls /
- cd /exam
- ls /usr/local/lib/python3.10/dist-packages/plom/
- ls /src
- python3 --version
# Build tests
- mkdir play
- pushd play
- plom-server init
- plom-server users --demo
- plom-create newspec
- python3 -m plom.create.demotools solutions # to get soln pdf copied
# TODO: override the private seed
# sed specAndDatabase/verifiedSpec.toml -i -e "s/privateSeed = .*/privateSeed = \"8253996856355501\"/"
# diff -u specAndDatabase/verifiedSpec.toml ../tmp/resources/verifiedSpec.toml
# Start server
- ip addr
- plom-server launch &
- sleep 2
- sleep 2
- echo "Server should be in background"
- jobs -l
- echo "We should be able to connect to it"
- curl -k https://localhost:41984/Version
- export PLOM_USER=user0
- export PLOM_PASSWORD=0123
- export PLOM_MANAGER_PASSWORD=1234
- export PLOM_SCAN_PASSWORD=4567
- plom-create uploadspec
- plom-create class --demo
- plom-create make
- plom-solutions extract solutionSpec.toml
- plom-solutions extract --upload
- A=`ls papersToPrint/ | wc -l` # How many files?
- bash -c "[[ $A == 20 ]]" # should be 20
- python3 -m plom.create.exam_scribbler
- plom-create rubric --demo
# Scan and upload
# supposed to fail:
- if (plom-scan process); then false; else true; fi
- plom-scan process --demo fake_scribbled_exams1.pdf
- plom-scan upload fake_scribbled_exams1.pdf
- plom-scan upload -u fake_scribbled_exams1.pdf
# TODO: I removed some -c lines here...
- plom-scan status
- plom-scan process --demo fake_scribbled_exams2.pdf
- plom-scan upload -u fake_scribbled_exams2.pdf
- plom-scan status
- plom-scan process --demo fake_scribbled_exams3.pdf
- plom-scan upload -u fake_scribbled_exams3.pdf
- plom-scan status
## not supposed to be done yet:
- if (plom-finish status); then false; else true; fi
- python3 -m plom.client.randoIDer -s localhost -u user0 -w 0123
- python3 -m plom.client.randoMarker -s localhost -u user0 -w 0123
- plom-finish status
- plom-finish csv
- A=`cat marks.csv | wc -l` # How many lines?
- echo $A
- A="$((A-1))"
- bash -c "[[ $A == 19 ]]" # b/c 1 page from 1 test is deleted
- file marks.csv
- file marks.csv | grep text
- plom-finish reassemble
- A=`ls reassembled/ | wc -l` # How many files?
- bash -c "[[ $A == 19 ]]" # since 1 test incomplete
- plom-finish solutions --mark
- A=`ls solutions/ | wc -l` # How many files?
- bash -c "[[ $A == 19 ]]"
- A=`du -sm reassembled/ | cut -f1` # Don't regress on issue #627
- bash -c "[[ $A -lt 40 ]]" # not more than 10 MB
- plom-finish webpage --solutions
- A=`ls codedReturn/ | wc -l` # How many files (inc soln)?
- bash -c "[[ $A == 39 ]]" # 2*(20-1) pdf + 1 html
- echo "Now take down the server"
# https://gitlab.com/gitlab-org/gitlab-runner/issues/2880
- jobs -l
- kill %1
- sleep 2
- echo "Should be no jobs and this should succeed"
- jobs -l
- popd
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
# TODO: perhaps all deps should be in the docker image?
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 singlehtml
- 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_legacy:
stage: alt_build
image: fedora:41
when: manual
allow_failure: true
before_script:
- dnf install -y ImageMagick 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-aiohttp python3-peewee python3-cryptography
python3-zxing-cpp
python3-pytest
python3-PyMuPDF python3-scikit-learn python3-PyMySQL
file python3-file-magic
iproute
- pip --version
script:
# temporary, see https://gitlab.com/plom/plom/-/merge_requests/1634
- pip install -U pytest
- pip install .
# First, run the unit tests
- which pytest-3
- which pytest
- pytest plom
# Build tests
- mkdir play
- pushd play
- plom-demo . --num-papers 3 --prepare-only
- ip addr
- plom-server launch . &
- sleep 2
- sleep 2
- echo "Server should be in background"
- jobs -l
- echo "We should be able to connect to it"
- curl -k https://localhost:41984/Version
- A=`ls papersToPrint/ | wc -l` # How many files?
- bash -c "[[ $A == 3 ]]" # should be 3
- export PLOM_MANAGER_PASSWORD=1234
# not supposed to be done yet:
- if (plom-finish status); then false; else true; fi
- python3 -m plom.client.randoIDer -s localhost -u user0 -w 0123
- python3 -m plom.client.randoMarker -s localhost -u user0 -w 0123
- plom-finish status
- plom-finish csv
- A=`cat marks.csv | wc -l` # How many lines?
- echo $A
- A="$((A-1))"
- bash -c "[[ $A == 2 ]]" # b/c 1 page from 1 test is deleted
- file marks.csv
- file marks.csv | grep text
- plom-finish reassemble
- A=`ls reassembled/ | wc -l` # How many files?
- bash -c "[[ $A == 2 ]]" # since 1 test incomplete
- A=`du -sm reassembled/ | cut -f1` # Don't regress on issue #627
- bash -c "[[ $A -lt 10 ]]" # not more than 10 MB
- echo "Now take down the server"
# https://gitlab.com/gitlab-org/gitlab-runner/issues/2880
- jobs -l
- kill %1
- sleep 2
- echo "Should be no jobs and this should succeed"
- jobs -l
- popd
# 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_webplom:
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:41
when: manual
allow_failure: true
before_script:
- dnf install -y ImageMagick 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-aiohttp python3-peewee python3-cryptography
python3-zxing-cpp
python3-pytest
python3-PyMuPDF python3-scikit-learn python3-PyMySQL
file python3-file-magic
iproute
python3-django
- pip --version
script:
# temporary, see https://gitlab.com/plom/plom/-/merge_requests/1634
- pip install -U pytest
- pip install .
- export PYTHONPATH=$PWD
- echo $PYTHONPATH
- pushd plom_server
- ./Launcher/launch_scripts/launch_plom_demo_server.py --stop-after reports
- export PLOM_DATABASE_BACKEND=sqlite
- python3 manage.py test
- popd
# 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: alt_build
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
cmake make g++ imagemagick
dvipng latexmk texlive-latex-extra texlive-fonts-recommended
libgl1-mesa-glx libsm6 libxrender1 libegl1 libxkbcommon0 libdbus-1-3
libpango-1.0-0 libpangocairo-1.0-0
python3-pytest python3-dev
python3-pip
iproute2 psmisc file python3-magic
# 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 plom
# Build tests
- mkdir play
- pushd play
- plom-demo . --num-papers 3 --prepare-only
- ip addr
- plom-server launch . &
- sleep 2
- sleep 2
- echo "Server should be in background"
- jobs -l
- echo "We should be able to connect to it"
- curl -k https://localhost:41984/Version
- A=`ls papersToPrint/ | wc -l` # How many files?
- bash -c "[[ $A == 3 ]]" # should be 3
- export PLOM_MANAGER_PASSWORD=1234
# not supposed to be done yet:
- if (plom-finish status); then false; else true; fi
- python3 -m plom.client.randoIDer -s localhost -u user0 -w 0123
- python3 -m plom.client.randoMarker -s localhost -u user0 -w 0123
- plom-finish status
- plom-finish csv
- A=`cat marks.csv | wc -l` # How many lines?
- echo $A
- A="$((A-1))"
- bash -c "[[ $A == 2 ]]" # b/c 1 page from 1 test is deleted
- file marks.csv
- file marks.csv | grep text
- plom-finish reassemble
- A=`ls reassembled/ | wc -l` # How many files?
- bash -c "[[ $A == 2 ]]" # since 1 test incomplete
- A=`du -sm reassembled/ | cut -f1` # Don't regress on issue #627
- bash -c "[[ $A -lt 10 ]]" # not more than 10 MB
- plom-finish webpage
- A=`ls codedReturn/ | wc -l` # How many files?
- bash -c "[[ $A == 3 ]]" # 3-1 pdf + 1 html
- echo "Now take down the server"
# https://gitlab.com/gitlab-org/gitlab-runner/issues/2880
- jobs -l
- kill %1
- sleep 2
- echo "Should be no jobs and this should succeed"
- jobs -l
- popd
# 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_webplom:
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
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
cmake make g++ imagemagick
dvipng latexmk texlive-latex-extra texlive-fonts-recommended
libgl1-mesa-glx libsm6 libxrender1 libegl1 libxkbcommon0 libdbus-1-3
libpango-1.0-0 libpangocairo-1.0-0
python3-pytest python3-dev
python3-pip
iproute2 psmisc file python3-magic
# apt-get --no-install-recommends --yes install libimage-exiftool-perl
- python3 -m pip install --upgrade pip setuptools packaging wheel
- pip --version
script:
- pip install .
- export PYTHONPATH=$PWD
- echo $PYTHONPATH
- pushd plom_server
- ./Launcher/launch_scripts/launch_plom_demo_server.py --length quick --stop-after randomarking
- export PLOM_DATABASE_BACKEND=sqlite
- python3 manage.py test
- popd
# Ensure minimum listed dependency versions actually work on older system
# 1. oldest reasonably supported popular OS
# 2. take python deps from package manager