xref: /freebsd/contrib/libcbor/.circleci/config.yml (revision abd872540f24cfc7dbd1ea29b6918c7082a22108)
15d3e7166SEd Masteversion: 2.1
25d3e7166SEd Maste
35d3e7166SEd Mastecommands:
45d3e7166SEd Maste  linux-setup:
55d3e7166SEd Maste    steps:
65d3e7166SEd Maste    - run: sudo apt-get update
7*abd87254SEd Maste    # NEEDRESTART_MODE prevents automatic restarts which seem to hang.
8*abd87254SEd Maste    - run: sudo NEEDRESTART_MODE=l apt-get install -y cmake ${TOOLCHAIN_PACKAGES}
9*abd87254SEd Maste    - run: sudo NEEDRESTART_MODE=l apt-get install -y libcmocka-dev libcjson-dev
105d3e7166SEd Maste  build:
115d3e7166SEd Maste    steps:
125d3e7166SEd Maste    - run: >
135d3e7166SEd Maste        cmake -DWITH_TESTS=ON \
14*abd87254SEd Maste          -DWITH_EXAMPLES=ON \
155d3e7166SEd Maste          -DCMAKE_BUILD_TYPE=Debug \
165d3e7166SEd Maste          -DSANITIZE=OFF \
175d3e7166SEd Maste          -DCOVERAGE="${CMAKE_COVERAGE:='OFF'}" \
185d3e7166SEd Maste          .
195d3e7166SEd Maste    - run: make -j 16 VERBOSE=1
205d3e7166SEd Maste  build-release:
215d3e7166SEd Maste    steps:
225d3e7166SEd Maste    - run: >
235d3e7166SEd Maste        cmake -DWITH_TESTS=ON \
245d3e7166SEd Maste          -DCMAKE_BUILD_TYPE=Release \
255d3e7166SEd Maste          .
265d3e7166SEd Maste    - run: make -j 16 VERBOSE=1
275d3e7166SEd Maste  test:
285d3e7166SEd Maste    steps:
295d3e7166SEd Maste    - run: ctest -VV
305d3e7166SEd Maste
315d3e7166SEd Masteorbs:
325d3e7166SEd Maste  codecov: codecov/codecov@3.2.2
335d3e7166SEd Maste
345d3e7166SEd Mastejobs:
355d3e7166SEd Maste  static-test:
36*abd87254SEd Maste    machine: &default-machine
37*abd87254SEd Maste      image: ubuntu-2204:2023.07.2
385d3e7166SEd Maste    environment:
395d3e7166SEd Maste      TOOLCHAIN_PACKAGES: g++
405d3e7166SEd Maste    steps:
415d3e7166SEd Maste      - checkout
425d3e7166SEd Maste      - linux-setup
43*abd87254SEd Maste      - run: sudo NEEDRESTART_MODE=l apt-get install -y clang-format doxygen cppcheck
445d3e7166SEd Maste      - run: cppcheck --inline-suppr --error-exitcode=1 .
455d3e7166SEd Maste      - run: bash clang-format.sh --verbose
465d3e7166SEd Maste      - run: >
475d3e7166SEd Maste          if ! $(git diff-index --quiet HEAD); then
485d3e7166SEd Maste            echo "Code formatting doesn't conform to clang-format"
495d3e7166SEd Maste            echo "Please run clang-format.sh, commit the diff, and push to re-run CI"
505d3e7166SEd Maste            echo "Excerpt of the diff follows"
515d3e7166SEd Maste            git diff | head -n 20
525d3e7166SEd Maste          fi
535d3e7166SEd Maste      - run: >
545d3e7166SEd Maste          if doxygen Doxyfile | grep 'warning: '; then
555d3e7166SEd Maste            echo "Doxygen warning (see above) -- misformatted docs?"
565d3e7166SEd Maste            exit 1
575d3e7166SEd Maste          fi
585d3e7166SEd Maste      - run: >
595d3e7166SEd Maste          cd doc &&
605d3e7166SEd Maste          pip3 install -r source/requirements.txt &&
615d3e7166SEd Maste          make html
625d3e7166SEd Maste
635d3e7166SEd Maste  build-and-test:
645d3e7166SEd Maste    machine:
65*abd87254SEd Maste      <<: *default-machine
665d3e7166SEd Maste    environment:
675d3e7166SEd Maste      TOOLCHAIN_PACKAGES: g++
685d3e7166SEd Maste      CMAKE_COVERAGE: ON
695d3e7166SEd Maste    steps:
705d3e7166SEd Maste      - checkout
715d3e7166SEd Maste      - linux-setup
72*abd87254SEd Maste      - run: sudo NEEDRESTART_MODE=l apt-get install -y valgrind
735d3e7166SEd Maste      - build
745d3e7166SEd Maste      - test
755d3e7166SEd Maste      - run: ctest -T Coverage
765d3e7166SEd Maste      - codecov/upload
775d3e7166SEd Maste      - run: ctest --output-on-failure -T memcheck | tee memcheck.out
785d3e7166SEd Maste      - run: >
795d3e7166SEd Maste          if grep -q 'Memory Leak\|IPW\|Uninitialized Memory Conditional\|Uninitialized Memory Read' memcheck.out; then
805d3e7166SEd Maste            cat Testing/Temporary/MemoryChecker*
815d3e7166SEd Maste            exit 1
825d3e7166SEd Maste          fi;
835d3e7166SEd Maste
845d3e7166SEd Maste  build-and-test-clang:
855d3e7166SEd Maste    machine:
86*abd87254SEd Maste      <<: *default-machine
875d3e7166SEd Maste    environment:
885d3e7166SEd Maste      TOOLCHAIN_PACKAGES: clang
895d3e7166SEd Maste      CC: clang
905d3e7166SEd Maste      CXX: clang++
915d3e7166SEd Maste    steps:
925d3e7166SEd Maste      - checkout
935d3e7166SEd Maste      - linux-setup
945d3e7166SEd Maste      - build
955d3e7166SEd Maste      - test
965d3e7166SEd Maste
975d3e7166SEd Maste  build-and-test-32b:
985d3e7166SEd Maste    machine:
99*abd87254SEd Maste      <<: *default-machine
1005d3e7166SEd Maste    steps:
1015d3e7166SEd Maste      - checkout
1025d3e7166SEd Maste      - run: sudo apt-get update
103*abd87254SEd Maste      - run: sudo NEEDRESTART_MODE=l apt-get install -y cmake gcc-multilib g++-multilib libc6-dev-i386
1045d3e7166SEd Maste      # Make cmocka from source w/ 32b setup
1055d3e7166SEd Maste      - run: git clone https://git.cryptomilk.org/projects/cmocka.git ~/cmocka
1065d3e7166SEd Maste      - run: >
1075d3e7166SEd Maste          cd $(mktemp -d /tmp/build.XXXX) &&
1085d3e7166SEd Maste          cmake ~/cmocka -DCMAKE_TOOLCHAIN_FILE=~/cmocka/cmake/Toolchain-cross-m32.cmake &&
1095d3e7166SEd Maste          make &&
1105d3e7166SEd Maste          sudo make install
1115d3e7166SEd Maste      # Piggyback on the cmocka 32b toolchain
1125d3e7166SEd Maste      - run: >
1135d3e7166SEd Maste          cmake -DWITH_TESTS=ON \
1145d3e7166SEd Maste            -DCMAKE_BUILD_TYPE=Debug \
1155d3e7166SEd Maste            -DCMAKE_TOOLCHAIN_FILE=~/cmocka/cmake/Toolchain-cross-m32.cmake \
1165d3e7166SEd Maste            .
1175d3e7166SEd Maste      - run: make -j 16 VERBOSE=1
1185d3e7166SEd Maste      - test
1195d3e7166SEd Maste
1205d3e7166SEd Maste  build-and-test-release-clang:
1215d3e7166SEd Maste    machine:
122*abd87254SEd Maste      <<: *default-machine
1235d3e7166SEd Maste    environment:
1245d3e7166SEd Maste      TOOLCHAIN_PACKAGES: clang
1255d3e7166SEd Maste      CC: clang
1265d3e7166SEd Maste      CXX: clang++
1275d3e7166SEd Maste    steps:
1285d3e7166SEd Maste      - checkout
1295d3e7166SEd Maste      - linux-setup
1305d3e7166SEd Maste      - build-release
1315d3e7166SEd Maste      - test
1325d3e7166SEd Maste
1335d3e7166SEd Maste  llvm-coverage:
1345d3e7166SEd Maste    machine:
135*abd87254SEd Maste      <<: *default-machine
1365d3e7166SEd Maste    environment:
1375d3e7166SEd Maste      TOOLCHAIN_PACKAGES: clang
1385d3e7166SEd Maste      CC: clang
1395d3e7166SEd Maste      CXX: clang++
1405d3e7166SEd Maste      CMAKE_COVERAGE: ON
1415d3e7166SEd Maste    steps:
1425d3e7166SEd Maste      - checkout
1435d3e7166SEd Maste      - linux-setup
1445d3e7166SEd Maste      - build
1455d3e7166SEd Maste      - run: make llvm-coverage
1465d3e7166SEd Maste
1475d3e7166SEd Maste
1485d3e7166SEd Maste  build-and-test-arm:
1495d3e7166SEd Maste    machine:
150*abd87254SEd Maste      <<: *default-machine
1515d3e7166SEd Maste    environment:
1525d3e7166SEd Maste      TOOLCHAIN_PACKAGES: g++
1535d3e7166SEd Maste    resource_class: arm.medium
1545d3e7166SEd Maste    steps:
1555d3e7166SEd Maste      - checkout
1565d3e7166SEd Maste      - linux-setup
1575d3e7166SEd Maste      - build
1585d3e7166SEd Maste      - test
1595d3e7166SEd Maste
1605d3e7166SEd Maste  build-bazel:
1615d3e7166SEd Maste    machine:
162*abd87254SEd Maste      image: ubuntu-2204:2023.07.2
1635d3e7166SEd Maste    environment:
1645d3e7166SEd Maste      TOOLCHAIN_PACKAGES: g++
1655d3e7166SEd Maste    steps:
1665d3e7166SEd Maste      - checkout
1675d3e7166SEd Maste      - linux-setup
1685d3e7166SEd Maste      - run: sudo apt install apt-transport-https curl gnupg
1695d3e7166SEd Maste      - run: curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg
1705d3e7166SEd Maste      - run: sudo mv bazel.gpg /etc/apt/trusted.gpg.d/
1715d3e7166SEd Maste      - run: echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
1725d3e7166SEd Maste      - run: sudo apt update
1735d3e7166SEd Maste      - run: sudo apt install bazel
1745d3e7166SEd Maste      - run: bazel --version
1755d3e7166SEd Maste      - run: >
1765d3e7166SEd Maste          pushd examples/bazel &&
1775d3e7166SEd Maste          bazel run -s src:hello
1785d3e7166SEd Maste
1795d3e7166SEd Maste  build-and-test-osx:
1805d3e7166SEd Maste    macos:
1815d3e7166SEd Maste      xcode: 12.5.1
1825d3e7166SEd Maste    steps:
1835d3e7166SEd Maste      - checkout
1845d3e7166SEd Maste      - run: bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
1855d3e7166SEd Maste      - run: brew install cmocka cmake
1865d3e7166SEd Maste      - build
1875d3e7166SEd Maste      - test
1885d3e7166SEd Maste
1895d3e7166SEd Maste
1905d3e7166SEd Maste  build-and-test-win:
1915d3e7166SEd Maste    resource_class: 'windows.medium'
1925d3e7166SEd Maste    machine:
1935d3e7166SEd Maste      image: 'windows-server-2022-gui:current'
1945d3e7166SEd Maste      shell: 'bash.exe'
1955d3e7166SEd Maste    steps:
1965d3e7166SEd Maste      - checkout
1975d3e7166SEd Maste      - run: choco install cmake -y
1985d3e7166SEd Maste      - run: git clone https://git.cryptomilk.org/projects/cmocka.git
1995d3e7166SEd Maste      - run: cd cmocka && git checkout tags/cmocka-1.1.5
2005d3e7166SEd Maste      - run: /c/Program\ Files/Cmake/bin/cmake -S cmocka -B cmocka_build
2015d3e7166SEd Maste      - run: /c/Program\ Files/Cmake/bin/cmake --build cmocka_build
2025d3e7166SEd Maste      - run: /c/Program\ Files/Cmake/bin/cmake -S . -B libcbor_build -DWITH_TESTS=ON -DCMOCKA_INCLUDE_DIR=cmocka/include -DCMOCKA_LIBRARIES=$(pwd)/cmocka_build/src/Debug/cmocka.lib
2035d3e7166SEd Maste      - run: /c/Program\ Files/Cmake/bin/cmake --build libcbor_build
2045d3e7166SEd Maste      - run: >
2055d3e7166SEd Maste          export PATH="$(pwd)/cmocka_build/src/Debug/:$PATH" &&
2065d3e7166SEd Maste          /c/Program\ Files/Cmake/bin/ctest.exe --test-dir libcbor_build --output-on-failure
2075d3e7166SEd Maste
2085d3e7166SEd Masteworkflows:
2095d3e7166SEd Maste  build-and-test:
2105d3e7166SEd Maste    jobs:
2115d3e7166SEd Maste      - static-test
2125d3e7166SEd Maste      - build-and-test
2135d3e7166SEd Maste      - build-and-test-clang
2145d3e7166SEd Maste      - build-and-test-32b
2155d3e7166SEd Maste      - build-and-test-release-clang
2165d3e7166SEd Maste      - build-and-test-arm
2175d3e7166SEd Maste      - build-and-test-win
2185d3e7166SEd Maste      - build-bazel
2195d3e7166SEd Maste      - llvm-coverage
2205d3e7166SEd Maste      # OSX builds are expensive, run only on master
2215d3e7166SEd Maste      - build-and-test-osx:
2225d3e7166SEd Maste          requires:
2235d3e7166SEd Maste            - build-and-test
2245d3e7166SEd Maste          filters:
2255d3e7166SEd Maste            branches:
2265d3e7166SEd Maste              only: [master]
227