.gitlab-ci.yml 3 KB
Newer Older
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 100 101 102 103 104 105 106 107 108 109 110 111 112 113
image: lowkey42/build-env:latest

stages:
  - build
  
variables:
  GIT_SUBMODULE_STRATEGY: recursive

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

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

.windows-cache-spec: &windows-cache-spec
  cache:
    paths: *cache-paths
    key: "%CI_COMMIT_REF_SLUG%-%CI_JOB_NAME%-%CI_RUNNER_ID%"

.windows-task: &windows-task
  tags:
    - windows
  only:
    variables:
      - $WINDOWS_CI

.artifact-spec: &artifact-spec
  artifacts:
    name: "phase_shifter"
    paths:
      - phase_shifter
    expire_in: 1 day

.build-ninja-linux: &build-ninja-linux
  stage: build
  script:
    - cmake -E make_directory build
    - cd build
    - cmake -E remove_directory src
    - cmake -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=../../phase_shifter -DCMAKE_BUILD_TYPE=Release -DMIRRAGE_EXPORT_EXECUTABLE=ON -DMIRRAGE_ENABLE_COTIRE=OFF ..
    - cmake --build .
    - cmake --build . --target src/install
    - cmake --build . --target test
  <<: *linux-cache-spec
  <<: *artifact-spec

build-gcc:
  image: lowkey42/gdw-build-gcc
  variables:
    CC: "gcc"
    CXX: "g++"
  <<: *build-ninja-linux

build-clang:
  image: lowkey42/gdw-build-clang
  variables:
    CC: "clang"
    CXX: "clang++"
  <<: *build-ninja-linux

build-scanbuild:
  image: lowkey42/gdw-build-clang
  stage: build
  script: 
    - export CC=clang
    - export CXX=clang++
    - export CMAKE_BUILD_PARALLEL_LEVEL=$(nproc --all)
    - echo "Build parallelism:" ${CMAKE_BUILD_PARALLEL_LEVEL}
    - mkdir -p build
    - cd build
    - scan-build --use-c++=clang++ --use-cc=clang cmake -DMIRRAGE_FORCE_LIBCPP=ON -DMIRRAGE_ENABLE_COTIRE=OFF -G "Unix Makefiles" ..
    - 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
  artifacts:
    paths:
      - build/result
    expire_in: 1 week
    when: always
  only:
    variables:
      - $SCANBUILD_CI

build-mingw:
  stage: build
  script:
    - cmake -E make_directory build
    - cd build
    - cmake -E remove_directory src
    - cmake -G Ninja -DCMAKE_INSTALL_PREFIX:PATH=../../phase_shifter -DCMAKE_BUILD_TYPE=Release -DMIRRAGE_ENABLE_COTIRE=OFF -DMIRRAGE_EXPORT_EXECUTABLE=ON ..
    - cmake --build .
    - cmake --build . --target src/install
    - cmake --build . --target test
  variables:
    CC: "gcc"
    CXX: "g++"
  <<: *windows-task
  <<: *windows-cache-spec
  <<: *artifact-spec

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=../../phase_shifter -DMIRRAGE_ENABLE_COTIRE=OFF -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 RUN_TESTS
  <<: *windows-task
  <<: *windows-cache-spec
  <<: *artifact-spec