.gitlab-ci.yml 2.32 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
.artifact-spec: &artifact-spec
Florian Oetke's avatar
Florian Oetke committed
23
24
  artifacts:
    paths:
25
      - mirrage
Florian Oetke's avatar
Florian Oetke committed
26
    expire_in: 1 day
Florian Oetke's avatar
Florian Oetke committed
27

28
.build-ninja: &build-ninja
Florian Oetke's avatar
Florian Oetke committed
29
  stage: build
Florian Oetke's avatar
Florian Oetke committed
30
  script:
31
    - cmake -E make_directory build
32
    - cd build
33
    - cmake -E remove_directory src
Lotrado's avatar
Lotrado committed
34
    - cmake -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=../../mirrage -DCMAKE_BUILD_TYPE=Release -DMIRRAGE_ENABLE_COTIRE=OFF -DMIRRAGE_EXPORT_EXECUTABLE=ON ..
Florian Oetke's avatar
Florian Oetke committed
35
    - cmake --build . --target src/install
Florian Oetke's avatar
Florian Oetke committed
36
    - cmake --build . --target test
Florian Oetke's avatar
Florian Oetke committed
37

38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
build-gcc:
  variables:
    CC: "gcc"
    CXX: "g++"
  <<: *build-ninja
  <<: *linux-cache-spec
  <<: *artifact-spec

build-clang:
  variables:
    CC: "clang"
    CXX: "clang++"
  <<: *build-ninja
  <<: *linux-cache-spec
  <<: *artifact-spec

build-scanbuild:
Florian Oetke's avatar
Florian Oetke committed
55
56
57
58
  stage: build
  script: 
    - export CC=clang
    - export CXX=clang++
Florian Oetke's avatar
Florian Oetke committed
59
    - mkdir -p build
Florian Oetke's avatar
Florian Oetke committed
60
    - cd build
61
    - 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
62
    - 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
63
64
  artifacts:
    paths:
Florian Oetke's avatar
Florian Oetke committed
65
      - build/result
66
    expire_in: 1 week
67
    when: always
Florian Oetke's avatar
Florian Oetke committed
68

Lotrado's avatar
Lotrado committed
69
70
71
72
73
74
75
76
77
78
79
80
build-mingw:
  variables:
    CC: "gcc"
    CXX: "g++"
  tags:
    - windows
  only:
    variables:
      - $WINDOWS_CI
  <<: *build-ninja
  <<: *windows-cache-spec
  <<: *artifact-spec
Florian Oetke's avatar
Florian Oetke committed
81

Lotrado's avatar
Lotrado committed
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
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
    - cmake --build . --config Release --target test
  tags:
    - windows
  only:
    variables:
      - $WINDOWS_CI
  <<: *windows-cache-spec
  <<: *artifact-spec