##
## Copyright (C) HySoP 2011-2022
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
##         http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##


stages:
  - env
  - configure
  - build
  - install
  - test

env:jammy:
  image: gricad-registry.univ-grenoble-alpes.fr/particle_methods/hysop:jammy
  stage: env
  script:
      - "bash ci/scripts/version.sh"

config:jammy:
  image: gricad-registry.univ-grenoble-alpes.fr/particle_methods/hysop:jammy
  stage: configure
  script:
      - "bash ci/scripts/config.sh $CI_PROJECT_DIR/build/gcc   $CI_PROJECT_DIR/install/gcc gcc-11 g++-11 gfortran-11"
      - "bash ci/scripts/config.sh $CI_PROJECT_DIR/build/clang $CI_PROJECT_DIR/install/clang clang-11 clang++-11 gfortran-11"
  dependencies:
    - env:jammy
  artifacts:
    expire_in: 1 week
    paths:
        - $CI_PROJECT_DIR/build

build:jammy:
  image: gricad-registry.univ-grenoble-alpes.fr/particle_methods/hysop:jammy
  stage: build
  script:
      - "bash ci/scripts/build.sh $CI_PROJECT_DIR/build/gcc gcc-11 g++-11 gfortran-11"
      - "bash ci/scripts/build.sh $CI_PROJECT_DIR/build/clang clang-11 clang++-11 gfortran-11"
  dependencies:
    - config:jammy
  artifacts:
    expire_in: 1 week
    paths:
        - $CI_PROJECT_DIR/build

install:jammy:
  image: gricad-registry.univ-grenoble-alpes.fr/particle_methods/hysop:jammy
  stage: install
  script:
      - "bash ci/scripts/install.sh $CI_PROJECT_DIR/build/gcc $CI_PROJECT_DIR/install/gcc"
  dependencies:
    - build:jammy
  artifacts:
    expire_in: 1 week
    paths:
        - $CI_PROJECT_DIR/install

test:jammy:
  image: gricad-registry.univ-grenoble-alpes.fr/particle_methods/hysop:jammy
  stage: test
  script:
    - "bash ci/scripts/test.sh $CI_PROJECT_DIR/install/gcc $CI_PROJECT_DIR/hysop $CI_PROJECT_DIR/cache"
  dependencies:
    - install:jammy
  cache:
    paths:
      - $CI_PROJECT_DIR/cache
    key: "hysop_cache"
