.gitlab-ci.yml 2.67 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
31
  artifacts:
    paths:
32
      - mirrage
Florian Oetke's avatar
Florian Oetke committed
33
    expire_in: 1 day
Florian Oetke's avatar
Florian Oetke committed
34

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

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

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

build-scanbuild:
Florian Oetke's avatar
Florian Oetke committed
60
61
62
63
  stage: build
  script: 
    - export CC=clang
    - export CXX=clang++
64
    - export CMAKE_BUILD_PARALLEL_LEVEL=$(grep -c ^processor /proc/cpuinfo)
Florian Oetke's avatar
Florian Oetke committed
65
    - mkdir -p build
Florian Oetke's avatar
Florian Oetke committed
66
    - cd build
67
    - 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
68
    - 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
69
70
  artifacts:
    paths:
Florian Oetke's avatar
Florian Oetke committed
71
      - build/result
72
    expire_in: 1 week
73
    when: always
Florian Oetke's avatar
Florian Oetke committed
74

Lotrado's avatar
Lotrado committed
75
build-mingw:
Lotrado's avatar
Lotrado committed
76
77
78
79
80
81
82
83
  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 ..
    - cmake --build . --target src/install
    - cmake --build . --target test
Lotrado's avatar
Lotrado committed
84
85
86
  variables:
    CC: "gcc"
    CXX: "g++"
87
  <<: *windows-task
Lotrado's avatar
Lotrado committed
88
89
  <<: *windows-cache-spec
  <<: *artifact-spec
Florian Oetke's avatar
Florian Oetke committed
90

Lotrado's avatar
Lotrado committed
91
92
93
94
95
96
97
98
99
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
100
    - cmake --build . --config Release --target RUN_TESTS
101
  <<: *windows-task
Lotrado's avatar
Lotrado committed
102
103
  <<: *windows-cache-spec
  <<: *artifact-spec