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