default.yml 2.68 KB
Newer Older
1
2
3
4
default:
  image: $IMAGE

stages:
Dennis Gläser's avatar
Dennis Gläser committed
5
  - configure
6
7
8
9
10
11
12
  - build
  - test

workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE=="parent_pipeline"

13
14
15
16
variables:
  TRIGGER_SOURCE: "unknown"
  MR_TARGET_BRANCH_NAME: "master"

Dennis Gläser's avatar
Dennis Gläser committed
17
18
select tests:
  stage: configure
19
  before_script:
20
    - |
Dennis Gläser's avatar
Dennis Gläser committed
21
22
23
24
      DUMUX_CLONE_BRANCH=master
      if [[ -n "${DUMUX_MR_BRANCH}" ]]; then
        DUMUX_CLONE_BRANCH=${DUMUX_MR_BRANCH}
        echo "Received upstream merge request branch ${DUMUX_MR_BRANCH}"
25
      fi
Dennis Gläser's avatar
Dennis Gläser committed
26
27
    - echo "Checking out branch ${DUMUX_CLONE_BRANCH} in dumux"
    - git clone -b ${DUMUX_CLONE_BRANCH} --depth 1 https://git.iws.uni-stuttgart.de/dumux-repositories/dumux.git
28
    - dunecontrol --opts=$DUNE_OPTS_FILE --only=dumux all
29
  script:
Dennis Gläser's avatar
Dennis Gläser committed
30
31
32
    - |
      dunecontrol --opts=$DUNE_OPTS_FILE --current all
      if [[ -n "${DUMUX_MR_BRANCH}" ]]; then
33
34
35
36
37
38
39
          echo "Detecting test affected by changes in Dumux"
          python3 dumux/bin/testing/getchangedfiles.py -f dumux -o changedfiles.txt -t origin/$DUMUX_MR_BRANCH
          python3 dumux/bin/testing/findtests.py -o affectedtests.json --file-list changedfiles.txt --build-dir build-cmake
      elif [[ "$TRIGGER_SOURCE" == "merge_request_event" ]]; then
          echo "Detecting test affected by changes in this merge request, using target branch $MR_TARGET_BRANCH_NAME"
          python3 dumux/bin/testing/getchangedfiles.py -o changedfiles.txt -t origin/$MR_TARGET_BRANCH_NAME
          python3 dumux/bin/testing/findtests.py -o affectedtests.json --file-list changedfiles.txt --build-dir build-cmake
Dennis Gläser's avatar
Dennis Gläser committed
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
      else
          echo "Skipping test selection, build/test stages will consider all tests!"
          echo "{}" >> affectedtests.json
      fi
  artifacts:
    paths:
      - dumux
      - build-cmake
      - affectedtests.json
    expire_in: 3 hours

build lecture:
  stage: build
  script:
    - |
      pushd build-cmake
        make clean
        if [[ -n "${DUMUX_MR_BRANCH}" ]]; then
          python3 ../dumux/bin/testing/runselectedtests.py -c ../affectedtests.json -b
        else
          python3 ../dumux/bin/testing/runselectedtests.py --all -b
        fi
      popd
63
64
65
  artifacts:
    paths:
      - build-cmake
66
      - dumux
Dennis Gläser's avatar
Dennis Gläser committed
67
      - affectedtests.json
68
69
70
71
    expire_in: 3 hours

test lecture:
  stage: test
Dennis Gläser's avatar
Dennis Gläser committed
72
73
74
  variables:
    OMPI_ALLOW_RUN_AS_ROOT: 1
    OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
75
  script:
Dennis Gläser's avatar
Dennis Gläser committed
76
77
78
79
80
81
82
83
    - |
      pushd build-cmake
        if [[ -n "${DUMUX_MR_BRANCH}" ]]; then
          python3 ../dumux/bin/testing/runselectedtests.py -c ../affectedtests.json -t
        else
          python3 ../dumux/bin/testing/runselectedtests.py --all -t
        fi
      popd
84
85
86
  needs:
    - job: build lecture
      artifacts: true
87
88
89
  artifacts:
    reports:
      junit: junit/dumux-lecture-cmake.xml