summaryrefslogtreecommitdiffstats
path: root/.gitlab-ci.yml
blob: d9ffb8f94146c80f941547e0350c14f7e90a8321 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Dependencies are managed in the Dockerfile in the inkscape-ci-docker
# Git repository. Recycle the one for the master Inkscape branch for now
image: registry.gitlab.com/inkscape/inkscape-ci-docker/master

variables:
  GIT_DEPTH: "10"
  GIT_SUBMODULE_STRATEGY: recursive

# The main build of the library
2geom:
  stage: build
  before_script:
    - mkdir -p ccache
    - export CCACHE_BASEDIR=${PWD}
    - export CCACHE_DIR=${PWD}/ccache
  script:
    - mkdir -p build opt
    - cd build
    - cmake .. -DCMAKE_C_COMPILER_LAUNCHER=ccache
               -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
               -DCMAKE_CXX_FLAGS="-fsanitize=address -fno-omit-frame-pointer"
               -DCMAKE_BUILD_TYPE=Debug
               -DCMAKE_INSTALL_PREFIX=../opt
               -D2GEOM_BOOST_PYTHON=ON
    - make -j3
    - make -j3 perf
    - make py2geom
    - make install
  cache:
    paths:
      - ccache/
  artifacts:
    expire_in: 1 day
    paths:
      - build # needed by unit tests
      - opt   # needed by find-package

# Build an executable including lib2geom as a subproject
2geom:as-subproject:
  stage: build
  before_script:
    - mkdir -p ccache
    - export CCACHE_BASEDIR="${PWD}"
    - export CCACHE_DIR="${PWD}/ccache"
  script:
    - mkdir -p opt2
    - cd tests/dependent-project
    - mkdir -p build-as-subproject
    - cd build-as-subproject
    - cmake .. -D2GEOM_AS_SUBPROJECT=ON
               -DCMAKE_INSTALL_PREFIX=../../../opt2
    - make -j2 main
    - ./main
    - make install
  cache:
    paths:
      - ccache/

# Build an executable linking against lib2geom found via cmake
2geom:find-package:
  stage: test
  dependencies:
    - 2geom
  needs: ["2geom"]
  before_script:
    - mkdir -p ccache
    - export CCACHE_BASEDIR="${PWD}"
    - export CCACHE_DIR="${PWD}/ccache"
  script:
    - mkdir -p opt3
    - cd tests/dependent-project
    - mkdir -p build-with-find-package
    - cd build-with-find-package
    - cmake .. -D2GEOM_AS_SUBPROJECT=OFF
               -DCMAKE_EXE_LINKER_FLAGS="-fsanitize=address"
               -DCMAKE_INSTALL_PREFIX=../../../opt3
               -D2Geom_DIR="$PWD/../../../opt/lib/cmake/2Geom"
    - make -j2 main
    - ./main
    - make install
  cache:
    paths:
      - ccache/

# Run tests
2geom:tests:
  stage: test
  dependencies:
    - 2geom
  needs: ["2geom"]
  script:
    - cd build
    - make -j3 test
  artifacts:
    expire_in: 1 month
    paths:
      - build/Testing
    expose_as: 'Test logs'
    when: on_failure