xref: /petsc/.gitlab-ci.yml (revision 098f7b70bc560cbbb862425806bf32fcd2aa70e5)
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-x=0 --with-bison=0 --with-cmake=0 --with-pthread=0 --with-regex=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  artifacts:
265    name: "$CI_JOB_NAME"
266    when: always
267    paths:
268      - arch-*/lib/petsc/conf/*.patch
269      - arch-*/lib/petsc/conf/*.log
270    expire_in: 4 days
271
272pause-for-approval:
273  extends: .test
274  stage: .pre
275  tags:
276    - gce-stage1
277  only:
278    refs:
279      - merge_requests
280    variables:
281      - $CI_MERGE_REQUEST_EVENT_TYPE == "merged_result"
282      - $CI_MERGE_REQUEST_EVENT_TYPE == "detached"
283  script:
284    - echo "pause-for-approval has no script to run"
285  variables:
286    GIT_STRATEGY: none
287  when: manual
288  allow_failure: false
289
290#
291# Basic template for code coverage generation. Tests should additionally inherit from the more
292# specialized OS-specific versions instead of this one.
293#
294
295.coverage-generate:
296  variables:
297    RUN_GCOV: 1
298    RUN_GCOV_OPTIONS: --decisions
299
300.coverage-disable:
301  variables:
302    RUN_GCOV: 0
303
304#
305# This provides the basic order of operations and options template for stage-2,3 tests.
306# Not all stage-2,3 need to follow this template, but most will.
307#
308.stage-23:
309  extends:
310    - .test
311    - .coverage-generate
312  script:
313    - if [ ! -z ${LOAD_MODULES+x} ]; then module --trace load ${LOAD_MODULES}; module list; fi
314    - if [ ! -z ${GCOV_MODULES+x} ]; then module --trace load ${GCOV_MODULES}; module list; fi
315    - 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
316    - if [ "${RUN_GCOV}" == 1 ]; then
317      printf "RUN_GCOV_OPTIONS:$RUN_GCOV_OPTIONS\n";
318      gcovr --version;
319      fi
320    - 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
321    - printf "PATH:$PATH\n"
322    - printf "PYTHONPATH:$PYTHONPATH\n"
323    - printf "EXTRA_OPTIONS_INITIAL:$EXTRA_OPTIONS_INITIAL $BASE_EXTRA_OPTIONS\n"
324    - 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
325    - printf "./config/examples/${TEST_ARCH}.py\n"
326    - cat ./config/examples/${TEST_ARCH}.py
327    - ./config/examples/${TEST_ARCH}.py || if [ -f naglicenseproblem ]; then exit 126; else exit 1; fi
328    - make CFLAGS="${MAKE_CFLAGS}" CXXFLAGS="${MAKE_CXXFLAGS}" FFLAGS="${MAKE_FFLAGS}" CUDAFLAGS="${MAKE_CUDAFLAGS}" || if [ -f naglicenseproblem ]; then exit 126; else exit 1; fi
329    - 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)
330    - 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
331    - make updatedatafiles
332    - 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
333    - 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
334    - if [ "${RUN_GCOV}" == 1 ]; then make gcov PETSC_GCOV_OPTIONS="${RUN_GCOV_OPTIONS}"; fi
335  artifacts:
336    reports:
337      junit: arch-*/tests/testresults.xml
338    name: "$CI_JOB_NAME"
339    when: always
340    paths:
341      - arch-*/lib/petsc/conf/*.log
342      - arch-*/lib/pkgconfig/petsc.pc
343      - arch-*/tests/testresults.xml
344      - arch-*/tests/test_arch-*_tap.log
345      - arch-*/tests/test_arch-*_err.log
346      - arch-*/arch-*-gcovr-report.json.tar.bz2
347    expire_in: 4 days
348  variables:
349    OPENBLAS_NUM_THREADS: 1
350
351.stage-2:
352  extends: .stage-23
353  stage: stage-2
354
355.stage-3:
356  extends: .stage-23
357  stage: stage-3
358
359#
360# The following provide templates for various OSes for pre/post info
361#
362
363.linux_test_noflags:
364  before_script:
365    - date
366    - hostname
367    - grep PRETTY_NAME /etc/os-release
368    - nproc
369    - lscpu
370    - ccache --zero-stats
371  after_script:
372    - date
373    - ccache --show-stats
374
375.linux_test_nofflags:
376  extends: .linux_test_noflags
377  variables:
378    MAKE_CFLAGS: -Werror
379    MAKE_CXXFLAGS: -Werror
380
381.linux_test:
382  extends: .linux_test_noflags
383  variables:
384    MAKE_CFLAGS: -Werror
385    MAKE_CXXFLAGS: -Werror
386    MAKE_FFLAGS: -Werror
387
388.freebsd_test:
389  extends:
390    - .coverage-disable
391  variables:
392    MAKE_CFLAGS: -Werror
393    MAKE_CXXFLAGS: -Werror
394    MAKE_FFLAGS: -Werror
395  before_script:
396    - date
397    - hostname
398    - freebsd-version
399    - echo $(sysctl -n hw.ncpu)
400    - ccache --zero-stats
401  after_script:
402    - date
403    - ccache --show-stats
404
405.macos_test:
406  variables:
407    MAKE_CFLAGS: -Werror
408    MAKE_CXXFLAGS: -Werror
409    MAKE_FFLAGS: -Werror
410  before_script:
411    - date
412    - hostname
413    - sw_vers -productVersion
414    - echo $(sysctl -n hw.ncpu)
415    - ccache --zero-stats
416  after_script:
417    - date
418    - ccache --show-stats
419
420.mswin_test:
421  extends:
422    - .coverage-disable
423  before_script:
424    - date
425    - hostname
426    - uname -a
427    - nproc
428  after_script:
429    - date
430
431#
432# The following tests run as part of stage-2.
433#
434# The tags variable used in the tests below connects the particular test with the runners
435# listed on the left hand side of https://gitlab.com/petsc/petsc/-/settings/ci_cd.
436# For example the test 'linux-sycl-double' any runner that has the tags 'gce-u22-stage3, linux-fast'
437# (in a blue box beneath it)
438#
439
440macos-arm:
441  extends:
442    - .stage-3
443    - .macos_test
444    - .coverage-disable
445  tags:
446    - os:macos-arm
447  variables:
448    TEST_ARCH: arch-ci-macos-arm
449    EXTRA_OPTIONS_INITIAL: -check_pointer_intensity 0 -error_output_stdout
450    INIT_SCRIPT: .zprofile
451
452freebsd-cxx-cmplx-64idx-dbg:
453  extends:
454    - .stage-2
455    - .freebsd_test
456  tags:
457    - os:fbsd
458  variables:
459    TEST_ARCH: arch-ci-freebsd-cxx-cmplx-64idx-dbg
460
461freebsd-c-single-opt:
462  extends:
463    - .stage-2
464    - .freebsd_test
465  tags:
466    - os:fbsd
467  variables:
468    TEST_ARCH: arch-ci-freebsd-c-single-opt
469
470mswin-opt-impi:
471  extends:
472    - .stage-3
473    - .mswin_test
474  tags:
475    - mswin-stage3
476  variables:
477    TEST_ARCH: arch-ci-mswin-opt-impi
478    TEST_OPTS: search='ksp_ksp_tests*'
479
480linux-gcc-quad-64idx-dbg:
481  extends:
482    - .stage-2
483    - .linux_test
484  tags:
485    - gce-u24-stage2
486    - linux-gcov
487  variables:
488    TEST_ARCH: arch-ci-linux-gcc-quad-64idx-dbg
489
490linux-gcc-pkgs-opt:
491  extends:
492    - .stage-2
493    - .linux_test
494  tags:
495    - gce-u24-stage2
496    - linux-gcov
497  variables:
498    TEST_ARCH: arch-ci-linux-gcc-pkgs-opt
499  except:
500    variables:
501      - $PETSC_CI_SCHEDULED =~ /yes/
502
503linux-gcc-complex-opt-32bit:
504  extends:
505    - .stage-2
506    - .linux_test
507  tags:
508    - gce-u24-stage2
509    - linux-gcov
510  variables:
511    TEST_ARCH: arch-ci-linux-gcc-complex-opt-32bit
512
513linux-emcc:
514  extends:
515    - .stage-2
516    - .linux_test
517    - .coverage-disable
518  tags:
519    - gce-u24-stage2
520  variables:
521    TEST_ARCH: arch-ci-linux-emcc
522    INIT_SCRIPT: /nfs/gce/projects/petsc/soft/u22.04/emsdk/emsdk_env.sh
523    DISABLE_TESTS: 1
524
525#
526# The following tests run as part of stage-3.
527#
528
529freebsd-cxx-cmplx-pkgs-dbg:
530  extends:
531    - .stage-3
532    - .freebsd_test
533  tags:
534    - os:fbsd
535  variables:
536    TEST_ARCH: arch-ci-freebsd-cxx-cmplx-pkgs-dbg
537
538freebsd-cxx-pkgs-opt:
539  extends:
540    - .stage-3
541    - .freebsd_test
542  tags:
543    - os:fbsd
544  variables:
545    EXTRA_OPTIONS_INITIAL: -vecscatter_mpi1 false -options_left false
546    TEST_ARCH: arch-ci-freebsd-cxx-pkgs-opt
547
548freebsd-pkgs-opt:
549  extends:
550    - .stage-3
551    - .freebsd_test
552  tags:
553    - os:fbsd
554  variables:
555    TEST_ARCH: arch-ci-freebsd-pkgs-opt
556    MAKE_CFLAGS: -DPETSC_SKIP_COMPLEX -Werror
557
558linux-hip-double:
559  extends:
560    - .stage-3
561    - .linux_test_noflags
562    - .coverage-disable
563  tags:
564    - gpu:amd
565    - os:linux
566  variables:
567    TEST_ARCH: arch-ci-linux-hip-double
568
569linux-hip-cmplx:
570  extends:
571    - .stage-3
572    - .linux_test_noflags
573    - .coverage-disable
574  tags:
575    - gpu:amd
576    - os:linux
577  variables:
578    TEST_ARCH: arch-ci-linux-hip-cmplx
579
580linux-sycl-double:
581  extends:
582    - .stage-3
583    - .linux_test_nofflags
584    - .coverage-disable
585  tags:
586    - gce-u22-stage3
587    - linux-fast
588  variables:
589    MODULEPATH: /nfs/gce/projects/petsc/soft/oneapi/2025.2.0/modulefiles
590    TEST_ARCH: arch-ci-linux-sycl-double
591    LOAD_MODULES: tbb/latest compiler-rt/latest umf/latest compiler/latest mpi/latest dpl/latest
592    TEST_OPTS: query=requires queryval=kokkos_kernels
593    MAKE_CFLAGS: -Wno-expected-file-type -Werror
594
595linux-cuda-pkgs:
596  extends:
597    - .stage-3
598    - .linux_test
599  tags:
600    - cuda-stage3
601  variables:
602    TEST_ARCH: arch-ci-linux-cuda-pkgs
603    # run all tests that:
604    # 1. require cuda, OR
605    # 2. require device, OR
606    # 3. require hypre, OR
607    # 4. require kokkos[_kernels], AND lives in the vec subdirectory
608    #
609    # need to use the alternate OR spelling since '|' is interpreted as a pipe by the
610    # shell, and I could not manage to escape it enough times...
611    TEST_OPTS: -j3 queryval='cuda,device,hypre,kokkos*,vec*' query='requires,requires,requires,requires%OR%name'
612    MAKE_CUDAFLAGS: --compiler-options -Wall,-Werror
613    OMP_PROC_BIND: false
614
615linux-kokkos-cuda:
616  extends:
617    - .stage-3
618    - .linux_test
619  tags:
620    - cuda-stage3
621  variables:
622    TEST_ARCH: arch-ci-linux-kokkos-cuda
623    # run all tests that:
624    # 1. require cuda, OR
625    # 2. require kokkos[_kernels]
626    #
627    # need to use the alternate OR spelling since '|' is interpreted as a pipe by the
628    # shell, and I could not manage to escape it enough times...
629    TEST_OPTS: -j3 queryval='cuda,kokkos*' query='requires,requires'
630    MAKE_CUDAFLAGS: --compiler-options -Wall,-Werror
631    OMP_PROC_BIND: false
632    MODULEPATH: /nfs/gce/projects/petsc/soft/u22.04/spack-2024-11-27-cuda/modules/linux-ubuntu22.04-x86_64/Core
633    LOAD_MODULES: cuda/12.8.0-rz6425d
634
635linux-cuda112-omp:
636  extends:
637    - .stage-3
638    - .linux_test
639    - .coverage-disable
640  tags:
641    - cuda-stage3
642  variables:
643    TEST_ARCH: arch-ci-linux-cuda112-omp
644    TEST_OPTS: -j4 query=requires queryval=kokkos_kernels
645    LOAD_MODULES: cuda/11.2.2 u-gcc-9/9.4.0
646    OMP_PROC_BIND: "false"
647    OMP_NUM_THREADS: 1
648    MAKE_CUDAFLAGS: --compiler-options -Wall,-Werror
649
650linux-cuda-cmplx:
651  extends:
652    - .stage-3
653    - .linux_test
654  tags:
655    - cuda-stage3
656  variables:
657    TEST_ARCH: arch-ci-linux-cuda-cmplx
658    MAKE_CUDAFLAGS: --compiler-options -Wall,-Werror
659
660linux-cuda-double-64idx:
661  extends:
662    - .stage-3
663    - .linux_test
664  tags:
665    - cuda12
666  variables:
667    TEST_ARCH: arch-ci-linux-cuda-double-64idx
668    TEST_OPTS: -j3 query=requires queryval=cuda
669    MAKE_CUDAFLAGS: --compiler-options -Wall,-Werror
670
671linux-cuda-latest:
672  extends:
673    - .stage-3
674    - .linux_test
675  tags:
676    - cuda13
677  variables:
678    TEST_ARCH: arch-ci-linux-cuda-latest
679    TEST_OPTS: -j3 query=requires queryval=cuda
680    MAKE_CUDAFLAGS: --compiler-options -Wall,-Werror
681
682linux-cuda-single-cxx:
683  extends:
684    - .stage-3
685    - .linux_test_noflags
686    - .coverage-disable
687  tags:
688    - cuda-stage3
689  variables:
690    TEST_ARCH: arch-ci-linux-cuda-single-cxx
691    MODULEPATH: /nfs/gce/projects/petsc/soft/u22.04/spack-2023-02-02/share/spack/modules/linux-ubuntu22.04-ivybridge
692    LOAD_MODULES: nvhpc-22.11-gcc-11.3.0-vmvmbrx
693    TEST_OPTS: -j15 query=requires queryval=cuda
694
695linux-cuda-uni-pkgs:
696  extends:
697    - .stage-3
698    - .linux_test
699  tags:
700    - cuda-stage3
701  variables:
702    TEST_ARCH: arch-ci-linux-cuda-uni-pkgs
703    TEST_OPTS: -j20 query=requires queryval=cuda
704    MAKE_CUDAFLAGS: --compiler-options -Wall,-Werror
705
706linux-clang-cuda:
707  extends:
708    - .stage-3
709    - .linux_test
710    - .coverage-disable
711  tags:
712    - cuda-stage3
713  variables:
714    TEST_ARCH: arch-ci-linux-clang-cuda
715    TEST_OPTS: -j 1 queryval='cuda*,snes*' query='requires%OR%name'
716    MODULEPATH: /nfs/gce/projects/petsc/soft/u22.04/spack-2023-02-02/share/spack/modules/linux-ubuntu22.04-ivybridge
717    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
718    MAKE_CUDAFLAGS: -Wno-pass-failed -Werror
719
720linux-viennacl:
721  extends:
722    - .stage-3
723    - .linux_test
724  tags:
725    - cuda-stage3
726  variables:
727    TEST_ARCH: arch-ci-linux-viennacl
728    MAKE_CXXFLAGS: -Werror -Wno-ignored-attributes
729    TEST_OPTS: -j20 query=requires queryval=viennacl
730
731linux-without-fc:
732  extends:
733    - .stage-3
734    - .linux_test
735  tags:
736    - gce-u22-stage3
737  variables:
738    TEST_ARCH: arch-ci-linux-without-fc
739
740linux-flang-arm:
741  extends:
742    - .stage-3
743    - .linux_test_noflags
744    # gcovr does not work on arm/linux
745    - .coverage-disable
746  tags:
747    - arch:arm
748    - os:linux
749  variables:
750    TEST_ARCH: arch-ci-linux-flang-arm
751
752linux-cmplx-single-arm:
753  extends:
754    - .stage-3
755    - .linux_test
756    # gcovr does not work on arm/linux
757    - .coverage-disable
758  tags:
759    - arch:arm
760    - os:linux
761  variables:
762    FLEXIBLAS: netlib
763    TEST_ARCH: arch-ci-linux-cmplx-single-arm
764
765linux-gcc-cxx-avx2:
766  extends:
767    - .stage-3
768    - .linux_test
769  tags:
770    - name:petsc-knl-01
771  variables:
772    TEST_ARCH: arch-ci-linux-gcc-cxx-avx2
773
774linux-clang-avx:
775  extends:
776    - .stage-3
777    - .linux_test
778  tags:
779    - name:petsc-knl-01
780  variables:
781    TEST_ARCH: arch-ci-linux-clang-avx
782
783linux-knl:
784  extends:
785    - .stage-3
786    - .linux_test
787    - .coverage-disable
788  tags:
789    - name:petsc-knl-01
790  variables:
791    MAKE_FFLAGS: -warn errors
792    TEST_ARCH: arch-ci-linux-knl
793    LOAD_MODULES: intel-oneapi-compilers/2022.0.2 intel-oneapi-mkl/2022.0.2 intel-oneapi-mpi/2021.5.1
794
795linux-intel-mkl-single:
796  extends:
797    - .stage-3
798    - .linux_test_nofflags
799    - .coverage-disable
800  tags:
801    - name:petsc-knl-01
802  variables:
803    TEST_ARCH: arch-ci-linux-intel-mkl-single
804    LOAD_MODULES: intel-oneapi-compilers/2022.0.2 intel-oneapi-mkl/2022.0.2 intel-oneapi-mpi/2021.5.1
805
806linux-cxx-cmplx-pkgs-64idx:
807  extends:
808    - .stage-3
809    - .linux_test
810  tags:
811    - gce-u22-stage3
812  variables:
813    TEST_ARCH: arch-ci-linux-cxx-cmplx-pkgs-64idx
814    EXTRA_OPTIONS_INITIAL: -fp_trap
815    MODULEPATH: /nfs/gce/projects/petsc/soft/u22.04/spack-2024-08-30/modules/linux-ubuntu22.04-x86_64/Core
816    LOAD_MODULES: python/3.13.0rc1-rayc5m7 py-setuptools/69.2.0-6yku3zk python-venv/1.0-bnbfk2n py-pip/23.1.2-o7dlzno
817
818# Set env vars for 'Kokkos + OpenMP' tests, so that they won't give warnings
819linux-pkgs-dbg-ftn-interfaces:
820  extends:
821    - .stage-3
822    - .linux_test
823    - .coverage-disable
824  tags:
825    - gce-u22-stage3
826  variables:
827    TEST_ARCH: arch-ci-linux-pkgs-dbg-ftn-interfaces
828    OMP_PROC_BIND: "false"
829    OMP_NUM_THREADS: 4
830    EXTRA_OPTIONS_INITIAL: -fp_trap
831
832linux-pkgs-cxx-mlib:
833  extends:
834    - .stage-3
835    - .linux_test
836  tags:
837    - gce-u22-stage3
838  variables:
839    TEST_ARCH: arch-ci-linux-pkgs-cxx-mlib
840    EXTRA_OPTIONS_INITIAL: -fp_trap
841    LOAD_MODULES: python/3.8.13
842
843linux-pkgs-valgrind:
844  extends:
845    - .stage-3
846    - .linux_test
847  tags:
848    - gce-valgrind
849  variables:
850    TEST_ARCH: arch-ci-linux-pkgs-valgrind
851    TIMEOUT: 1200
852    UCX_SYSV_HUGETLB_MODE: n
853
854linux-pkgs-opt:
855  extends:
856    - .stage-3
857    - .linux_test
858  tags:
859    - gce-u22-stage3
860    - linux-fast
861  variables:
862    TEST_ARCH: arch-ci-linux-pkgs-opt
863    LOAD_MODULES: gcc/12.1.0
864    MAKE_CFLAGS: -Wno-unused-const-variable -Werror
865    MAKE_CXXFLAGS: -Wno-deprecated-declarations -Werror
866    MPI4PY_BUILD_PYSABI: 1
867    PETSC4PY_BUILD_PYSABI: 1
868    SLEPC4PY_BUILD_PYSABI: 1
869
870linux-pkgs-dbg:
871  extends:
872    - .stage-3
873    - .linux_test
874  tags:
875    - gce-u22-stage3
876    - linux-gcov
877  variables:
878    TEST_ARCH: arch-ci-linux-pkgs-dbg
879    EXTRA_OPTIONS_INITIAL: -fp_trap
880
881linux-matlab-ilp64:
882  extends:
883    - .stage-3
884    - .linux_test
885  tags:
886    - gce-u22-stage3
887    - linux-gcov
888  variables:
889    TEST_ARCH: arch-ci-linux-matlab-ilp64
890    LOAD_MODULES: gcc/9.4.0 matlab/R2022a
891  allow_failure: true
892
893linux-intel-cmplx:
894  extends:
895    - .stage-3
896    - .linux_test_nofflags
897    - .coverage-disable
898  tags:
899    - gce-u22-stage3
900  variables:
901    TEST_ARCH: arch-ci-linux-intel-cmplx
902    LOAD_MODULES: intel-oneapi-compilers/2023.0.0 intel-oneapi-mkl/2022.0.2
903
904linux-misc-dbg:
905  extends:
906    - .stage-3
907    - .linux_test
908  tags:
909    - gce-u22-stage3
910  variables:
911    TEST_ARCH: arch-ci-linux-misc-dbg
912    LOAD_MODULES: gcc/12.1.0
913
914check-each-commit:
915  extends:
916    - .stage-2
917    - .linux_test
918    - .coverage-disable
919  tags:
920    - gce-u22-stage2
921  script:
922    - 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
923    - lib/petsc/bin/maint/check-each-commit.sh
924  except:
925    variables:
926      - $PETSC_CI_SCHEDULED =~ /yes/
927  allow_failure: true
928
929linux-analyzer:
930  extends:
931    - .stage-2
932    - .linux_test
933    - .coverage-disable
934  tags:
935    - gce-u22-stage2
936  script:
937    - printf "PATH:$PATH\n"
938    - printf "PYTHONPATH:$PYTHONPATH\n"
939    - python3 --version
940    - git --version
941    - mypy --version
942    - vermin --version
943    - printf "EXTRA_OPTIONS_INITIAL:$EXTRA_OPTIONS_INITIAL $BASE_EXTRA_OPTIONS\n"
944    - 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
945    - printf "./config/examples/${TEST_ARCH}.py\n"
946    - cat ./config/examples/${TEST_ARCH}.py
947    - ./config/examples/${TEST_ARCH}.py
948    - make LINTER_OPTIONS="${LINTER_OPTIONS}" test-lint
949    - make V=3 LINTER_OPTIONS="${LINTER_OPTIONS} -- ./src" lint
950  variables:
951    TEST_ARCH: arch-ci-linux-analyzer
952    LINTER_OPTIONS: "--PETSC_ARCH=${TEST_ARCH} --clang_lib=`llvm-config-14 --libdir`/libclang.so.1 --werror 1"
953  artifacts:
954    paths:
955      - arch-*/lib/petsc/conf/*.log
956      - ./petscLintPatches/*.patch
957    expire_in: 4 days
958  except:
959    variables:
960      - $PETSC_CI_SCHEDULED =~ /yes/
961
962linux-intel:
963  extends:
964    - .stage-3
965    - .linux_test_nofflags
966    - .coverage-disable
967  tags:
968    - gce-u22-stage3
969  variables:
970    TEST_ARCH: arch-ci-linux-intel
971    LOAD_MODULES: intel-oneapi-compilers/2023.0.0 intel-oneapi-mkl/2022.0.2
972
973linux-clang-ubsan:
974  extends:
975    - .stage-2
976    - .linux_test
977    - .coverage-disable
978  tags:
979    - gce-u22-stage2
980  variables:
981    TEST_ARCH: arch-ci-linux-clang-ubsan
982    LOAD_MODULES: llvm/17.0.4
983
984linux-opt-arm:
985  extends:
986    - .stage-3
987    - .linux_test
988    # gcovr does not work on arm/linux
989    - .coverage-disable
990  tags:
991    - arch:arm
992    - os:linux
993  variables:
994    TEST_ARCH: arch-ci-linux-opt-arm
995
996linux-pkgs-64idx:
997  extends:
998    - .stage-3
999    - .linux_test
1000  tags:
1001    - gce-u22-stage3
1002    - linux-mcpu
1003  variables:
1004    TEST_ARCH: arch-ci-linux-pkgs-64idx
1005    LOAD_MODULES: intel-oneapi-mkl/2022.0.2
1006
1007linux-64idx-i8:
1008  extends:
1009    - .stage-3
1010    - .linux_test
1011  tags:
1012    - gce-u22-stage3
1013    - linux-mcpu
1014  variables:
1015    TEST_ARCH: arch-ci-linux-64idx-i8
1016
1017linux-gcc-ifc-cmplx:
1018  extends:
1019    - .stage-3
1020    - .linux_test_nofflags
1021  tags:
1022    - gce-u22-stage3
1023  variables:
1024    TEST_ARCH: arch-ci-linux-gcc-ifc-cmplx
1025    LOAD_MODULES: intel-oneapi-compilers/2022.2.1
1026
1027linux-opt-cxx-quad:
1028  extends:
1029    - .stage-3
1030    - .linux_test
1031  tags:
1032    - gce-u22-stage3
1033  variables:
1034    TEST_ARCH: arch-ci-linux-opt-cxx-quad
1035    MODULEPATH: /nfs/gce/projects/petsc/soft/u22.04/spack-2024-08-30/modules/linux-ubuntu22.04-x86_64/Core
1036    LOAD_MODULES: python/3.13.0rc1-rayc5m7
1037
1038linux-ILP64:
1039  extends:
1040    - .stage-3
1041    - .linux_test
1042  tags:
1043    - gce-u22-stage3
1044  variables:
1045    TEST_ARCH: arch-ci-linux-ILP64
1046    LOAD_MODULES: gcc/8.5.0 mpich/2-1.5-gcc-8.5.0
1047    MAKE_CFLAGS: -Wno-discarded-qualifiers -Werror
1048
1049linux-64idx-i8-uni:
1050  extends:
1051    - .stage-3
1052    - .linux_test
1053  tags:
1054    - gce-u22-stage3
1055    - linux-mcpu
1056  variables:
1057    TEST_ARCH: arch-ci-linux-64idx-i8-uni
1058
1059linux-misc-32bit:
1060  extends:
1061    - .stage-3
1062    - .linux_test
1063  tags:
1064    - gce-u22-stage3
1065  variables:
1066    TEST_ARCH: arch-ci-linux-misc-32bit
1067
1068mswin-intel-cxx-cmplx:
1069  extends:
1070    - .stage-3
1071    - .mswin_test
1072  tags:
1073    - mswin-stage3
1074  variables:
1075    TEST_ARCH: arch-ci-mswin-intel-cxx-cmplx
1076    TIMEOUT: 150
1077
1078mswin-uni:
1079  extends:
1080    - .stage-3
1081    - .mswin_test
1082  tags:
1083    - mswin-stage3
1084  variables:
1085    EXTRA_OPTIONS_INITIAL: -check_pointer_intensity 0 -error_output_stdout
1086    TEST_ARCH: arch-ci-mswin-uni
1087
1088mswin-gnu:
1089  extends:
1090    - .stage-3
1091    - .mswin_test
1092  tags:
1093    - mswin-stage3
1094  variables:
1095    TEST_ARCH: arch-ci-mswin-gnu
1096    MAKE_CFLAGS: -Werror
1097    MAKE_CXXFLAGS: -Werror
1098    MAKE_FFLAGS: -Werror
1099    DISABLE_TESTS: 1
1100
1101#mswin-intel:
1102#  extends:
1103#    - .stage-3
1104#    - .mswin_test
1105#  tags:
1106#    - os:win
1107#  variables:
1108#    TEST_ARCH: arch-ci-mswin-intel
1109
1110macos-cxx-cmplx-pkgs-dbg-arm:
1111  extends:
1112    - .stage-3
1113    - .macos_test
1114    - .coverage-disable
1115  tags:
1116    - os:macos-arm
1117  variables:
1118    TEST_ARCH: arch-ci-macos-cxx-cmplx-pkgs-dbg-arm
1119    INIT_SCRIPT: .zprofile
1120
1121macos-cxx-pkgs-opt-arm:
1122  extends:
1123    - .stage-3
1124    - .macos_test
1125    - .coverage-disable
1126  tags:
1127    - os:macos-arm
1128  variables:
1129    EXTRA_OPTIONS_INITIAL: -vecscatter_mpi1 false -options_left false
1130    TEST_ARCH: arch-ci-macos-cxx-pkgs-opt-arm
1131    MAKE_CXXFLAGS: -Werror -Wno-pass-failed
1132    INIT_SCRIPT: .zprofile
1133
1134macos-dbg:
1135  extends:
1136    - .stage-3
1137    - .macos_test
1138    - .coverage-disable
1139  tags:
1140    - os:macos-x64
1141  variables:
1142    TEST_ARCH: arch-ci-macos-dbg
1143    ASAN_OPTIONS: log_path=stdout
1144    INIT_SCRIPT: .zprofile
1145
1146macos-opt-arm:
1147  extends:
1148    - .stage-3
1149    - .macos_test
1150    - .coverage-disable
1151  tags:
1152    - os:macos-arm
1153  variables:
1154    TEST_ARCH: arch-ci-macos-opt-arm
1155    INIT_SCRIPT: .zprofile
1156
1157# job for analyzing the coverage results and generating the various reports
1158coverage-analyze:
1159  extends: .test
1160  stage: stage-4
1161  tags:
1162    - gce-u22-short
1163  dependencies:
1164    # stage-2
1165    - linux-gcc-quad-64idx-dbg
1166    - linux-gcc-pkgs-opt
1167    - linux-gcc-complex-opt-32bit
1168    # stage-3
1169    - linux-pkgs-dbg
1170    - linux-matlab-ilp64
1171    - linux-cuda-pkgs
1172    - linux-cxx-cmplx-pkgs-64idx
1173    - linux-cuda-cmplx
1174    - linux-cuda-double-64idx
1175    - linux-cuda-uni-pkgs
1176    - linux-viennacl
1177    - linux-without-fc
1178    - linux-gcc-cxx-avx2
1179    - linux-clang-avx
1180    - linux-pkgs-cxx-mlib
1181    - linux-pkgs-valgrind
1182    - linux-misc-dbg
1183    - linux-pkgs-64idx
1184    - linux-pkgs-opt
1185    - linux-64idx-i8
1186    - linux-gcc-ifc-cmplx
1187    - linux-opt-cxx-quad
1188    - linux-ILP64
1189    - linux-64idx-i8-uni
1190  variables:
1191    PYTHON: python3
1192    PETSC_ARCH: arch-ci-analyze-pipeline
1193  before_script:
1194    - date
1195    - hostname
1196  script:
1197    - if [ ! -z ${LOAD_MODULES+x} ]; then module --trace load ${LOAD_MODULES}; module list; fi
1198    - ${PYTHON} --version
1199    - gcovr --version
1200    - printf "PATH:$PATH\n"
1201    - printf "PYTHONPATH:$PYTHONPATH\n"
1202    - 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
1203    - ${PYTHON} ./configure --with-mpi=0 --with-cxx=0 --download-sowing --with-fortran-bindings
1204    - make mergegcov PETSC_GCOV_OPTIONS='--ci-mode --verbose'
1205  coverage: /^\s*lines:\s*\d+.\d+\%/
1206  artifacts:
1207    name: "$CI_JOB_NAME"
1208    when: always
1209    paths:
1210      - arch-ci-analyze-pipeline/gcovr/*
1211      - arch-ci-analyze-pipeline/lib/petsc/conf/*.log
1212    expire_in: 4 days
1213    reports:
1214      coverage_report:
1215        coverage_format: cobertura
1216        path: arch-ci-analyze-pipeline/gcovr/xml/*.xml
1217
1218# template for the coverage review jobs, these must be separate jobs as you cannot deploy multiple
1219# environments from one job...
1220.coverage-review:
1221  extends: .test
1222  stage: .post
1223  tags:
1224    - gce-u22-short
1225  dependencies:
1226    - coverage-analyze
1227  script:
1228    - date
1229    - hostname
1230  artifacts:
1231    name: "$CI_JOB_NAME"
1232    when: always
1233    paths:
1234      - arch-ci-analyze-pipeline/gcovr/*
1235      - arch-ci-analyze-pipeline/lib/petsc/conf/*.log
1236    expire_in: 4 days
1237
1238coverage-total-review:
1239  extends: .coverage-review
1240  environment:
1241    name: coverage/all/$CI_COMMIT_REF_SLUG
1242    url: https://$CI_PROJECT_NAMESPACE.gitlab.io/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/arch-ci-analyze-pipeline/gcovr/html/report.html
1243    auto_stop_in: one week
1244    deployment_tier: testing
1245
1246coverage-untested-review:
1247  extends: .coverage-review
1248  environment:
1249    name: coverage/untested/$CI_COMMIT_REF_SLUG
1250    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
1251    auto_stop_in: one week
1252    deployment_tier: testing
1253
1254analyze-pipeline:
1255  extends: .coverage-review
1256  script:
1257    - date
1258    - hostname
1259    # This file is created by lib/petsc/bin/maint/gcov.py. If it exists then the CI
1260    # pipeline should fail
1261    - if [ -f ./arch-ci-analyze-pipeline/gcovr/.CI_FAIL ]; then
1262      cat ./arch-ci-analyze-pipeline/gcovr/merge_gcov_errors.log;
1263      exit 1;
1264      fi
1265  allow_failure: true
1266
1267#
1268# Base job for a documentation build (runs in venv to allow installing additional packages without root)
1269#
1270.docs:
1271  stage: stage-2
1272  tags:
1273    - gce-u24-docs
1274  before_script:
1275    - git fetch --unshallow --tags origin +release:remotes/origin/release +main:remotes/origin/main
1276    - printf "PATH:$PATH\n"
1277    - printf "PYTHONPATH:$PYTHONPATH\n"
1278    - VENV=venv-petsc-docs &&
1279      python3 -m venv $VENV &&
1280      . $VENV/bin/activate &&
1281      cd doc &&
1282      python -m pip install -r requirements.txt
1283
1284#
1285# Build documentation and make available for review using GitLab pages
1286#
1287docs-review:
1288  extends:
1289    - .docs
1290    - .test-basic
1291  script:
1292    - printf "PATH:$PATH\n"
1293    - printf "PYTHONPATH:$PYTHONPATH\n"
1294    #- printf "python:${PYTHON}\n"
1295    #- ${PYTHON} -m pip list --user
1296    - printf "CONFIG_OPTS:${CONFIG_OPTS}\n"
1297    - printf "EXTRA_OPTIONS_INITIAL:$EXTRA_OPTIONS_INITIAL $BASE_EXTRA_OPTIONS\n"
1298    - 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
1299    - (time make html BUILDDIR="../public" SPHINXOPTS="-T -E -W --keep-going -j 2") || (printf "Sphinx build failed (warnings count as errors)\n" && false)
1300    - (time make latexpdf SPHINXOPTS="-T -E -W --keep-going -j 2") || (printf "Sphinx build failed (warnings count as errors)\n" && false)
1301    - cp _build/latex/manual.pdf ../public/html/manual/
1302  environment:
1303    name: review/$CI_COMMIT_REF_NAME
1304    url: https://$CI_PROJECT_NAMESPACE.gitlab.io/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/public/html/index.html
1305    auto_stop_in: one week
1306    deployment_tier: development
1307  artifacts:
1308    paths:
1309      - public
1310    expire_in: 4 days
1311  except:
1312    variables:
1313      - $PETSC_CI_SCHEDULED =~ /yes/
1314
1315#
1316# Deploy documentation using GitLab pages
1317#
1318pages: # this job name has special meaning to GitLab
1319  extends: .docs
1320  interruptible: true
1321  script:
1322    - mkdir -p ../public/ && cp public/* ../public/
1323    - (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)
1324    - cd .. && git clean -fdxq -e public -e venv-petsc-docs && cd doc && rm -rf images
1325    - (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)
1326    - rm -rf ../public/*/.doctrees
1327  only:
1328    variables:
1329      - $PETSC_CI_SCHEDULED == "yes"
1330  artifacts:
1331    paths:
1332      - public
1333    expire_in: 4 days
1334
1335#
1336#
1337# The following tests are experimental; more tests by users at other sites may be added below this. Experimental test
1338# that fail produce a warning, but do not block execution of a pipeline.
1339#
1340
1341.test-experimental:
1342  extends: .test
1343  allow_failure: true
1344