default.yml 3.52 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
    - |
25
      if [[ "$DUMUX_PIPELINE_SOURCE" == "merge_request_event" ]]; then
26
27
28
29
30
31
32
33
          echo "Cloning upstream merge request source/target branches ${DUMUX_MR_SOURCE_BRANCH}/${DUMUX_MR_TARGET_BRANCH}"
          git clone -b ${DUMUX_MR_SOURCE_BRANCH} --depth=1 https://git.iws.uni-stuttgart.de/dumux-repositories/dumux.git
          pushd dumux
              git fetch --depth=1 origin ${DUMUX_MR_TARGET_BRANCH}:${DUMUX_MR_TARGET_BRANCH}
          popd
      else
          echo "Cloning into Dumux master"
          git clone -b master --depth 1 https://git.iws.uni-stuttgart.de/dumux-repositories/dumux.git
34
      fi
35
    - dunecontrol --opts=$DUNE_OPTS_FILE --only=dumux all
36
  script:
37
    - dunecontrol --opts=$DUNE_OPTS_FILE --current all
Dennis Gläser's avatar
Dennis Gläser committed
38
    - |
39
40
      if [[ "$DUMUX_PIPELINE_SOURCE" == "merge_request_event" ]]; then
          CHECK_FOLDER="dumux"
41
42
          SOURCE_TREE=$DUMUX_MR_SOURCE_BRANCH
          TARGET_TREE=$DUMUX_MR_TARGET_BRANCH
43
      elif [[ "$TRIGGER_SOURCE" == "merge_request_event" ]]; then
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
          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
59
      else
60
          echo "Received trigger source / dumux pipeline source: $TRIGGER_SOURCE / $DUMUX_PIPELINE_SOURCE"
Dennis Gläser's avatar
Dennis Gläser committed
61
          echo "Skipping test selection, build/test stages will consider all tests!"
62
          touch affectedtests.json
Dennis Gläser's avatar
Dennis Gläser committed
63
64
65
66
67
68
69
70
71
72
73
74
75
76
      fi
  artifacts:
    paths:
      - dumux
      - build-cmake
      - affectedtests.json
    expire_in: 3 hours

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

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