default.yml 3.5 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
# variables that may be overwritten by the trigger
14
15
16
variables:
  TRIGGER_SOURCE: "unknown"
  MR_TARGET_BRANCH_NAME: "master"
17
18
19
  DUMUX_PIPELINE_SOURCE: "unknown"
  DUMUX_MR_SOURCE_BRANCH: "unknown"
  DUMUX_MR_TARGET_BRANCH: "unknown"
20

Dennis Gläser's avatar
Dennis Gläser committed
21
22
select tests:
  stage: configure
23
  before_script:
24
    - |
Dennis Gläser's avatar
Dennis Gläser committed
25
      DUMUX_CLONE_BRANCH=master
26
27
      if [[ "$DUMUX_PIPELINE_SOURCE" == "merge_request_event" ]]; then
        echo "Starting pipeline triggered by upstream merge request event"
28
        echo "Received upstream merge request branch ${DUMUX_MR_SOURCE_BRANCH}"
29
        DUMUX_CLONE_BRANCH=${DUMUX_MR_SOURCE_BRANCH}
30
      fi
Dennis Gläser's avatar
Dennis Gläser committed
31
32
    - 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
33
    - dunecontrol --opts=$DUNE_OPTS_FILE --only=dumux all
34
  script:
35
    - dunecontrol --opts=$DUNE_OPTS_FILE --current all
Dennis Gläser's avatar
Dennis Gläser committed
36
    - |
37
38
39
40
41
      echo "Check if tests affected by changes have to be identified"
      if [[ "$DUMUX_PIPELINE_SOURCE" == "merge_request_event" ]]; then
          CHECK_FOLDER="dumux"
          SOURCE_TREE=origin/$DUMUX_MR_SOURCE_BRANCH
          TARGET_TREE=origin/$DUMUX_MR_TARGET_BRANCH
42
      elif [[ "$TRIGGER_SOURCE" == "merge_request_event" ]]; then
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
          CHECK_FOLDER="."
          SOURCE_TREE="HEAD"
          TARGET_TREE=origin/$MR_TARGET_BRANCH_NAME
      fi
    - |
      if [[ -n "$SOURCE_TREE" ]]; then
          echo "Detecting tests affected by changes in folder $CHECK_FOLDER,"
          echo "using source/target trees: $SOURCE_TREE / $TARGET_TREE"
          python3 dumux/bin/testing/getchangedfiles.py --folder $CHECK_FOLDER \
                                                       --source-tree $SOURCE_TREE \
                                                       --target-tree $TARGET_TREE \
                                                       --outfile changedfiles.txt
          python3 dumux/bin/testing/findtests.py --outfile affectedtests.json \
                                                 --file-list changedfiles.txt \
                                                 --build-dir build-cmake
Dennis Gläser's avatar
Dennis Gläser committed
58
      else
59
          echo "Received trigger source / dumux pipeline source: $TRIGGER_SOURCE / $DUMUX_PIPELINE_SOURCE"
Dennis Gläser's avatar
Dennis Gläser committed
60
          echo "Skipping test selection, build/test stages will consider all tests!"
61
          touch affectedtests.json
Dennis Gläser's avatar
Dennis Gläser committed
62
63
64
65
66
67
68
69
70
71
72
73
74
75
      fi
  artifacts:
    paths:
      - dumux
      - build-cmake
      - affectedtests.json
    expire_in: 3 hours

build lecture:
  stage: build
  script:
    - |
      pushd build-cmake
        make clean
76
        if [ -s ../affectedtests.json ]; then
Dennis Gläser's avatar
Dennis Gläser committed
77
78
79
80
81
          python3 ../dumux/bin/testing/runselectedtests.py -c ../affectedtests.json -b
        else
          python3 ../dumux/bin/testing/runselectedtests.py --all -b
        fi
      popd
82
83
84
  artifacts:
    paths:
      - build-cmake
85
      - dumux
Dennis Gläser's avatar
Dennis Gläser committed
86
      - affectedtests.json
87
88
89
90
    expire_in: 3 hours

test lecture:
  stage: test
Dennis Gläser's avatar
Dennis Gläser committed
91
92
93
  variables:
    OMPI_ALLOW_RUN_AS_ROOT: 1
    OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
94
  script:
Dennis Gläser's avatar
Dennis Gläser committed
95
96
    - |
      pushd build-cmake
97
        if [ -s ../affectedtests.json ]; then
Dennis Gläser's avatar
Dennis Gläser committed
98
99
100
101
102
          python3 ../dumux/bin/testing/runselectedtests.py -c ../affectedtests.json -t
        else
          python3 ../dumux/bin/testing/runselectedtests.py --all -t
        fi
      popd
103
104
105
  needs:
    - job: build lecture
      artifacts: true
106
107
108
  artifacts:
    reports:
      junit: junit/dumux-lecture-cmake.xml