.gitlab-ci.yml 5.49 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 7
# Procedure: Use GitLab job templates prefixed with a "." and use them in the
# actual job description with the "extend" 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"
28

29
# Stage Definitions
30
stages:
31 32
    - unit_test
    - integration_test
hm-lehmberg's avatar
hm-lehmberg committed
33
    - deploy
34

35 36
# PLEASE, OMIT FOLLOWING GITLAB PITFALLS:
#
37 38 39
# 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!
40 41
# 2. Variables from "variables" section are not expanded correctly in "url"
#    section of an "environment".
42

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

.template_seed_test:
    stage: integration_test
    script:
        - mvn clean
        - mvn -Dmaven.test.skip=true package
        - python3 Tools/VadereAnalysisTools/VadereAnalysisTool/setup.py install --user
78
        - python3 Tools/ContinuousIntegration/run_seed_comparison_test.py   
79 80 81 82 83
    artifacts:
        when: on_failure
        paths: 
            - "Tools/ContinuousIntegration/run_seed_comparison_test.d/output"
        expire_in: 1 week
84
    when: on_success
85

86
.template_deploy_master_automatically:
87 88 89 90
    stage: deploy
    script:
        - mvn clean
        - mvn -Dmaven.test.skip=true package
91 92 93 94 95 96 97 98 99 100 101 102 103 104
        - python3 -m zipfile -c ${VADERE_PACKAGE_NAME_BRANCHES} VadereModelTests/ VadereGui/target/vadere.jar VadereSimulator/target/vadere-console.jar
        - scp ${VADERE_PACKAGE_NAME_BRANCHES} di49mur@webdev-mwn.lrz.de:~/webserver/htdocs/builds/master/${VADERE_PACKAGE_NAME_BRANCHES}
    only:
        refs:
            - master
    when: on_success
    
.template_deploy_branch_manually:
    stage: deploy
    script:
        - mvn clean
        - mvn -Dmaven.test.skip=true package
        - python3 -m zipfile -c ${VADERE_PACKAGE_NAME_BRANCHES} VadereModelTests/ VadereGui/target/vadere.jar VadereSimulator/target/vadere-console.jar
        - scp ${VADERE_PACKAGE_NAME_BRANCHES} di49mur@webdev-mwn.lrz.de:~/webserver/htdocs/builds/branches/${VADERE_PACKAGE_NAME_BRANCHES}
105 106 107 108
    when: manual

# Job Definitions

109
## Jobs for GNU/Linux runner (which is labelled with tag "linux")
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
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

125 126 127 128 129 130 131 132
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
        
133
deploy_branch_on_linux:
134
    extends: .template_deploy_branch_manually
135 136 137
    tags:
        - linux        
    environment:
138
        name: branches/${CI_COMMIT_REF_NAME}/linux
139
        url: ${VADERE_DEPLOYMENT_BASE_URL}/branches/vadere.${CI_COMMIT_REF_NAME}.${CI_RUNNER_TAGS}.zip
140

141
## Jobs for Windows runner (which is labelled with tag "windows")
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
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

157 158 159 160 161 162 163 164
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

165
deploy_branch_on_windows:
166
    extends: .template_deploy_branch_manually
167 168 169
    tags:
        - windows        
    environment:
170
        name: branches/${CI_COMMIT_REF_NAME}/windows
171
        url: ${VADERE_DEPLOYMENT_BASE_URL}/branches/vadere.${CI_COMMIT_REF_NAME}.${CI_RUNNER_TAGS}.zip