xref: /petsc/.gitlab-ci.yml (revision 0d5ef98addb54ced821e7e5fade9ccac0ec8ccde)
1#
2# stage-1 take only a few minutes; they do not run the full test suite or external packages.
3#
4# stage-2 runs on MCS systems and may take 10 to 15 minutes. They run the full test suite but with limited mixture of external packages
5#
6# stage-3 runs on MCS systems and may take an hour or more. They run the full test suite and heavily test external packages, utilize valgrind etc
7#
8# The stage-(n) tests are only started if all of the stage-(n-1) tests run without error
9#   You can limit the testing by using the variable STAGE with value 1 or 2
10#
11
12stages:
13  - stage-1
14  - stage-2
15  - stage-3
16  - stage-4
17variables:
18  GIT_STRATEGY: fetch
19  GIT_CLEAN_FLAGS: -ffdxq
20  TIMEOUT: 450
21  EXTRA_OPTIONS: -nox -nox_warning -malloc_dump
22
23#
24# The most basic template that most tests will expand upon
25#
26
27.test-basic:
28  interruptible: true
29  only:
30    refs:
31#     Set with CI/CD Shedules - New Schedule
32      - schedules
33      - api
34#     Set with CI/CD Pipelines - Run Pipeline
35      - web
36      - merge_requests
37  dependencies: []
38
39.test:
40  extends: .test-basic
41  except:
42    variables:
43      # Skip if the docs-only label is attached to a merge request
44      - $CI_MERGE_REQUEST_LABELS =~ /(^|,)docs-only($|,)/
45      - $PETSC_CI_SCHEDULED =~ /yes/
46
47check-ci-settings:
48  extends: .test-basic
49  stage: .pre
50  tags:
51    - gce-stage1
52  script:
53    - lib/petsc/bin/maint/check-ci-settings.sh
54
55#
56#  This provides the basic order of operations and options template for cloud based stage 1 tests.
57#  Not all test-short need to follow this template but most will.
58#
59
60.stage-1:
61  extends: .test
62  stage: stage-1
63  tags:
64    - gce-u22-stage1
65  before_script:
66    - date
67    - hostname
68    - grep PRETTY_NAME /etc/os-release
69    - nproc
70    - lscpu
71    - ccache --zero-stats
72  script:
73    - if [ ! -z ${LOAD_MODULES+x} ]; then module --trace load ${LOAD_MODULES}; module list; fi
74    - if [ ! -z ${INIT_SCRIPT+x} ]; then echo "sourcing ${INIT_SCRIPT}"; if [ -f ${HOME}/${INIT_SCRIPT} ]; then source ${HOME}/${INIT_SCRIPT}; else source ${INIT_SCRIPT}; fi; fi
75    - printf "PATH:$PATH\n"
76    - printf "PYTHONPATH:$PYTHONPATH\n"
77    - printf "python:${PYTHON}\n"
78    - ${PYTHON} -m pip list --user
79    - printf "CONFIG_OPTS:${CONFIG_OPTS}\n"
80    - printf "PETSC_OPTIONS:$PETSC_OPTIONS\n"
81    - if [ ! -z ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME+x} ]; then printf "CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME\n" ;fi
82    - ${PYTHON} ./configure --with-debugging=0 COPTFLAGS='-O3 -march=native' CXXOPTFLAGS='-O3 -march=native' FOPTFLAGS='-O3 -march=native' ${CONFIG_OPTS}
83    - make CFLAGS="${MAKE_CFLAGS}" CXXFLAGS="${MAKE_CXXFLAGS}" FFLAGS="${MAKE_FFLAGS}" CUDAFLAGS="${MAKE_CUDAFLAGS}"
84    - if [ ! -z ${ENABLE_CHECK+x} ]; then make CFLAGS="${MAKE_CFLAGS}" CXXFLAGS="${MAKE_CXXFLAGS}" FFLAGS="${MAKE_FFLAGS}" CUDAFLAGS="${MAKE_CUDAFLAGS}" check; fi
85    - make CFLAGS="${MAKE_TEST_CFLAGS}" CXXFLAGS="${MAKE_TEST_CXXFLAGS}" FFLAGS="${MAKE_TEST_FFLAGS}" CUDAFLAGS="${MAKE_CUDAFLAGS}" allgtests-tap gmakesearch="${TEST_SEARCH}" TIMEOUT=${TIMEOUT}
86  variables:
87    PYTHON: python3
88    MAKE_CFLAGS: -Werror -Wmissing-field-initializers
89    MAKE_CXXFLAGS: -Werror -Wzero-as-null-pointer-constant
90    MAKE_FFLAGS: -Werror
91    MAKE_TEST_CFLAGS: -Werror
92    MAKE_TEST_CXXFLAGS: -Werror
93    MAKE_TEST_FFLAGS: -Werror
94  after_script:
95    - date
96    - ccache --show-stats
97  artifacts:
98    reports:
99      junit: arch-*/tests/testresults.xml
100    name: "$CI_JOB_NAME"
101    when: always
102    paths:
103    - arch-*/lib/petsc/conf/*.log
104    - arch-*/lib/pkgconfig/petsc.pc
105    - arch-*/tests/testresults.xml
106    - arch-*/tests/test_*_tap.log
107    - arch-*/tests/test_*_err.log
108    expire_in: 4 days
109
110#
111# The following tests run on the cloud as part of stage-1.
112#
113
114ompi-cuda:
115  extends: .stage-1
116  tags:
117  - cuda-stage1
118  variables:
119    CONFIG_OPTS: --with-mpi-dir=/nfs/gce/software/custom/linux-ubuntu22.04-x86_64/spack/opt/spack/linux-ubuntu22.04-x86_64/gcc-11.3.0/openmpi-4.1.3-qrpnszy --with-cuda=1 --with-cuda-arch=all-major --CUDAPPFLAGS=-Wno-deprecated-gpu-targets --with-fc=0
120    TEST_SEARCH: snes_tutorials-ex19_cuda%
121    ENABLE_CHECK: 1
122    MAKE_CXXFLAGS: -Werror
123    MAKE_CUDAFLAGS: -Xcompiler -Wall -Xcompiler -Werror
124
125mpich-cxx-py3:
126  extends: .stage-1
127  variables:
128    CONFIG_OPTS: --with-clanguage=cxx --with-fc=0 CXXFLAGS=-std=c++11 --with-strict-petscerrorcode
129    TEST_SEARCH: snes_tutorials-ex48%
130    LOAD_MODULES: gcc/12.1.0 mpich/4.1-gcc-12.1.0
131
132mpich-cxx-mlib:
133  extends: .stage-1
134  variables:
135    CONFIG_OPTS: --with-clanguage=cxx --with-single-library=0 --with-log=0 --with-info=0 --with-ctable=0 --with-is-color-value-type=short CXXFLAGS=-std=c++14
136    TEST_SEARCH: snes_tutorials-ex48%
137    LOAD_MODULES: gcc/12.1.0 mpich/4.1-gcc-12.1.0
138
139uni-complex-float-int64:
140  extends: .stage-1
141  variables:
142    CONFIG_OPTS: --with-mpi=0 --with-scalar-type=complex --with-precision=single --with-64-bit-indices
143    TEST_SEARCH: ts_tutorials-ex11_adv_2d_quad_%
144    LOAD_MODULES: gcc/12.1.0 mpich/4.1-gcc-12.1.0
145
146c99-mlib-static-py:
147  extends: .stage-1
148  variables:
149    CONFIG_OPTS: --with-single-library=0 --with-shared-libraries=0 --with-strict-petscerrorcode CFLAGS=-std=c99 FFLAGS= CXXFLAGS=
150    ENABLE_CHECK: 1
151    TEST_SEARCH: snes_tutorials-ex19% snes_tutorials-ex5f90t%
152    MAKE_TEST_FFLAGS: -Werror -std=f2008
153    LOAD_MODULES: gcc/12.1.0 mpich/4.1-gcc-12.1.0
154
155clang-uni:
156  extends: .stage-1
157  variables:
158    CONFIG_OPTS: --with-cc=clang --with-cxx=clang++ --with-mpi=0 --with-strict-petscerrorcode
159    TEST_SEARCH: snes_tutorials-ex48%
160
161gcc-lto:
162  extends: .stage-1
163  variables:
164    CONFIG_OPTS: CFLAGS= CXXFLAGS= FFLAGS=
165    MAKE_CFLAGS: -Werror -flto=4 -Werror=odr -Werror=lto-type-mismatch
166    MAKE_CXXFLAGS: -Werror -flto=4 -Werror=odr -Werror=lto-type-mismatch
167    MAKE_FFLAGS: -Werror -flto=4 -Werror=odr -Werror=lto-type-mismatch
168    TEST_SEARCH: snes_tutorials-ex19% snes_tutorials-ex5f%
169    LOAD_MODULES: gcc/12.1.0 mpich/4.1-gcc-12.1.0
170
171petsc4py-install:
172  extends: .stage-2
173  tags:
174    - gce-u22-stage1
175  variables:
176    PYTHON: python3
177    T_PREFIX: petsc-install
178    T_DESTDIR: petsc-destdir
179    T_PETSC4PY: src/binding/petsc4py
180    T_VALIDATE_CMD: lib/petsc/bin/maint/validate-petsc4py.sh
181  script:
182    - printf "PATH:$PATH\n"
183    - mkdir hide
184    - if [ ! -z ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME+x} ]; then printf "CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME\n" ;fi
185    - ${PYTHON} ./configure --prefix="${PWD}/${T_PREFIX}" --with-petsc4py=1 --with-debugging=0
186    - make CFLAGS=-Werror CXXFLAGS="-Werror -Wzero-as-null-pointer-constant" FFLAGS=-Werror
187    - printf "====== Test A. Install into staging directory then into prefix directory (mimics distro package recipe) =====\n"
188    - make install DESTDIR="${PWD}/${T_DESTDIR}"
189    - test "$(find ${PWD}/${T_PREFIX} -mindepth 1 | wc -l)" -eq 0
190    - test "$(find ${PWD}/${T_DESTDIR} -mindepth 1 | wc -l)" -gt 0
191    - (cd "${PWD}/${T_DESTDIR}" && find * -exec install -v -D "{}" "/{}" \; )
192    - mv arch-* hide/ && PETSC_DIR="${PWD}/${T_PREFIX}" ${T_VALIDATE_CMD} && mv hide/arch-* ./
193    - rm -r "${PWD}/${T_PREFIX}" "${PWD}/${T_DESTDIR}" && mkdir "${PWD}/${T_PREFIX}"
194    - printf "====== Test B. Install directly into prefix directory =====\n"
195    - make install
196    - test "$(find ${PWD}/${T_PREFIX} -mindepth 1 | wc -l)" -gt 0
197    - mv arch-* hide/ && PETSC_DIR="${PWD}/${T_PREFIX}" ${T_VALIDATE_CMD} && mv hide/arch-* ./
198    - rm -r "${PWD}/${T_PREFIX}"/*/petsc4py*
199    - printf "====== Test C. Install manually with setuptools =====\n"
200    - export PETSC_DIR="${PWD}/${T_PREFIX}" && (cd "${T_PETSC4PY}" && ${PYTHON} setup.py build)
201    - export PETSC_DIR="${PWD}/${T_PREFIX}" P="${PWD}" && (cd "${T_PETSC4PY}" && ${PYTHON} setup.py install --install-lib="${P}/${T_PREFIX}/lib")
202    - mv arch-* hide/ && PETSC_DIR="${PWD}/${T_PREFIX}" ${T_VALIDATE_CMD} && mv hide/arch-* ./
203    - rm -r "${PWD}/${T_PREFIX}"/*/petsc4py*
204    - printf "====== Test D. Install manually with setuptools with staging =====\n"
205    - export PETSC_DIR="${PWD}/${T_PREFIX}" P="${PWD}" && (cd "${T_PETSC4PY}" && ${PYTHON} setup.py install --root="${P}/${T_DESTDIR}" --install-lib="${P}/${T_PREFIX}/lib")
206    - (cd "${PWD}/${T_DESTDIR}" && find * -exec install -v -D "{}" "/{}" \; )
207    - mv arch-* hide/ && PETSC_DIR="${PWD}/${T_PREFIX}" ${T_VALIDATE_CMD} && mv hide/arch-* ./
208
209petsc4py-pip:
210  extends: .stage-2
211  tags:
212    - gce-u22-stage1
213  variables:
214    PETSC_CONFIGURE_OPTIONS: --with-mpi=0 --with-fc=0
215    CFLAGS: -O0
216  script:
217    - python3 -m venv pip-builds
218    - source pip-builds/bin/activate
219    - python -m pip install --upgrade pip
220    - unset PETSC_DIR PETSC_ARCH
221    - export PIP_WHEEL_DIR="${PWD}/wheelhouse"
222    - export PIP_FIND_LINKS="${PIP_WHEEL_DIR}"
223    - mkdir -p "${PIP_WHEEL_DIR}"
224    - python -m pip wheel .
225    - python -m pip wheel src/binding/petsc4py
226    - python -m pip install --pre --no-index --no-cache-dir petsc4py
227    - python -m pip list
228    - python -m petsc --prefix
229    - python -m petsc4py
230
231checksource:
232  extends: .test-basic
233  stage: .pre
234  tags:
235    - gce-u22-stage1
236  script:
237    - python3 ./configure --with-mpi=0 --with-fc=0 --with-cxx=0 --with-x=0 --with-bison=0 --with-cmake=0 --with-pthread=0 --with-regex=0
238    - vermin --version
239    - make vermin
240    - PATH=/nfs/gce/projects/petsc/soft/u22.04/spack-2024-09-18/opt/spack/linux-ubuntu22.04-x86_64/gcc-11.4.0/llvm-19.1.0-dqibzqq5utu2fba2me2bodbnaj5y7c36/bin:$PATH make checkclangformat SHELL=bash
241    - make checkbadSource SHELL=bash
242    - make checkbadFileChange SHELL=bash
243    - make -f gmakefile check_output SHELL=bash
244    - make check_petsc4py_rst
245    - make -C src/binding/petsc4py lint
246  artifacts:
247    name: "$CI_JOB_NAME"
248    when: always
249    paths:
250    - arch-*/lib/petsc/conf/*.patch
251    - arch-*/lib/petsc/conf/*.log
252    expire_in: 4 days
253
254pause-for-approval:
255  extends: .test
256  stage: .pre
257  tags:
258    - gce-stage1
259  only:
260    refs:
261      - merge_requests
262    variables:
263      - $CI_MERGE_REQUEST_EVENT_TYPE == "merged_result"
264      - $CI_MERGE_REQUEST_EVENT_TYPE == "detached"
265  script:
266    - echo "pause-for-approval has no script to run"
267  variables:
268    GIT_STRATEGY: none
269  when: manual
270  allow_failure: false
271
272#
273# Basic template for code coverage generation. Tests should additionally inherit from the more
274# specialized OS-specific versions instead of this one.
275#
276
277.coverage-generate:
278  variables:
279    RUN_GCOV: 1
280    RUN_GCOV_OPTIONS: --decisions
281
282.coverage-disable:
283  variables:
284    RUN_GCOV: 0
285
286#
287# This provides the basic order of operations and options template for stage-2,3 tests.
288# Not all stage-2,3 need to follow this template, but most will.
289#
290.stage-23:
291  extends:
292    - .test
293    - .coverage-generate
294  script:
295    - if [ ! -z ${LOAD_MODULES+x} ]; then module --trace load ${LOAD_MODULES}; module list; fi
296    - if [ ! -z ${GCOV_MODULES+x} ]; then module --trace load ${GCOV_MODULES}; module list; fi
297    - if [ ! -z ${INIT_SCRIPT+x} ]; then echo "sourcing ${INIT_SCRIPT}"; if [ -f ${HOME}/${INIT_SCRIPT} ]; then source ${HOME}/${INIT_SCRIPT}; else source ${INIT_SCRIPT}; fi; fi
298    - if [ "${RUN_GCOV}" == 1 ]; then
299        printf "RUN_GCOV_OPTIONS:$RUN_GCOV_OPTIONS\n";
300        gcovr --version;
301      fi
302    - if [ -d ${HOME}/petsc-hash-pkgs/ ]; then find ${HOME}/petsc-hash-pkgs/ -maxdepth 1 -mindepth 1 -type d -mtime +25 -exec rm -rf {} \; ; fi
303    - printf "PATH:$PATH\n"
304    - printf "PYTHONPATH:$PYTHONPATH\n"
305    - printf "PETSC_OPTIONS:$PETSC_OPTIONS\n"
306    - if [ ! -z ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME+x} ]; then printf "CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME\n" ;fi
307    - printf "./config/examples/${TEST_ARCH}.py\n"
308    - cat ./config/examples/${TEST_ARCH}.py
309    - ./config/examples/${TEST_ARCH}.py || if [ -f naglicenseproblem ]; then exit 126; else exit 1; fi
310    - make CFLAGS="${MAKE_CFLAGS}" CXXFLAGS="${MAKE_CXXFLAGS}" FFLAGS="${MAKE_FFLAGS}" CUDAFLAGS="${MAKE_CUDAFLAGS}" || if [ -f naglicenseproblem ]; then exit 126; else exit 1; fi
311    - export ASAN_OPTIONS="log_path=stdout:detect_leaks=false" UBSAN_OPTIONS="suppressions=${PWD}/share/petsc/suppressions/ubsan" # only needed for -fsanitize=undefined (but harmless otherwise)
312    - make CFLAGS="${MAKE_CFLAGS}" CXXFLAGS="${MAKE_CXXFLAGS}" FFLAGS="${MAKE_FFLAGS}" CUDAFLAGS="${MAKE_CUDAFLAGS}" check || if [ -f naglicenseproblem ]; then exit 126; else exit 1; fi
313    - make updatedatafiles
314    - if [ -z ${DISABLE_PETSC4PY_TESTS+x} ]; then if [ -z ${ENABLE_PETSC4PY_LDPRELOAD+x} ]; then echo "NOT using LD_PRELOAD"; make petsc4pytest; else echo "using LD_PRELOAD"; LD_PRELOAD=${PWD}/${TEST_ARCH}/lib/libpetsc.so make petsc4pytest; fi; fi
315    - if [ -z ${DISABLE_TESTS+x} ]; then make cleantest && make CFLAGS="${MAKE_CFLAGS}" CXXFLAGS="${MAKE_CXXFLAGS}" FFLAGS="${MAKE_FFLAGS}" CUDAFLAGS="${MAKE_CUDAFLAGS}" allgtests-tap TIMEOUT=${TIMEOUT} ${TEST_OPTS} || if [ -f naglicenseproblem ]; then exit 126; else exit 1; fi; fi
316    - if [ "${RUN_GCOV}" == 1 ]; then make gcov PETSC_GCOV_OPTIONS="${RUN_GCOV_OPTIONS}"; fi
317  artifacts:
318    reports:
319      junit: arch-*/tests/testresults.xml
320    name: "$CI_JOB_NAME"
321    when: always
322    paths:
323    - arch-*/lib/petsc/conf/*.log
324    - arch-*/lib/pkgconfig/petsc.pc
325    - arch-*/tests/testresults.xml
326    - arch-*/tests/test_arch-*_tap.log
327    - arch-*/tests/test_arch-*_err.log
328    - arch-*/arch-*-gcovr-report.json.tar.bz2
329    expire_in: 4 days
330  variables:
331    OPENBLAS_NUM_THREADS: 1
332
333.stage-2:
334  extends: .stage-23
335  stage: stage-2
336
337.stage-3:
338  extends: .stage-23
339  stage: stage-3
340
341#
342# The following provide templates for various OSes for pre/post info
343#
344
345.linux_test_noflags:
346  before_script:
347    - date
348    - hostname
349    - grep PRETTY_NAME /etc/os-release
350    - nproc
351    - lscpu
352    - ccache --zero-stats
353  after_script:
354    - date
355    - ccache --show-stats
356
357.linux_test_nofflags:
358  extends: .linux_test_noflags
359  variables:
360    MAKE_CFLAGS: -Werror
361    MAKE_CXXFLAGS: -Werror
362
363.linux_test:
364  extends: .linux_test_noflags
365  variables:
366    MAKE_CFLAGS: -Werror
367    MAKE_CXXFLAGS: -Werror
368    MAKE_FFLAGS: -Werror
369
370.freebsd_test:
371  extends:
372    - .coverage-disable
373  variables:
374    MAKE_CFLAGS: -Werror
375    MAKE_CXXFLAGS: -Werror
376    MAKE_FFLAGS: -Werror
377  before_script:
378    - date
379    - hostname
380    - freebsd-version
381    - echo $(sysctl -n hw.ncpu)
382    - ccache --zero-stats
383  after_script:
384    - date
385    - ccache --show-stats
386
387.osx_test:
388  variables:
389    MAKE_CFLAGS: -Werror
390    MAKE_CXXFLAGS: -Werror
391    MAKE_FFLAGS: -Werror
392  before_script:
393    - date
394    - hostname
395    - sw_vers -productVersion
396    - echo $(sysctl -n hw.ncpu)
397    - ccache --zero-stats
398  after_script:
399    - date
400    - ccache --show-stats
401
402.mswin_test:
403  extends:
404    - .coverage-disable
405  before_script:
406    - date
407    - hostname
408    - uname -a
409    - nproc
410  after_script:
411    - date
412
413#
414# The following tests run as part of stage-2.
415#
416# The tags variable used in the tests below connects the particular test with the runners
417# listed on the left hand side of https://gitlab.com/petsc/petsc/-/settings/ci_cd.
418# For example the test 'linux-sycl-double' any runner that has the tags 'gce-u22-stage3, linux-fast'
419# (in a blue box beneath it)
420#
421
422osx-arm:
423  extends:
424    - .stage-3
425    - .osx_test
426    - .coverage-disable
427  tags:
428    - os:macos-arm
429  variables:
430    TEST_ARCH: arch-ci-osx-arm
431    PETSC_OPTIONS: -check_pointer_intensity 0 -error_output_stdout
432    INIT_SCRIPT: .zprofile
433
434freebsd-cxx-cmplx-64idx-dbg:
435  extends:
436    - .stage-2
437    - .freebsd_test
438  tags:
439    - os:fbsd
440  variables:
441    TEST_ARCH: arch-ci-freebsd-cxx-cmplx-64idx-dbg
442
443freebsd-c-single-opt:
444  extends:
445    - .stage-2
446    - .freebsd_test
447  tags:
448    - os:fbsd
449  variables:
450    TEST_ARCH: arch-ci-freebsd-c-single-opt
451
452mswin-opt-impi:
453  extends:
454    - .stage-3
455    - .mswin_test
456  tags:
457    - mswin-stage3
458  variables:
459    TEST_ARCH: arch-ci-mswin-opt-impi
460    TEST_OPTS: search='ksp_ksp_tests*'
461
462linux-gcc-quad-64idx-dbg:
463  extends:
464    - .stage-2
465    - .linux_test
466  tags:
467    - gce-stage2
468  variables:
469    TEST_ARCH: arch-ci-linux-gcc-quad-64idx-dbg
470
471linux-gcc-pkgs-opt:
472  extends:
473    - .stage-2
474    - .linux_test
475  tags:
476    - gce-stage2
477  variables:
478    TEST_ARCH: arch-ci-linux-gcc-pkgs-opt
479  except:
480    variables:
481      - $PETSC_CI_SCHEDULED =~ /yes/
482
483linux-gcc-complex-opt-32bit:
484  extends:
485    - .stage-2
486    - .linux_test
487  tags:
488    - gce-stage2
489  variables:
490    TEST_ARCH: arch-ci-linux-gcc-complex-opt-32bit
491
492linux-emcc:
493  extends:
494    - .stage-2
495    - .linux_test
496    - .coverage-disable
497  tags:
498    - gce-stage2
499  variables:
500    TEST_ARCH: arch-ci-linux-emcc
501    INIT_SCRIPT: /nfs/gce/projects/petsc/soft/u22.04/emsdk/emsdk_env.sh
502    DISABLE_TESTS: 1
503
504#
505# The following tests run as part of stage-3.
506#
507
508freebsd-cxx-cmplx-pkgs-dbg:
509  extends:
510    - .stage-3
511    - .freebsd_test
512  tags:
513    - os:fbsd
514  variables:
515    TEST_ARCH: arch-ci-freebsd-cxx-cmplx-pkgs-dbg
516
517freebsd-cxx-pkgs-opt:
518  extends:
519    - .stage-3
520    - .freebsd_test
521  tags:
522    - os:fbsd
523  variables:
524    PETSC_OPTIONS: -vecscatter_mpi1 false -options_left false
525    TEST_ARCH: arch-ci-freebsd-cxx-pkgs-opt
526
527freebsd-pkgs-opt:
528  extends:
529    - .stage-3
530    - .freebsd_test
531  tags:
532    - os:fbsd
533  variables:
534    TEST_ARCH: arch-ci-freebsd-pkgs-opt
535    MAKE_CFLAGS: -DPETSC_SKIP_COMPLEX -Werror
536
537linux-hip-double:
538  extends:
539    - .stage-3
540    - .linux_test_noflags
541    - .coverage-disable
542  tags:
543    - gpu:amd, os:linux
544  variables:
545    TEST_ARCH: arch-ci-linux-hip-double
546
547linux-sycl-double:
548  extends:
549    - .stage-3
550    - .linux_test_nofflags
551    - .coverage-disable
552  tags:
553    - gce-u22-stage3, linux-fast
554  variables:
555    MODULEPATH: /nfs/gce/projects/petsc/soft/u22.04/oneapi/modulefiles
556    TEST_ARCH: arch-ci-linux-sycl-double
557    LOAD_MODULES: compiler/latest mpi/latest
558    TEST_OPTS: query=requires queryval=kokkos_kernels
559    MAKE_CFLAGS: -Wno-expected-file-type -Werror
560
561linux-cuda-pkgs:
562  extends:
563    - .stage-3
564    - .linux_test
565  tags:
566    - cuda-stage3
567  variables:
568    TEST_ARCH: arch-ci-linux-cuda-pkgs
569    # run all tests that:
570    # 1. require cuda, OR
571    # 2. require device, OR
572    # 3. require hypre, OR
573    # 4. require kokkos[_kernels], AND lives in the vec subdirectory
574    #
575    # need to use the alternate OR spelling since '|' is interpreted as a pipe by the
576    # shell, and I could not manage to escape it enough times...
577    TEST_OPTS: -j3 queryval='cuda,device,hypre,kokkos*,vec*' query='requires,requires,requires,requires%OR%name'
578    MAKE_CUDAFLAGS: --compiler-options -Wall,-Werror
579
580linux-cuda112-omp:
581  extends:
582    - .stage-3
583    - .linux_test
584    - .coverage-disable
585  tags:
586    - cuda-stage3
587  variables:
588    TEST_ARCH: arch-ci-linux-cuda112-omp
589    TEST_OPTS: -j4 query=requires queryval=kokkos_kernels
590    LOAD_MODULES: cuda/11.2.2 u-gcc-9/9.4.0
591    OMP_PROC_BIND: "false"
592    OMP_NUM_THREADS: 1
593    MAKE_CUDAFLAGS: --compiler-options -Wall,-Werror
594
595linux-cuda-cmplx:
596  extends:
597    - .stage-3
598    - .linux_test
599  tags:
600    - cuda-stage3
601  variables:
602    TEST_ARCH: arch-ci-linux-cuda-cmplx
603    MAKE_CUDAFLAGS: --compiler-options -Wall,-Werror
604
605linux-cuda-double-64idx:
606  extends:
607    - .stage-3
608    - .linux_test
609  tags:
610    - cuda12
611  variables:
612    TEST_ARCH: arch-ci-linux-cuda-double-64idx
613    TEST_OPTS: -j3 query=requires queryval=cuda
614    MAKE_CUDAFLAGS: --compiler-options -Wall,-Werror
615
616linux-cuda-single-cxx:
617  extends:
618    - .stage-3
619    - .linux_test_noflags
620    - .coverage-disable
621  tags:
622    - cuda-stage3
623  variables:
624    TEST_ARCH: arch-ci-linux-cuda-single-cxx
625    MODULEPATH: /nfs/gce/projects/petsc/soft/u22.04/spack-2023-02-02/share/spack/modules/linux-ubuntu22.04-ivybridge
626    LOAD_MODULES: nvhpc-22.11-gcc-11.3.0-vmvmbrx
627    TEST_OPTS: -j15 query=requires queryval=cuda
628
629linux-cuda-uni-pkgs:
630  extends:
631    - .stage-3
632    - .linux_test
633  tags:
634    - cuda-stage3
635  variables:
636    TEST_ARCH: arch-ci-linux-cuda-uni-pkgs
637    TEST_OPTS: -j20 query=requires queryval=cuda
638    MAKE_CUDAFLAGS: --compiler-options -Wall,-Werror
639
640linux-clang-cuda:
641  extends:
642    - .stage-3
643    - .linux_test
644    - .coverage-disable
645  tags:
646    - cuda-stage3
647  variables:
648    TEST_ARCH: arch-ci-linux-clang-cuda
649    TEST_OPTS: -j 1 queryval='cuda*,snes*' query='requires%OR%name'
650    MODULEPATH: /nfs/gce/projects/petsc/soft/u22.04/spack-2023-02-02/share/spack/modules/linux-ubuntu22.04-ivybridge
651    LOAD_MODULES: llvm-15.0.7-gcc-11.3.0-pjldtxf cuda-11.5.2-gcc-11.3.0-jkoottx gcc-11.3.0-gcc-11.3.0-pgrvke5
652    MAKE_CUDAFLAGS: -Wno-pass-failed -Werror
653
654linux-viennacl:
655  extends:
656    - .stage-3
657    - .linux_test
658  tags:
659    - cuda-stage3
660  variables:
661    TEST_ARCH: arch-ci-linux-viennacl
662    MAKE_CXXFLAGS: -Werror -Wno-ignored-attributes
663    TEST_OPTS: -j20 query=requires queryval=viennacl
664
665linux-without-fc:
666  extends:
667    - .stage-3
668    - .linux_test
669  tags:
670    - gce-u22-stage3
671  variables:
672    TEST_ARCH: arch-ci-linux-without-fc
673
674linux-cmplx-single-arm:
675  extends:
676    - .stage-3
677    - .linux_test
678    # gcovr does not work on arm/linux
679    - .coverage-disable
680  tags:
681    - arch:arm, os:linux
682  variables:
683    FLEXIBLAS: netlib
684    TEST_ARCH: arch-ci-linux-cmplx-single-arm
685
686linux-gcc-cxx-avx2:
687  extends:
688    - .stage-3
689    - .linux_test
690  tags:
691    - name:petsc-knl-01
692  variables:
693    TEST_ARCH: arch-ci-linux-gcc-cxx-avx2
694
695linux-clang-avx:
696  extends:
697    - .stage-3
698    - .linux_test
699  tags:
700    - name:petsc-knl-01
701  variables:
702    TEST_ARCH: arch-ci-linux-clang-avx
703
704linux-knl:
705  extends:
706    - .stage-3
707    - .linux_test
708    - .coverage-disable
709  tags:
710    - name:petsc-knl-01
711  variables:
712    MAKE_FFLAGS: -warn errors
713    TEST_ARCH: arch-ci-linux-knl
714    LOAD_MODULES: intel-oneapi-compilers/2022.0.2 intel-oneapi-mkl/2022.0.2 intel-oneapi-mpi/2021.5.1
715
716linux-intel-mkl-single:
717  extends:
718    - .stage-3
719    - .linux_test_nofflags
720    - .coverage-disable
721  tags:
722    - name:petsc-knl-01
723  variables:
724    TEST_ARCH: arch-ci-linux-intel-mkl-single
725    LOAD_MODULES: intel-oneapi-compilers/2022.0.2 intel-oneapi-mkl/2022.0.2 intel-oneapi-mpi/2021.5.1
726
727linux-cxx-cmplx-pkgs-64idx:
728  extends:
729    - .stage-3
730    - .linux_test
731  tags:
732    - gce-u22-stage3
733  variables:
734    TEST_ARCH: arch-ci-linux-cxx-cmplx-pkgs-64idx
735    PETSC_OPTIONS: -fp_trap
736    MODULEPATH: /nfs/gce/projects/petsc/soft/u22.04/spack-2024-08-30/modules/linux-ubuntu22.04-x86_64/Core
737    LOAD_MODULES: python/3.13.0rc1-rayc5m7 py-setuptools/69.2.0-6yku3zk python-venv/1.0-bnbfk2n py-pip/23.1.2-o7dlzno
738
739# Set env vars for 'Kokkos + OpenMP' tests, so that they won't give warnings
740linux-pkgs-dbg-ftn-interfaces:
741  extends:
742    - .stage-3
743    - .linux_test
744    - .coverage-disable
745  tags:
746    - gce-u22-stage3
747  variables:
748    TEST_ARCH: arch-ci-linux-pkgs-dbg-ftn-interfaces
749    OMP_PROC_BIND: "false"
750    OMP_NUM_THREADS: 4
751    PETSC_OPTIONS: -fp_trap
752
753linux-pkgs-cxx-mlib:
754  extends:
755    - .stage-3
756    - .linux_test
757  tags:
758    - gce-u22-stage3
759  variables:
760    TEST_ARCH: arch-ci-linux-pkgs-cxx-mlib
761    PETSC_OPTIONS: -fp_trap
762
763linux-pkgs-valgrind:
764  extends:
765    - .stage-3
766    - .linux_test
767  tags:
768    - gce-valgrind
769  variables:
770    TEST_ARCH: arch-ci-linux-pkgs-valgrind
771    TIMEOUT: 7200
772
773linux-pkgs-opt:
774  extends:
775    - .stage-3
776    - .linux_test
777  tags:
778    - gce-u22-stage3, linux-fast
779  variables:
780    TEST_ARCH: arch-ci-linux-pkgs-opt
781    LOAD_MODULES: gcc/12.1.0
782    MAKE_CXXFLAGS: -Wno-deprecated-declarations -Werror
783
784linux-pkgs-dbg:
785  extends:
786    - .stage-3
787    - .linux_test
788  tags:
789    - gce-u22-stage3, linux-gcov
790  variables:
791    TEST_ARCH: arch-ci-linux-pkgs-dbg
792    PETSC_OPTIONS: -fp_trap
793
794linux-matlab-ilp64:
795  extends:
796    - .stage-3
797    - .linux_test
798  tags:
799    - gce-u22-stage3, linux-gcov
800  variables:
801    TEST_ARCH: arch-ci-linux-matlab-ilp64
802    LOAD_MODULES: gcc/9.4.0 matlab/R2022a
803  allow_failure: true
804
805linux-pgi:
806  extends:
807    - .stage-3
808    - .linux_test_noflags
809    - .coverage-disable
810  tags:
811    - gce-u22-stage3, linux-mcpu
812  variables:
813    TEST_ARCH: arch-ci-linux-pgi
814    LOAD_MODULES: nvhpc/22.3
815
816# If the Nag license server fails then ${PETSC_DIR}/naglicenseproblem is created and the job is marked as failed but allow_failure
817linux-nagfor:
818  extends:
819    - .stage-3
820    - .linux_test_nofflags
821  tags:
822    - gce-stage2, linux-mcpu
823  variables:
824    LOAD_MODULES: nag/6.1
825    TEST_ARCH: arch-ci-linux-nagfor
826  allow_failure:
827    exit_codes: 126
828
829linux-intel-cmplx:
830  extends:
831    - .stage-3
832    - .linux_test_nofflags
833    - .coverage-disable
834  tags:
835    - gce-u22-stage3
836  variables:
837    TEST_ARCH: arch-ci-linux-intel-cmplx
838    LOAD_MODULES: intel-oneapi-compilers/2023.0.0 intel-oneapi-mkl/2022.0.2
839
840linux-xsdk-dbg:
841  extends:
842    - .stage-3
843    - .linux_test
844  tags:
845    - gce-u22-stage3
846  variables:
847    TEST_ARCH: arch-ci-linux-xsdk-dbg
848    LOAD_MODULES: gcc/12.1.0
849
850check-each-commit:
851  extends:
852    - .stage-2
853    - .linux_test
854    - .coverage-disable
855  tags:
856    - gce-u22-stage2
857  script:
858    - export PATH=/nfs/gce/projects/petsc/soft/u22.04/spack-2024-09-18/opt/spack/linux-ubuntu22.04-x86_64/gcc-11.4.0/llvm-19.1.0-dqibzqq5utu2fba2me2bodbnaj5y7c36/bin:$PATH
859    - lib/petsc/bin/maint/check-each-commit.sh
860  except:
861    variables:
862      - $PETSC_CI_SCHEDULED =~ /yes/
863  allow_failure: true
864
865linux-analyzer:
866  extends:
867    - .stage-2
868    - .linux_test
869    - .coverage-disable
870  tags:
871    - gce-u22-stage2
872  script:
873    - printf "PATH:$PATH\n"
874    - printf "PYTHONPATH:$PYTHONPATH\n"
875    - python3 --version
876    - git --version
877    - mypy --version
878    - vermin --version
879    - printf "PETSC_OPTIONS:$PETSC_OPTIONS\n"
880    - if [ ! -z ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME+x} ]; then printf "CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME\n" ;fi
881    - printf "./config/examples/${TEST_ARCH}.py\n"
882    - cat ./config/examples/${TEST_ARCH}.py
883    - ./config/examples/${TEST_ARCH}.py
884    - make LINTER_OPTIONS="${LINTER_OPTIONS}" test-lint
885    - make V=3 LINTER_OPTIONS="${LINTER_OPTIONS} -- ./src" lint
886  variables:
887    TEST_ARCH: arch-ci-linux-analyzer
888    LINTER_OPTIONS: "--PETSC_ARCH=${TEST_ARCH} --clang_lib=`llvm-config-14 --libdir`/libclang.so.1 --werror 1"
889  artifacts:
890    paths:
891    - arch-*/lib/petsc/conf/*.log
892    - ./petscLintPatches/*.patch
893    expire_in: 4 days
894  except:
895    variables:
896      - $PETSC_CI_SCHEDULED =~ /yes/
897
898linux-intel:
899  extends:
900    - .stage-3
901    - .linux_test_nofflags
902    - .coverage-disable
903  tags:
904    - gce-u22-stage3
905  variables:
906    TEST_ARCH: arch-ci-linux-intel
907    LOAD_MODULES: intel-oneapi-compilers/2023.0.0 intel-oneapi-mkl/2022.0.2
908
909linux-clang-ubsan:
910  extends:
911    - .stage-2
912    - .linux_test
913    - .coverage-disable
914  tags:
915    - gce-u22-stage2
916  variables:
917    TEST_ARCH: arch-ci-linux-clang-ubsan
918    LOAD_MODULES: llvm/17.0.4
919
920linux-opt-arm:
921  extends:
922    - .stage-3
923    - .linux_test
924    # gcovr does not work on arm/linux
925    - .coverage-disable
926  tags:
927    - arch:arm, os:linux
928  variables:
929    TEST_ARCH: arch-ci-linux-opt-arm
930
931linux-pkgs-64idx:
932  extends:
933    - .stage-3
934    - .linux_test
935  tags:
936    - gce-u22-stage3, linux-mcpu
937  variables:
938    TEST_ARCH: arch-ci-linux-pkgs-64idx
939    LOAD_MODULES: intel-oneapi-mkl/2022.0.2
940
941linux-64idx-i8:
942  extends:
943    - .stage-3
944    - .linux_test
945  tags:
946    - gce-u22-stage3, linux-mcpu
947  variables:
948    TEST_ARCH: arch-ci-linux-64idx-i8
949
950linux-gcc-ifc-cmplx:
951  extends:
952    - .stage-3
953    - .linux_test_nofflags
954  tags:
955    - gce-u22-stage3
956  variables:
957    TEST_ARCH: arch-ci-linux-gcc-ifc-cmplx
958    LOAD_MODULES: intel-oneapi-compilers/2022.2.1
959
960linux-opt-cxx-quad:
961  extends:
962    - .stage-3
963    - .linux_test
964  tags:
965    - gce-u22-stage3
966  variables:
967    TEST_ARCH: arch-ci-linux-opt-cxx-quad
968    MODULEPATH: /nfs/gce/projects/petsc/soft/u22.04/spack-2024-08-30/modules/linux-ubuntu22.04-x86_64/Core
969    LOAD_MODULES: python/3.13.0rc1-rayc5m7
970
971linux-ILP64:
972  extends:
973    - .stage-3
974    - .linux_test
975  tags:
976    - gce-u22-stage3
977  variables:
978    TEST_ARCH: arch-ci-linux-ILP64
979    LOAD_MODULES: gcc/8.5.0 mpich/2-1.5-gcc-8.5.0
980    MAKE_CFLAGS: -Wno-discarded-qualifiers -Werror
981
982linux-64idx-i8-uni:
983  extends:
984    - .stage-3
985    - .linux_test
986  tags:
987    - gce-u22-stage3, linux-mcpu
988  variables:
989    TEST_ARCH: arch-ci-linux-64idx-i8-uni
990
991linux-misc-32bit:
992  extends:
993    - .stage-3
994    - .linux_test
995  tags:
996    - gce-u22-stage3
997  variables:
998    TEST_ARCH: arch-ci-linux-misc-32bit
999
1000mswin-intel-cxx-cmplx:
1001  extends:
1002    - .stage-3
1003    - .mswin_test
1004  tags:
1005    - mswin-stage3
1006  variables:
1007    TEST_ARCH: arch-ci-mswin-intel-cxx-cmplx
1008    TIMEOUT: 150
1009
1010mswin-uni:
1011  extends:
1012    - .stage-3
1013    - .mswin_test
1014  tags:
1015    - mswin-stage3
1016  variables:
1017    PETSC_OPTIONS: -check_pointer_intensity 0 -error_output_stdout
1018    TEST_ARCH: arch-ci-mswin-uni
1019
1020mswin-gnu:
1021  extends:
1022    - .stage-3
1023    - .mswin_test
1024  tags:
1025    - mswin-stage3
1026  variables:
1027    TEST_ARCH: arch-ci-mswin-gnu
1028    MAKE_CFLAGS: -Werror
1029    MAKE_CXXFLAGS: -Werror
1030    MAKE_FFLAGS: -Werror
1031    DISABLE_TESTS: 1
1032
1033#mswin-intel:
1034#  extends:
1035#    - .stage-3
1036#    - .mswin_test
1037#  tags:
1038#    - os:win
1039#  variables:
1040#    TEST_ARCH: arch-ci-mswin-intel
1041
1042osx-cxx-cmplx-pkgs-dbg:
1043  extends:
1044    - .stage-3
1045    - .osx_test
1046    - .coverage-disable
1047  tags:
1048    - os:macos-x64
1049  variables:
1050    TEST_ARCH: arch-ci-osx-cxx-cmplx-pkgs-dbg
1051    INIT_SCRIPT: .zprofile
1052
1053osx-cxx-pkgs-opt-arm:
1054  extends:
1055    - .stage-3
1056    - .osx_test
1057    - .coverage-disable
1058  tags:
1059    - os:macos-arm
1060  variables:
1061    PETSC_OPTIONS: -vecscatter_mpi1 false -options_left false
1062    TEST_ARCH: arch-ci-osx-cxx-pkgs-opt-arm
1063    MAKE_CXXFLAGS: -Werror -Wno-pass-failed
1064    INIT_SCRIPT: .zprofile
1065
1066osx-dbg:
1067  extends:
1068    - .stage-3
1069    - .osx_test
1070    - .coverage-disable
1071  tags:
1072    - os:macos-x64
1073  variables:
1074    TEST_ARCH: arch-ci-osx-dbg
1075    ASAN_OPTIONS: log_path=stdout
1076    INIT_SCRIPT: .zprofile
1077
1078osx-xsdk-opt:
1079  extends:
1080    - .stage-3
1081    - .osx_test
1082    - .coverage-disable
1083  tags:
1084    - os:macos-x64
1085  variables:
1086    TEST_ARCH: arch-ci-osx-xsdk-opt
1087    INIT_SCRIPT: .zprofile
1088
1089# job for analyzing the coverage results and generating the various reports
1090coverage-analyze:
1091  extends: .test
1092  stage: stage-4
1093  tags:
1094    - gce-u22-short
1095  dependencies:
1096    # stage-2
1097    - linux-gcc-quad-64idx-dbg
1098    - linux-gcc-pkgs-opt
1099    - linux-gcc-complex-opt-32bit
1100    # stage-3
1101    - linux-pkgs-dbg
1102    - linux-matlab-ilp64
1103    - linux-cuda-pkgs
1104    - linux-cxx-cmplx-pkgs-64idx
1105    - linux-cuda-cmplx
1106    - linux-cuda-double-64idx
1107    - linux-cuda-uni-pkgs
1108    - linux-viennacl
1109    - linux-without-fc
1110    - linux-gcc-cxx-avx2
1111    - linux-clang-avx
1112    - linux-pkgs-cxx-mlib
1113    - linux-pkgs-valgrind
1114    - linux-nagfor
1115    - linux-xsdk-dbg
1116    - linux-pkgs-64idx
1117    - linux-pkgs-opt
1118    - linux-64idx-i8
1119    - linux-gcc-ifc-cmplx
1120    - linux-opt-cxx-quad
1121    - linux-ILP64
1122    - linux-64idx-i8-uni
1123  variables:
1124    PYTHON: python3
1125    PETSC_ARCH: arch-ci-analyze-pipeline
1126  before_script:
1127    - date
1128    - hostname
1129  script:
1130    - if [ ! -z ${LOAD_MODULES+x} ]; then module --trace load ${LOAD_MODULES}; module list; fi
1131    - ${PYTHON} --version
1132    - gcovr --version
1133    - printf "PATH:$PATH\n"
1134    - printf "PYTHONPATH:$PYTHONPATH\n"
1135    - if [ ! -z ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME+x} ]; then printf "CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME\n" ;fi
1136    - ${PYTHON} ./configure --with-mpi=0 --with-cxx=0 --download-sowing --with-fortran-bindings
1137    - make mergegcov PETSC_GCOV_OPTIONS='--ci-mode --verbose'
1138  coverage: /^\s*lines:\s*\d+.\d+\%/
1139  artifacts:
1140    name: "$CI_JOB_NAME"
1141    when: always
1142    paths:
1143    - arch-ci-analyze-pipeline/gcovr/*
1144    - arch-ci-analyze-pipeline/lib/petsc/conf/*.log
1145    expire_in: 4 days
1146    reports:
1147      coverage_report:
1148        coverage_format: cobertura
1149        path: arch-ci-analyze-pipeline/gcovr/xml/*.xml
1150
1151# template for the coverage review jobs, these must be separate jobs as you cannot deploy multiple
1152# environments from one job...
1153.coverage-review:
1154  extends: .test
1155  stage: .post
1156  tags:
1157    - gce-u22-short
1158  dependencies:
1159    - coverage-analyze
1160  script:
1161    - date
1162    - hostname
1163  artifacts:
1164    name: "$CI_JOB_NAME"
1165    when: always
1166    paths:
1167    - arch-ci-analyze-pipeline/gcovr/*
1168    - arch-ci-analyze-pipeline/lib/petsc/conf/*.log
1169    expire_in: 4 days
1170
1171coverage-total-review:
1172  extends: .coverage-review
1173  environment:
1174    name: coverage/all/$CI_COMMIT_REF_SLUG
1175    url: https://$CI_PROJECT_NAMESPACE.gitlab.io/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/arch-ci-analyze-pipeline/gcovr/html/report.html
1176    auto_stop_in: one week
1177    deployment_tier: testing
1178
1179coverage-untested-review:
1180  extends: .coverage-review
1181  environment:
1182    name: coverage/untested/$CI_COMMIT_REF_SLUG
1183    url: https://$CI_PROJECT_NAMESPACE.gitlab.io/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/arch-ci-analyze-pipeline/gcovr/html_untested/report_untested.html
1184    auto_stop_in: one week
1185    deployment_tier: testing
1186
1187analyze-pipeline:
1188  extends: .coverage-review
1189  script:
1190    - date
1191    - hostname
1192    # This file is created by lib/petsc/bin/maint/gcov.py. If it exists then the CI
1193    # pipeline should fail
1194    - if [ -f ./arch-ci-analyze-pipeline/gcovr/.CI_FAIL ]; then
1195        cat ./arch-ci-analyze-pipeline/gcovr/merge_gcov_errors.log;
1196        exit 1;
1197      fi
1198  allow_failure: true
1199
1200#
1201# Base job for a documentation build (runs in venv to allow installing additional packages without root)
1202#
1203.docs:
1204  stage: stage-2
1205  tags:
1206    - linux-docs
1207  before_script:
1208    - git fetch --unshallow --tags origin +release:remotes/origin/release +main:remotes/origin/main
1209    - module --trace load python-3.11.2-gcc-9.4.0-6p2ktlj
1210    - printf "PATH:$PATH\n"
1211    - printf "PYTHONPATH:$PYTHONPATH\n"
1212    - VENV=venv-petsc-docs &&
1213      python3 -m venv $VENV &&
1214      . $VENV/bin/activate &&
1215      cd doc &&
1216      python -m pip install -r requirements.txt
1217
1218#
1219# Build documentation and make available for review using GitLab pages
1220#
1221docs-review:
1222  extends:
1223    - .docs
1224    - .test-basic
1225  script:
1226    - printf "PATH:$PATH\n"
1227    - printf "PYTHONPATH:$PYTHONPATH\n"
1228    #- printf "python:${PYTHON}\n"
1229    #- ${PYTHON} -m pip list --user
1230    - printf "CONFIG_OPTS:${CONFIG_OPTS}\n"
1231    - printf "PETSC_OPTIONS:$PETSC_OPTIONS\n"
1232    - if [ ! -z ${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME+x} ]; then printf "CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME\n" ;fi
1233    - (time make html BUILDDIR="../public" SPHINXOPTS="-T -E -W --keep-going -j 2") || (printf "Sphinx build failed (warnings count as errors)\n" && false)
1234    - (time make latexpdf SPHINXOPTS="-T -E -W --keep-going -j 2") || (printf "Sphinx build failed (warnings count as errors)\n" && false)
1235    - cp _build/latex/manual.pdf ../public/html/manual/
1236  environment:
1237    name: review/$CI_COMMIT_REF_NAME
1238    url: https://$CI_PROJECT_NAMESPACE.gitlab.io/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/public/html/index.html
1239    auto_stop_in: one week
1240    deployment_tier: development
1241  artifacts:
1242    paths:
1243      - public
1244    expire_in: 4 days
1245  except:
1246    variables:
1247      - $PETSC_CI_SCHEDULED =~ /yes/
1248
1249#
1250# Deploy documentation using GitLab pages
1251#
1252pages: # this job name has special meaning to GitLab
1253  extends: .docs
1254  interruptible: true
1255  script:
1256    - mkdir -p ../public/ && cp public/* ../public/
1257    - (git checkout origin/main && pip install -r requirements.txt && make website-deploy SPHINXOPTS="-j 1" BUILDDIR="../public/main" && make latexpdf && mkdir -p ../public/main/manual && cp _build/latex/manual.pdf ../public/main/manual/) || (printf "Sphinx build failed (warnings count as errors)\n" && false)
1258    - cd .. && git clean -fdxq -e public -e venv-petsc-docs && cd doc && rm -rf images
1259    - (git checkout origin/release && pip install -r requirements.txt && make website-deploy SPHINXOPTS="-j 1" BUILDDIR="../public/release" && make latexpdf && mkdir -p ../public/release/manual && cp _build/latex/manual.pdf ../public/release/manual/) || (printf "Sphinx build failed (warnings count as errors)\n" && false)
1260    - rm -rf ../public/*/.doctrees
1261  only:
1262    variables:
1263      - $PETSC_CI_SCHEDULED == "yes"
1264  artifacts:
1265    paths:
1266      - public
1267    expire_in: 4 days
1268
1269#
1270#
1271# The following tests are experimental; more tests by users at other sites may be added below this. Experimental test
1272# that fail produce a warning, but do not block execution of a pipeline.
1273#
1274
1275.test-experimental:
1276  extends: .test
1277  allow_failure: true
1278
1279