stages:
  - test
  - ci-status

variables:
  GIT_STRATEGY: fetch
  GIT_DEPTH: 1

.test:
  stage: test
  image: jedbrown/mpich
  before_script:
    - echo nproc=$(nproc)
    - cat /proc/cpuinfo
  script:
    - python3 ./configure --with-debugging=0 COPTFLAGS='-O -march=native' CXXOPTFLAGS='-O -march=native' FOPTFLAGS='-O -march=native' ${CONFIG_OPTS}
    - make -j$(nproc) -l$(nproc)
    - make -j$(nproc) -l$(nproc) -f gmakefile test search="${TEST_SEARCH}"

mpich:
  extends: .test
  variables:
    CONFIG_OPTS: --with-mpi-dir=/usr/local --with-fc=0
    TEST_SEARCH: snes_tutorials-ex48%

uni-complex-float-int64:
  extends: .test
  variables:
    CONFIG_OPTS: <
      --with-mpi=0
      --with-scalar-type=complex --with-precision=single --with-64-bit-indices
    TEST_SEARCH: ts_tutorials-ex11_adv_2d_quad_%

.status:
  stage: ci-status
  image: jedbrown/alpine-curl
  script:
    - BUILD_KEY=push BITBUCKET_NAMESPACE=petsc ./.gitlab-build-status.sh

success:
  extends: .status
  variables:
    BUILD_STATUS: passed
  when: on_success

failure:
  extends: .status
  variables:
    BUILD_STATUS: failed
  when: on_failure
