项目作者: Toxe

项目描述 :
Example C++ CI Project and CI Services Comparison
高级语言: C++
项目地址: git://github.com/Toxe/example-cpp-ci-project.git
创建时间: 2020-02-25T17:22:49Z
项目社区:https://github.com/Toxe/example-cpp-ci-project

开源协议:MIT License

下载


Example C++ CI Project and CI Services Comparison

Build status
CircleCI
CI

An example project to test and compare different CI (Continuous Integration) services building a C++ project on Linux, Mac, Windows with GCC, Clang (libc++ and libstdc++), MSVC and Clang-cl. It uses Vcpkg for installing dependencies.

Note: This tries to be a simple and robust CI setup that is a comprehensive introduction and is open for improvements. It does not use more advanced configurations like build matrices and instead tries to be a bit more specific (even if that means repetition).

Supported CI services, platforms and Compilers

AppVeyor

Build status

  • Linux:
    • Clang 14 + libc++
    • GCC 11 + libstdc++
  • macOS:
    • Clang 13 + libc++
    • GCC 12 + libstdc++
  • Windows:
    • MSVC 2022

CircleCI

CircleCI

  • Linux:
    • Clang 14 + libc++
    • Clang 14 + libstdc++
    • GCC 11 + libstdc++
  • macOS:
    • Clang 13 + libc++
    • Clang 13 + libstdc++
    • GCC 12 + libstdc++
  • Windows:
    • MSVC 2022
    • Clang-cl

GitHub Actions

CI

  • Linux:
    • Clang 14 + libc++
    • Clang 14 + libstdc++
    • GCC 12 + libstdc++
  • macOS:
    • Clang 13 + libc++
    • Clang 13 + libstdc++
    • GCC 12 + libstdc++
  • Windows:
    • MSVC 2022
    • Clang-cl

Travis

No longer supported, since they dropped their free Open Source support.

Example Programs

Note: This project contains example programs that serve no other purpose than being examples. The programs themselves don’t make much sense on their own.

  • src/show_info: Outputs a couple of strings describing the compiler and C++ standard library that were used to build the program.
  • src/example: Builds example (just shows some simple output) and example_tests (an example for running tests).

Build and Installation Scripts

The .ci directory contains a couple of scripts for installing Vcpkg and building the project.
All CI services use these scripts to simplify their configurations.

  • install-vcpkg.sh / install-vcpkg.ps1: Download and install Vcpkg or update an already existing Vcpkg installation.
  • build-project.sh / build-project.ps1: Build the project itself.
  • build-project-with-clang-cl.ps1: Used on Windows to build the project with Clang-cl.

Dependencies

  • CMake
  • Vcpkg to install dependencies:
    • fmtlib
    • Catch2 + FakeIt

Sanitizers

Where possible all programs are build using Address Sanitizer.

Note: Clang-cl does not support Address Sanitizer in Debug mode. Build with RelWithDebInfo instead.

Example program output

show_info

Output depends on compiler and C++ standard library.

GCC and libstdc++:

  1. __cplusplus: 202002
  2. __GNUC__: 11
  3. _GLIBCXX_RELEASE: 11

Clang and libc++:

  1. __cplusplus: 202002
  2. __clang_version__: 14.0.5
  3. _LIBCPP_VERSION: 14000

Clang and libstdc++:

  1. __cplusplus: 202002
  2. __clang_version__: 14.0.5
  3. _GLIBCXX_RELEASE: 11

MSVC:

  1. __cplusplus: 199711
  2. _MSC_VER: 1932

Clang-cl:

  1. __cplusplus: 202002
  2. _MSC_VER: 1932
  3. __clang_version__: 13.0.1

example

  1. Everything seems to be working.

example_tests

  1. Randomness seeded to: 1486164745
  2. ===============================================================================
  3. All tests passed (16 assertions in 3 test cases)

Pre-installed Software

The CI VMs or Docker images come with already pre-installed software.