diff --git a/.circleci/config.yml b/.circleci/config.yml index 6554e1f..4903545 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,22 +5,189 @@ version: 2.1 # Define a job to be invoked later in a workflow. # See: https://circleci.com/docs/2.0/configuration-reference/#jobs jobs: - say-hello: - # Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub. - # See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor + + checkout-code: + docker: + - image: debian:stretch + steps: + - checkout + - save_cache: + key: repo-{{ .Environment.CIRCLE_SHA1 }} + paths: + - ~/project + + cppcheck: + docker: + - image: debian:stretch + steps: + - restore_cache: + key: repo-{{ .Environment.CIRCLE_SHA1 }} + - run: + name: Greeting + command: echo Hello, world. + - run: + name: Print the Current Time + command: date + + shellcheck: + docker: + - image: koalaman/shellcheck-alpine:stable + steps: + - checkout + - run: + name: Check Shell Scripts + command: find . -type f -name "*.sh" -exec shellcheck -e SC2010 -e SC2016 {} \+ + + cmake-format: + docker: + - image: debian:stretch + steps: + - checkout + - run: + name: Greeting + command: echo Hello, world. + - run: + name: Print the Current Time + command: date + + clang-tidy: + docker: + - image: debian:stretch + steps: + - checkout + - run: + name: Greeting + command: echo Hello, world. + - run: + name: Print the Current Time + command: date + + build-gcc-7: + docker: + - image: debian:stretch + steps: + - checkout + - run: + name: Greeting + command: echo Hello, world. + - run: + name: Print the Current Time + command: date + + build-gcc-8: docker: - - image: cimg/base:stable - # Add steps to the job - # See: https://circleci.com/docs/2.0/configuration-reference/#steps + - image: debian:stretch steps: - checkout - run: - name: "Say hello" - command: "echo Hello, World!" + name: Greeting + command: echo Hello, world. + - run: + name: Print the Current Time + command: date + + build-clang-7: + docker: + - image: debian:stretch + steps: + - checkout + - run: + name: Greeting + command: echo Hello, world. + - run: + name: Print the Current Time + command: date + + unit-test: + docker: + - image: debian:stretch + steps: + - checkout + - run: + name: Greeting + command: echo Hello, world. + - run: + name: Print the Current Time + command: date + + integration-test: + docker: + - image: debian:stretch + steps: + - checkout + - run: + name: Greeting + command: echo Hello, world. + - run: + name: Print the Current Time + command: date + + unit-test-asan: + docker: + - image: debian:stretch + steps: + - checkout + - run: + name: Greeting + command: echo Hello, world. + - run: + name: Print the Current Time + command: date + + coverage: + docker: + - image: debian:stretch + steps: + - checkout + - run: + name: Greeting + command: echo Hello, world. + - run: + name: Print the Current Time + command: date + -# Invoke jobs via workflows -# See: https://circleci.com/docs/2.0/configuration-reference/#workflows workflows: - say-hello-workflow: + version: 2 + check_build_test: jobs: - - say-hello + - checkout-code + - cppcheck: + requires: + - checkout-code + - shellcheck: + requires: + - checkout-code + - cmake-format: + requires: + - checkout-code + - clang-tidy: + requires: + - checkout-code + - build-gcc-7: + requires: + - cppcheck + - shellcheck + - cmake-format + - build-gcc-8: + requires: + - cppcheck + - shellcheck + - cmake-format + - build-clang-7: + requires: + - cppcheck + - shellcheck + - cmake-format + - unit-test: + requires: + - build-gcc-8 + - integration-test: + requires: + - build-gcc-8 + - unit-test-asan: + requires: + - build-clang-7 + - coverage: + requires: + - unit-test diff --git a/README.md b/README.md index 9bed371..d613107 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Following features are included: - [x] static code analysis tools like linters ([`cppcheck`](cppcheck), [`clang-tidy`][clangtidy], [`shellcheck`][shcheck]) - [x] continuous integration: useful not only for pull requests - ([Travis CI][travis], [AppVeyor][appveyor], [GitLab CI][gitlabci]) + ([Travis CI][travis], [AppVeyor][appveyor],[Circle CI 2.0][circleci], [GitLab CI][gitlabci]) - [ ] continuous deployment to [GitHub Pages][githubpg] - [x] code coverage using [Codecov][codecov] - [x] third-party package management using [conan][conan] @@ -108,6 +108,7 @@ Because we use range-v3 and other modern C++ features, we only support these com [appveyor]: https://ci.appveyor.com/project/archer96/cpp-starter-project [catch2]: https://github.com/catchorg/Catch2 +[circleci]: https://circleci.com/ [clangfmt]: https://clang.llvm.org/docs/ClangFormat.html [clangtidy]: https://clang.llvm.org/extra/clang-tidy/ [cmake]: https://cmake.org/ diff --git a/docs/cpp-starter/continuous-integration.md b/docs/cpp-starter/continuous-integration.md index 92cc90d..2470cfe 100644 --- a/docs/cpp-starter/continuous-integration.md +++ b/docs/cpp-starter/continuous-integration.md @@ -27,3 +27,7 @@ at https://gitlab.com/bugwelle/docker-modern-cpp-cmake It includes recent versions of GCC and clang, cppcheck and other usefule tools. By using custom docker images we could also use the latest C++ features available, etc. + +## Circle CI +Circle CI is free for open source projects. We use Circle CI's version 2 +format.