.gitlab-ci.yml 4.24 KB
Newer Older
1
image: maven:latest
2

3 4 5
include:
  - template: Code-Quality.gitlab-ci.yml

6 7 8
stages:
  - build
  - test
9
  - visualize
10 11
  - deploy

12 13 14 15
variables:
  MAVEN_CLI_OPTS: "-s .m2/settings.xml --batch-mode"
  MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"

16 17 18 19 20 21 22 23
code_quality:
  rules:
    - if: '$CODE_QUALITY_DISABLED'
      when: never
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
    - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
    - if: '$CI_COMMIT_TAG'

24 25 26
cache:
  paths:
    - ~/.m2/repository/
27
    - .m2/repository/
28 29 30 31 32
    - target/

build:
  stage: build
  script:
33
    - mvn $MAVEN_CLI_OPTS compile
34 35
  tags:
    - general
36

37
test-nvidia-gpu:
38
  image: aparapi/aparapi-nvidia:latest
39 40
  stage: test
  script:
41
    - clinfo
42
    - if [[ "$(clinfo | grep 'Device Type')" != *"GPU"* ]]; then exit -1; fi
43
    - mvn $MAVEN_CLI_OPTS org.jacoco:jacoco-maven-plugin:prepare-agent test jacoco:report site
44
    - mv target target-nvidia-gpu
45 46 47 48
  artifacts:
    when: always
    reports:
      junit:
49 50 51 52
        - target-nvidia-gpu/surefire-reports/TEST-*.xml
        - target-nvidia-gpu/failsafe-reports/TEST-*.xml
    paths:
      - target-nvidia-gpu
53 54
  tags:
    - opencl
55

56
test-nvidia-cpu:
57
  image: aparapi/aparapi-nvidia:latest
58 59 60
  stage: test
  script:
    - clinfo
61
    - if [[ "$(clinfo | grep 'Device Type')" == *"GPU"* ]]; then exit -1; fi
62
    - mvn $MAVEN_CLI_OPTS org.jacoco:jacoco-maven-plugin:prepare-agent test jacoco:report site
63
    - mv target target-nvidia-cpu
64 65 66 67
  artifacts:
    when: always
    reports:
      junit:
68 69 70 71
        - target-nvidia-cpu/surefire-reports/TEST-*.xml
        - target-nvidia-cpu/failsafe-reports/TEST-*.xml
    paths:
      - target-nvidia-cpu
72 73 74 75
  tags:
    - compute

test-amdgpu-cpu:
76 77 78 79
  image: aparapi/aparapi-amdgpu:latest
  stage: test
  script:
    - clinfo
80
    - if [[ "$(clinfo | grep 'Device Type')" == *"GPU"* ]]; then exit -1; fi
81
    - mvn $MAVEN_CLI_OPTS org.jacoco:jacoco-maven-plugin:prepare-agent test jacoco:report site
82
    - mv target target-amdgpu-cpu
83 84 85 86
  artifacts:
    when: always
    reports:
      junit:
87 88 89 90
        - target-amdgpu-cpu/surefire-reports/TEST-*.xml
        - target-amdgpu-cpu/failsafe-reports/TEST-*.xml
    paths:
      - target-amdgpu-cpu
91 92 93
  tags:
    - compute

94
test-pocl-cpu:
95
  image: aparapi/aparapi-pocl:latest
96 97 98
  stage: test
  script:
    - clinfo
99
    - if [[ "$(clinfo | grep 'Device Type')" == *"GPU"* ]]; then exit -1; fi
100
    - mvn $MAVEN_CLI_OPTS org.jacoco:jacoco-maven-plugin:prepare-agent test jacoco:report site
101
    - mv target target-pocl-cpu
102 103 104 105
  artifacts:
    when: always
    reports:
      junit:
106 107 108 109
        - target-pocl-cpu/surefire-reports/TEST-*.xml
        - target-pocl-cpu/failsafe-reports/TEST-*.xml
    paths:
      - target-pocl-cpu
110 111 112
  tags:
    - compute

113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
coverage:
  stage: visualize # Must be in a stage later than test-jdk11's stage. The visualize stage does not exist by default. Please define it first, or chose an existing stage like deploy.
  image: haynes/jacoco2cobertura:1.0.3
  script:
    - 'python /opt/cover2cover.py target-nvidia-gpu/site/jacoco/jacoco.xml src/main/java > target-nvidia-gpu/site/cobertura.xml'
    - 'python /opt/source2filename.py target-nvidia-gpu/site/cobertura.xml'
    - 'python /opt/cover2cover.py target-nvidia-cpu/site/jacoco/jacoco.xml src/main/java > target-nvidia-cpu/site/cobertura.xml'
    - 'python /opt/source2filename.py target-nvidia-cpu/site/cobertura.xml'
    - 'python /opt/cover2cover.py target-amdgpu-cpu/site/jacoco/jacoco.xml src/main/java > target-amdgpu-cpu/site/cobertura.xml'
    - 'python /opt/source2filename.py target-amdgpu-cpu/site/cobertura.xml'
    - 'python /opt/cover2cover.py target-pocl-cpu/site/jacoco/jacoco.xml src/main/java > target-pocl-cpu/site/cobertura.xml'
    - 'python /opt/source2filename.py target-pocl-cpu/site/cobertura.xml'
  needs: ["test-nvidia-gpu", "test-nvidia-cpu", "test-amdgpu-cpu", "test-pocl-cpu"]
  dependencies:
    - test-nvidia-gpu
    - test-nvidia-cpu
    - test-amdgpu-cpu
    - test-pocl-cpu
  artifacts:
    reports:
      cobertura: target-nvidia-gpu/site/cobertura.xml
      cobertura: target-nvidia-cpu/site/cobertura.xml
      cobertura: target-amdgpu-cpu/site/cobertura.xml
      cobertura: target-pocl-cpu/site/cobertura.xml

138 139 140
deploy:
  stage: deploy
  script:
141
    - mvn $MAVEN_CLI_OPTS -DskipTests=true deploy
142
  tags:
143
    - general
144 145
  only:
    - master
146
    - /^v.*$/