.gitlab-ci.yml 2.77 KB
Newer Older
Florian Oetke's avatar
Florian Oetke committed
1
2
3
4
image: lowkey42/build-env:latest

stages:
  - build
Florian Oetke's avatar
Florian Oetke committed
5
6
7
  
variables:
  GIT_SUBMODULE_STRATEGY: recursive
8
9
10
11
12
13
14
15
16

.cache-paths-spec: &cache-paths
  - build

.linux-cache-spec: &linux-cache-spec
  cache:
    key: ${CI_COMMIT_REF_SLUG}-${CI_JOB_NAME}
    paths: *cache-paths

Lotrado's avatar
Lotrado committed
17
18
19
20
21
.windows-cache-spec: &windows-cache-spec
  cache:
    paths: *cache-paths
    key: "%CI_COMMIT_REF_SLUG%-%CI_JOB_NAME%-%CI_RUNNER_ID%"

22
23
24
25
26
27
28
.windows-task: &windows-task
  tags:
    - windows
  only:
    variables:
      - $WINDOWS_CI

29
.artifact-spec: &artifact-spec
Florian Oetke's avatar
Florian Oetke committed
30
  artifacts:
Lotrado's avatar
Lotrado committed
31
    name: "mirrage"
Florian Oetke's avatar
Florian Oetke committed
32
    paths:
33
      - mirrage
Florian Oetke's avatar
Florian Oetke committed
34
    expire_in: 1 day
Florian Oetke's avatar
Florian Oetke committed
35

Lotrado's avatar
Lotrado committed
36
.build-ninja-linux: &build-ninja-linux
Florian Oetke's avatar
Florian Oetke committed
37
  stage: build
Florian Oetke's avatar
Florian Oetke committed
38
  script:
39
    - cmake -E make_directory build
40
    - cd build
41
    - cmake -E remove_directory src
Lotrado's avatar
Lotrado committed
42
    - cmake -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=../../mirrage -DCMAKE_BUILD_TYPE=Release -DMIRRAGE_EXPORT_EXECUTABLE=ON ..
43
    - cmake --build .
Florian Oetke's avatar
Florian Oetke committed
44
    - cmake --build . --target src/install
Florian Oetke's avatar
Florian Oetke committed
45
    - cmake --build . --target test
Lotrado's avatar
Lotrado committed
46
47
  <<: *linux-cache-spec
  <<: *artifact-spec
Florian Oetke's avatar
Florian Oetke committed
48

49
50
51
52
build-gcc:
  variables:
    CC: "gcc"
    CXX: "g++"
Lotrado's avatar
Lotrado committed
53
  <<: *build-ninja-linux
54
55
56
57
58

build-clang:
  variables:
    CC: "clang"
    CXX: "clang++"
Lotrado's avatar
Lotrado committed
59
  <<: *build-ninja-linux
60
61

build-scanbuild:
Florian Oetke's avatar
Florian Oetke committed
62
63
64
65
  stage: build
  script: 
    - export CC=clang
    - export CXX=clang++
66
    - export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc --all)
67
    - echo "Build parallelism:" ${CMAKE_BUILD_PARALLEL_LEVEL}
Florian Oetke's avatar
Florian Oetke committed
68
    - mkdir -p build
Florian Oetke's avatar
Florian Oetke committed
69
    - cd build
70
    - scan-build --use-c++=clang++ --use-cc=clang cmake -DMIRRAGE_FORCE_LIBCPP=ON -DMIRRAGE_ENABLE_COTIRE=OFF -G "Unix Makefiles" ..
Florian Oetke's avatar
Florian Oetke committed
71
    - scan-build -o result --use-c++=clang++ --use-cc=clang -enable-checker deadcode.DeadStores -enable-checker security.insecureAPI.UncheckedReturn --status-bugs -v cmake --build . || true
Florian Oetke's avatar
Florian Oetke committed
72
73
  artifacts:
    paths:
Florian Oetke's avatar
Florian Oetke committed
74
      - build/result
75
    expire_in: 1 week
76
    when: always
Florian Oetke's avatar
Florian Oetke committed
77

Lotrado's avatar
Lotrado committed
78
build-mingw:
Lotrado's avatar
Lotrado committed
79
80
81
82
83
84
  stage: build
  script:
    - cmake -E make_directory build
    - cd build
    - cmake -E remove_directory src
    - cmake -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=../../mirrage -DCMAKE_BUILD_TYPE=Release -DMIRRAGE_ENABLE_COTIRE=OFF -DMIRRAGE_EXPORT_EXECUTABLE=ON ..
85
    - cmake --build .
Lotrado's avatar
Lotrado committed
86
87
    - cmake --build . --target src/install
    - cmake --build . --target test
Lotrado's avatar
Lotrado committed
88
89
90
  variables:
    CC: "gcc"
    CXX: "g++"
91
  <<: *windows-task
Lotrado's avatar
Lotrado committed
92
93
  <<: *windows-cache-spec
  <<: *artifact-spec
Florian Oetke's avatar
Florian Oetke committed
94

Lotrado's avatar
Lotrado committed
95
96
97
98
99
100
101
102
103
build-msvc:
  stage: build
  script:
    - cmake -E make_directory build
    - cd build
    - cmake -E remove_directory src
    - cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_INSTALL_PREFIX:PATH=../../mirrage -DMIRRAGE_EXPORT_EXECUTABLE=ON -DMIRRAGE_ENABLE_BACKWARD=OFF ..
    - cmake --build . --config Release -- /m
    - cmake --build . --config Release --target src/install
Lotrado's avatar
Lotrado committed
104
    - cmake --build . --config Release --target RUN_TESTS
105
  <<: *windows-task
Lotrado's avatar
Lotrado committed
106
107
  <<: *windows-cache-spec
  <<: *artifact-spec