.gitlab-ci.yml 7.28 KB
Newer Older
1
# # GitLab CI Job Configuration
2
#
3 4 5
# Goal: Run all jobs defined here on all available runners (GNU/Linux and
# Windows).
# 
6
# Procedure: Use GitLab job templates prefixed with a "." and use them in the
7
# actual job description with the "extends" keyword.
8
#
9
# ## Job Description Syntax
10 11
#
# <job_name>:                   # Job name which is displayed in web interface.
12
#   stage: <stage_name>         # Run "script" commands in this stage. The
13
#                               # stages are executed sequentially.
14 15 16 17 18
#   script:
#      - <arbitrary_commands>   # Here you can execute arbitratry terminal
#                               # commands. If any of the commands return a
#                               # non-zero exit code, the job fails.
#
19
# ## References
20
#
21
# - https://docs.gitlab.com/ee/ci/yaml/README.html
22

23
# Variable Definitions
24 25
variables:
    VADERE_DEPLOYMENT_BASE_URL: "http://www.vadere.org/builds"
26 27
    VADERE_PACKAGE_NAME_BRANCHES: "vadere.${CI_COMMIT_REF_NAME}.${CI_RUNNER_TAGS}.zip"
    VADERE_PACKAGE_NAME_RELEASES: "vadere.${CI_COMMIT_TAG}.${CI_RUNNER_TAGS}.zip"
Benedikt Zoennchen's avatar
Benedikt Zoennchen committed
28
    EIKMESH_PACKAGE_NAME_BRANCHES: "eikmesh.${CI_COMMIT_REF_NAME}.${CI_RUNNER_TAGS}.zip"
29

30
# Stage Definitions
31
stages:
32
    - unit_test
33
    - integration_test
Daniel Lehmberg's avatar
Daniel Lehmberg committed
34
    - seed_test
Daniel Lehmberg's avatar
Daniel Lehmberg committed
35
    - deploy
36

37 38
# PLEASE, OMIT FOLLOWING GITLAB PITFALLS:
#
39 40 41
# 1. "include:" statement does not work properly and seems really buggy.
#    Therefore, define all job templates and jobs directly here.
#    "include: .gitlab/ci/templates/test_stage_templates.yml" does not work!
42 43
# 2. Variables from "variables" section are not expanded correctly in "url"
#    section of an "environment".
44

45
# Job Template Definitions
46 47 48 49 50
.template_unit_tests:
    stage: unit_test
    # Skip OpenCL tests by using "-Dtest=!Test1,!Test2,..." because GitLab
    # runners do not support OpenCL.
    script:
51
        - rm -f ~/.config/vadere.conf
52
        - mvn clean
Benedikt Zoennchen's avatar
Benedikt Zoennchen committed
53
        - mvn -Dtest=!TestConvolution,!TestBitonicSort,!TestCLLinkedList,!TestCLOptimalStepsModel,!TestLWJGL test
54 55 56 57
        - python3 Tools/ContinuousIntegration/collect_line_and_branch_coverage.py
    artifacts:
        when: on_success
        paths:
58
            - "*/target/coverage-reports"
59
        expire_in: 1 week
60
    when: on_success
61 62 63 64
            
.template_scenario_files:
    stage: integration_test
    script:
65
        - rm -f ~/.config/vadere.conf
66 67 68 69 70 71
        - mvn clean
        - mvn -Dmaven.test.skip=true package
        - python3 Tools/ContinuousIntegration/run_vadere_console_with_all_scenario_files.py
    artifacts:
        when: on_failure
        paths:
72
            - "vadere_logs"
73
        expire_in: 1 week
74
    when: on_success
75

Daniel Lehmberg's avatar
Daniel Lehmberg committed
76 77
.template_deploy_master_automatically:
    stage: deploy
78 79 80
    script:
        - mvn clean
        - mvn -Dmaven.test.skip=true package
81
        - python3 -m zipfile -c ${VADERE_PACKAGE_NAME_BRANCHES} CHANGELOG.md README.md Scenarios/ VadereGui/target/vadere-gui.jar VadereSimulator/target/vadere-console.jar
Daniel Lehmberg's avatar
Daniel Lehmberg committed
82
        - scp ${VADERE_PACKAGE_NAME_BRANCHES} di49mur@webdev-mwn.lrz.de:~/webserver/htdocs/builds/master/${VADERE_PACKAGE_NAME_BRANCHES}
Benedikt Zoennchen's avatar
Benedikt Zoennchen committed
83
        - python3 -m zipfile -c ${EIKMESH_PACKAGE_NAME_BRANCHES} VadereMeshing/README.md VadereMeshing/target/meshing-0.1-SNAPSHOT.jar
Benedikt Zoennchen's avatar
Benedikt Zoennchen committed
84
        - scp ${EIKMESH_PACKAGE_NAME_BRANCHES} di49mur@webdev-mwn.lrz.de:~/webserver/htdocs/builds/master/eikmesh/${EIKMESH_PACKAGE_NAME_BRANCHES}
Daniel Lehmberg's avatar
Daniel Lehmberg committed
85 86 87
    only:
        refs:
            - master
88
    when: on_success
89

Daniel Lehmberg's avatar
Daniel Lehmberg committed
90
.template_deploy_stable_automatically:
91 92 93 94
    stage: deploy
    script:
        - mvn clean
        - mvn -Dmaven.test.skip=true package
95
        - python3 -m zipfile -c ${VADERE_PACKAGE_NAME_RELEASES} CHANGELOG.md README.md Scenarios/ VadereGui/target/vadere-gui.jar VadereSimulator/target/vadere-console.jar
96 97 98
        - scp ${VADERE_PACKAGE_NAME_RELEASES} di49mur@webdev-mwn.lrz.de:~/webserver/htdocs/builds/stable/${VADERE_PACKAGE_NAME_RELEASES}
    # Run job only for "tags" (usually on the "stable" branch). Watch out: Multiple "only" tags are ORed together.
    # See: https://gitlab.com/gitlab-org/gitlab-ce/issues/27818
99
    only:
100
        - tags
101
    when: on_success
Daniel Lehmberg's avatar
Daniel Lehmberg committed
102

103 104 105 106 107
.template_deploy_branch_manually:
    stage: deploy
    script:
        - mvn clean
        - mvn -Dmaven.test.skip=true package
108
        - python3 -m zipfile -c ${VADERE_PACKAGE_NAME_BRANCHES} CHANGELOG.md README.md Scenarios/ VadereGui/target/vadere-gui.jar VadereSimulator/target/vadere-console.jar
109
        - scp ${VADERE_PACKAGE_NAME_BRANCHES} di49mur@webdev-mwn.lrz.de:~/webserver/htdocs/builds/branches/${VADERE_PACKAGE_NAME_BRANCHES}
110 111
    when: manual

Daniel Lehmberg's avatar
Daniel Lehmberg committed
112 113 114 115 116
.template_seed_test:
    stage: seed_test
    script:
        - mvn clean
        - mvn -Dmaven.test.skip=true package
117 118
        # setup.py install should from the directoty at which the setup.py file is located (working directory). The brackets return the working direcory back to previous position. 
        - (cd Tools/VadereAnalysisTools/VadereAnalysisTool/ && python3 setup.py install --user)
Daniel Lehmberg's avatar
Daniel Lehmberg committed
119 120 121 122 123 124 125 126
        - python3 Tools/ContinuousIntegration/run_seed_comparison_test.py   
    artifacts:
        when: on_failure
        paths: 
            - "Tools/ContinuousIntegration/run_seed_comparison_test.d/output"
        expire_in: 1 week
    when: on_success

127 128
# Job Definitions

129
## Jobs for GNU/Linux runner (which is labeled with tag "linux")
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
run_unit_tests_on_linux:
    extends: .template_unit_tests
    tags:
        - linux

run_scenario_files_on_linux:
    extends: .template_scenario_files
    tags:
        - linux

run_seed_test_on_linux:
    extends: .template_seed_test
    tags:
        - linux

145 146 147 148 149 150 151
deploy_master_on_linux:
    extends: .template_deploy_master_automatically
    tags:
        - linux        
    environment:
        name: master/linux
        url: ${VADERE_DEPLOYMENT_BASE_URL}/master/vadere.${CI_COMMIT_REF_NAME}.${CI_RUNNER_TAGS}.zip
152 153 154 155 156 157 158 159 160

deploy_stable_on_linux:
    extends: .template_deploy_stable_automatically
    tags:
        - linux
    environment:
        name: stable/linux
        url: ${VADERE_DEPLOYMENT_BASE_URL}/stable/vadere.${CI_COMMIT_TAG}.${CI_RUNNER_TAGS}.zip

161
deploy_branch_on_linux:
162
    extends: .template_deploy_branch_manually
163 164 165
    tags:
        - linux        
    environment:
166
        name: branches/${CI_COMMIT_REF_NAME}/linux
167
        url: ${VADERE_DEPLOYMENT_BASE_URL}/branches/vadere.${CI_COMMIT_REF_NAME}.${CI_RUNNER_TAGS}.zip
168

169
## Jobs for Windows runner (which is labeled with tag "windows")
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
run_unit_tests_on_windows:
    extends: .template_unit_tests
    tags:
        - windows

run_scenario_files_on_windows:
    extends: .template_scenario_files
    tags:
        - windows

run_seed_test_on_windows:
    extends: .template_seed_test
    tags:
        - windows

185 186 187 188 189 190 191 192
deploy_master_on_windows:
    extends: .template_deploy_master_automatically
    tags:
        - windows        
    environment:
        name: master/windows
        url: ${VADERE_DEPLOYMENT_BASE_URL}/master/vadere.${CI_COMMIT_REF_NAME}.${CI_RUNNER_TAGS}.zip

193 194 195 196 197 198 199 200
deploy_stable_on_windows:
    extends: .template_deploy_stable_automatically
    tags:
        - windows
    environment:
        name: stable/windows
        url: ${VADERE_DEPLOYMENT_BASE_URL}/stable/vadere.${CI_COMMIT_TAG}.${CI_RUNNER_TAGS}.zip

201
deploy_branch_on_windows:
202
    extends: .template_deploy_branch_manually
203 204 205
    tags:
        - windows        
    environment:
206
        name: branches/${CI_COMMIT_REF_NAME}/windows
207
        url: ${VADERE_DEPLOYMENT_BASE_URL}/branches/vadere.${CI_COMMIT_REF_NAME}.${CI_RUNNER_TAGS}.zip