diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 758e6abf..1256c03c 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -1,15 +1,20 @@ name: CI -on: [push, pull_request] +on: + push: + pull_request: + schedule: + - cron: "0 9 * * 5" jobs: build: + if: github.event_name == 'pull_request' || github.event_name == 'push' runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: include: - platform: x64 - configuration: release + configuration: release os: windows-2019 WITH_LIBSODIUM: ON ENABLE_CURVE: ON @@ -18,26 +23,113 @@ jobs: MSVCYEAR: vs2019 ARTIFACT_NAME: v142-x64 ENABLE_DRAFTS: ON - # - platform: Win32 - # configuration: Release - # os: windows-2016 - # WITH_LIBSODIUM: ON - # ENABLE_CURVE: ON - # CMAKE_GENERATOR: "Visual Studio 15 2017" - # MSVCVERSION: "v141" - # MSVCYEAR: "vs2017" - # ARTIFACT_NAME: v141 - # ENABLE_DRAFTS: ON - platform: x64 configuration: Release - os: windows-2016 - WITH_LIBSODIUM: ON - ENABLE_CURVE: ON + os: windows-2016 + WITH_LIBSODIUM: ON + ENABLE_CURVE: ON CMAKE_GENERATOR: "Visual Studio 15 2017 Win64" MSVCVERSION: "v141" MSVCYEAR: "vs2017" ARTIFACT_NAME: v141-x64 ENABLE_DRAFTS: ON + - os: ubuntu-latest + BUILD_TYPE: default + PACKAGES: asciidoc xmlto + CURVE: tweetnacl + DRAFT: disabled + POLLER: select + - os: ubuntu-latest + BUILD_TYPE: default + CURVE: tweetnacl + DRAFT: disabled + POLLER: poll + - os: ubuntu-latest + BUILD_TYPE: android + CURVE: tweetnacl + DRAFT: disabled + - os: ubuntu-latest + BUILD_TYPE: coverage + PACKAGES: libkrb5-dev libnorm-dev libpgm-dev libgnutls28-dev lcov + CURVE: tweetnacl + DRAFT: enabled + GSSAPI: enabled + PGM: enabled + NORM: enabled + TIPC: enabled + TLS: enabled + VMCI: enabled + - os: ubuntu-latest + BUILD_TYPE: valgrind + PACKAGES: valgrind libgnutls28-dev + CURVE: tweetnacl + DRAFT: enabled + - os: ubuntu-latest + BUILD_TYPE: cmake + CURVE: libsodium + DRAFT: enabled + PACKAGES: cmake libsodium-dev + TLS: enabled + - os: ubuntu-latest + BUILD_TYPE: cmake + DRAFT: enabled + PACKAGES: cmake clang-format-11 + DO_CLANG_FORMAT_CHECK: 1 + - os: ubuntu-latest + BUILD_TYPE: default + PACKAGES: libkrb5-dev libnorm-dev libpgm-dev libgnutls28-dev libsodium-dev libnss3-dev libbsd-dev + CURVE: libsodium + ADDRESS_SANITIZER: enabled + DRAFT: enabled + - os: ubuntu-latest + BUILD_TYPE: default + PACKAGES: libkrb5-dev libnorm-dev libpgm-dev libgnutls28-dev libsodium-dev libnss3-dev libbsd-dev + CURVE: libsodium + GSSAPI: enabled + PGM: enabled + NORM: enabled + TIPC: enabled + IPv6: ON + TLS: enabled + USE_NSS: yes + VMCI: enabled + DRAFT: enabled + - os: ubuntu-latest + BUILD_TYPE: default + PACKAGES: libkrb5-dev libnorm-dev libpgm-dev libgnutls28-dev libsodium-dev libnss3-dev + CURVE: libsodium + GSSAPI: enabled + PGM: enabled + NORM: enabled + TIPC: enabled + IPv6: ON + TLS: enabled + USE_NSS: yes + VMCI: enabled + DRAFT: enabled + FORCE_98: enabled + CXX: clang++ + - os: ubuntu-latest + BUILD_TYPE: abi-compliance-checker + PACKAGES: abi-dumper abi-compliance-checker + CURVE: tweetnacl + DRAFT: disabled + - os: ubuntu-latest + BUILD_TYPE: cmake + PACKAGES: clang-tidy clang-tools + CURVE: tweetnacl + DRAFT: enabled + CXX: clang++ + - os: macos-latest + BUILD_TYPE: default + PACKAGES: automake autoconf + CURVE: tweetnacl + DRAFT: enabled + - os: macos-latest + BUILD_TYPE: default + PACKAGES: automake autoconf libsodium + CURVE: libsodium + DRAFT: disabled env: platform: ${{ matrix.platform }} configuration: ${{ matrix.configuration }} @@ -51,6 +143,22 @@ jobs: SODIUM_INCLUDE_DIR: ${{ github.workspace }}\libsodium\src\libsodium\include" SODIUM_LIBRARY_DIR: ${{ github.workspace }}\libsodium\bin\${{ matrix.platform }}\${{ matrix.configuration }}\${{ matrix.MSVCVERSION }}\dynamic" LIBZMQ_SRCDIR: ${{ github.workspace }}\libzmq + BUILD_TYPE: ${{ matrix.BUILD_TYPE }} + CURVE: ${{ matrix.CURVE }} + DRAFT: ${{ matrix.DRAFT }} + ADDRESS_SANITIZER: ${{ matrix.ADDRESS_SANITIZER }} + DO_CLANG_FORMAT_CHECK: ${{ matrix.DO_CLANG_FORMAT_CHECK }} + FORCE_98: ${{ matrix.FORCE_98 }} + CXX: ${{ matrix.CXX }} + GSSAPI: ${{ matrix.GSSAPI }} + PGM: ${{ matrix.PGM }} + NORM: ${{ matrix.NORM }} + TIPC: ${{ matrix.TIPC }} + IPv6: ${{ matrix.IPv6 }} + TLS: ${{ matrix.TLS }} + USE_NSS: ${{ matrix.USE_NSS }} + VMCI: ${{ matrix.VMCI }} + POLLER: ${{ matrix.POLLER }} steps: - name: Add msbuild to PATH uses: microsoft/setup-msbuild@v1.0.2 @@ -65,29 +173,71 @@ jobs: with: repository: jedisct1/libsodium ref: stable - path: libsodium + path: libsodium - name: Compile libsodium - if: matrix.WITH_LIBSODIUM == 'ON' + if: matrix.WITH_LIBSODIUM == 'ON' && (matrix.os == 'windows-2019' || matrix.os == 'windows-2016') shell: cmd working-directory: libsodium run: msbuild /v:minimal /p:Configuration=%Configuration%DLL builds\msvc\%MSVCYEAR%\libsodium\libsodium.vcxproj - name: Copy libsodium - if: matrix.WITH_LIBSODIUM == 'ON' + if: matrix.WITH_LIBSODIUM == 'ON' && (matrix.os == 'windows-2019' || matrix.os == 'windows-2016') shell: powershell working-directory: libsodium run: Copy-Item "bin\${env:Platform}\${env:Configuration}\${env:MSVCVERSION}\dynamic\libsodium.lib" -Destination "bin\${env:Platform}\${env:Configuration}\${env:MSVCVERSION}\dynamic\sodium.lib" - uses: actions/checkout@v2 with: path: libzmq - - run: md build_libzmq + - run: md build_libzmq shell: cmd - - name: build + if: matrix.os == 'windows-2019' || matrix.os == 'windows-2016' + - name: build-win + if: matrix.os == 'windows-2019' || matrix.os == 'windows-2016' shell: cmd working-directory: build_libzmq run: | cmake -D CMAKE_INCLUDE_PATH="%SODIUM_INCLUDE_DIR%" -D CMAKE_LIBRARY_PATH="%SODIUM_LIBRARY_DIR%" -D WITH_LIBSODIUM="%WITH_LIBSODIUM%" -D ENABLE_DRAFTS="%ENABLE_DRAFTS%" -D ENABLE_ANALYSIS="%ENABLE_ANALYSIS%" -D ENABLE_CURVE="%ENABLE_CURVE%" -D API_POLLER="%API_POLLER%" -D POLLER="%POLLER%" %EXTRA_FLAGS% -D WITH_LIBSODIUM="%WITH_LIBSODIUM%" -D LIBZMQ_WERROR="%LIBZMQ_WERROR%" -G "%CMAKE_GENERATOR%" "%LIBZMQ_SRCDIR%" cmake --build . --config %configuration% --target install -- -verbosity:Minimal -maxcpucount - - name: test - shell: cmd + - name: test + if: matrix.os == 'windows-2019' || matrix.os == 'windows-2016' + shell: cmd working-directory: build_libzmq run: ctest -C "%Configuration%" + - name: Add debian packages + if: matrix.os == 'ubuntu-latest' && (matrix.BUILD_TYPE != 'coverage' || github.repository == 'zeromq/libzmq') + uses: myci-actions/add-deb-repo@10 + with: + repo-name: obs + repo: deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_20.04/ ./ + keys-asc: https://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_20.04/Release.key + install: ${{ matrix.PACKAGES }} + - name: Add brew packages + if: matrix.os == 'macos-latest' + shell: bash + run: brew install ${{ matrix.PACKAGES }} + - name: build + if: (matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest') && (matrix.BUILD_TYPE != 'coverage' || github.repository == 'zeromq/libzmq') + shell: bash + working-directory: libzmq + run: ./ci_build.sh + - name: coveralls + if: matrix.BUILD_TYPE == 'coverage' && github.repository == 'zeromq/libzmq' + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + path-to-lcov: /home/runner/work/libzmq/libzmq/libzmq/lcov.info + cron: + runs-on: ubuntu-latest + if: github.event_name == 'schedule' + strategy: + fail-fast: false + env: + BUILD_TYPE: cmake + CXX: clang++ + CLANG_TIDY: clang-tidy + steps: + - name: Add debian packages + run: apt-get install --yes clang-tidy clang-tools + - name: build + shell: bash + working-directory: libzmq + run: ./ci_build.sh diff --git a/.travis.yml b/.travis.yml index 01127233..e4cb1dd8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,6 @@ language: c os: - linux -- osx dist: bionic @@ -12,8 +11,6 @@ cache: ccache env: matrix: - - BUILD_TYPE=default CURVE=tweetnacl DRAFT=enabled - - BUILD_TYPE=cmake CURVE=tweetnacl - BUILD_TYPE=default # tokens to deploy releases on OBS and create/delete temporary branch on Github. # 1) Create a token on https://github.com/settings/tokens/new with "public_repo" @@ -26,163 +23,6 @@ env: - secure: lbZSzmqN39QdJwewKOZgq/1ijPKuyx9MFrGzMqXj2+eOSlaZS/tNavHMdKJOev+qJGK9wxmwzxOxS10AiH+AvN7WBacXX4ZtudjScz2HKJRDWTKyzMbzyScq51afniItzrsm+Vo8NHkenNFkux0sSbh0aHlpkLwrGQu+WZWcDN4= - secure: "ZFL7hLJlGwYix8fF835OnQYakBt/o5iS7IfSW7el44ejEvGAOM9O5/ufxCcqSqn8Np7nOaM3RriAVTqWPZD6S7tMeflGTSGYHPYwWUc83z4rUPyG2FWVKXdB8ufpebAwu3hCgLiSmVeoQG47dl6xNk1oKCd+3UIjgz33u1Ecfps=" -matrix: - include: - - if: type = cron OR (branch =~ analyze$ AND type = push) - env: BUILD_TYPE=cmake CLANG_TIDY=/usr/bin/clang-tidy-10 CC=clang-10 CXX=clang++-10 - os: linux - compiler: clang - addons: - apt: - sources: - - ubuntu-toolchain-r-test - - llvm-toolchain-10 - packages: - - clang-10 - - clang-tools-10 - - clang-tidy-10 - - env: BUILD_TYPE=default CURVE=tweetnacl IPv6=ON - os: linux - dist: precise - - env: BUILD_TYPE=coverage CURVE=tweetnacl GSSAPI=enabled PGM=enabled NORM=enabled TIPC=enabled IPv6=ON TLS=enabled DRAFT=enabled - os: linux - addons: - apt: - sources: - - sourceline: 'deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_18.04/ ./' - key_url: 'http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_18.04/Release.key' - packages: - - libkrb5-dev - - libnorm-dev - - libpgm-dev - - libgnutls28-dev - - lcov - - env: BUILD_TYPE=valgrind CURVE=tweetnacl DRAFT=enabled TLS=enabled - os: linux - dist: xenial - addons: - apt: - packages: - - valgrind - - libgnutls-dev - - env: BUILD_TYPE=default CURVE=libsodium GSSAPI=enabled PGM=enabled NORM=enabled VMCI=enabled - os: linux - addons: - apt: - sources: - - sourceline: 'deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_14.04/ ./' - key_url: 'http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_14.04/Release.key' - packages: - - libkrb5-dev - - libnorm-dev - - libpgm-dev - - libsodium-dev - - asciidoc - - xmlto - - env: BUILD_TYPE=default DRAFT=enabled TLS=enabled - os: linux - dist: xenial - addons: - apt: - packages: - - libgnutls-dev - - env: BUILD_TYPE=default CURVE=libsodium DRAFT=enabled GSSAPI=enabled PGM=enabled NORM=enabled TIPC=enabled USE_NSS=yes - os: linux - addons: - apt: - sources: - - sourceline: 'deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_14.04/ ./' - key_url: 'http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_14.04/Release.key' - packages: - - libkrb5-dev - - libnorm-dev - - libpgm-dev - - libsodium-dev - - libnss3-dev - - libbsd-dev - - env: BUILD_TYPE=default CURVE=libsodium DRAFT=enabled - os: osx - addons: - homebrew: - packages: - - libsodium - - env: BUILD_TYPE=default CURVE=libsodium DRAFT=enabled ADDRESS_SANITIZER=enabled - os: linux - addons: - apt: - packages: - - libsodium-dev - - env: BUILD_TYPE=android CURVE=tweetnacl - os: linux - dist: trusty - - env: BUILD_TYPE=cmake DO_CLANG_FORMAT_CHECK=1 CLANG_FORMAT=/usr/lib/llvm-8/bin/clang-format - os: linux - addons: - apt: - packages: - - clang-format-8 - - env: BUILD_TYPE=default POLLER=poll - os: linux - - env: BUILD_TYPE=default POLLER=select - os: linux - - env: CXX=clang++ BUILD_TYPE=default CURVE=libsodium GSSAPI=enabled PGM=enabled NORM=enabled FORCE_98=enabled - os: linux - compiler: clang - addons: - apt: - sources: - - sourceline: 'deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_14.04/ ./' - key_url: 'http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_14.04/Release.key' - packages: - - libkrb5-dev - - libnorm-dev - - libpgm-dev - - libsodium-dev - - env: BUILD_TYPE=abi-compliance-checker - os: linux - dist: xenial - addons: - apt: - packages: - - abi-dumper - - abi-compliance-checker - - name: Linux ARM64 - env: BUILD_TYPE=default CURVE=tweetnacl GSSAPI=enabled PGM=enabled NORM=enabled IPv6=ON TLS=enabled DRAFT=enabled - os: linux - dist: bionic - arch: arm64 - addons: - apt: - sources: - - sourceline: 'deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_18.04/ ./' - key_url: 'http://download.opensuse.org/repositories/network:/messaging:/zeromq:/git-stable/xUbuntu_18.04/Release.key' - packages: - - zip - - libkrb5-dev - - libnorm-dev - - libpgm-dev - - libgnutls28-dev - allow_failures: - - arch: arm64 - -before_install: -# To allow sonar to process history information, unshallow clone first. -- if [ -n "$CLANG_TIDY" ] ; then - git fetch --unshallow ; - curl -L https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip -o build-wrapper-linux-x86.zip ; - unzip build-wrapper-linux-x86.zip ; - export SONARCLOUD_BUILD_WRAPPER_PATH="$(pwd)/build-wrapper-linux-x86/" ; - curl -L https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.2.0.1873-linux.zip -o sonar-scanner-cli.zip ; - unzip sonar-scanner-cli.zip ; - export SONAR_SCANNER_CLI_PATH="$(pwd)/sonar-scanner-4.2.0.1873-linux/bin/" ; - fi - -before_script: -# ZMQ stress tests need more open socket (files) than the usual default -# On OSX, it seems the way to set the max files limit is constantly changing, so -# try to use all known knobs to ensure compatibility across various versions -- if [ $TRAVIS_OS_NAME == "osx" ] ; then sudo sysctl -w kern.maxfiles=64000 ; sudo sysctl -w kern.maxfilesperproc=64000 ; sudo launchctl limit maxfiles 64000 64000 ; ulimit -n 64000; fi - # Build and check this project according to the BUILD_TYPE script: ./ci_build.sh diff --git a/README.md b/README.md index fdda65b3..0937b607 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # ZeroMQ -[![Build Status](https://travis-ci.com/zeromq/libzmq.svg?branch=master)](https://travis-ci.com/zeromq/libzmq) +[![Build Status](https://github.com/zeromq/libzmq/actions/workflows/CI.yaml/badge.svg)](https://github.com/zeromq/libzmq/actions/workflows/CI.yaml) [![Build status](https://ci.appveyor.com/api/projects/status/e2ks424yrs1un3wt?svg=true)](https://ci.appveyor.com/project/zeromq/libzmq) [![Coverage Status](https://coveralls.io/repos/github/zeromq/libzmq/badge.svg?branch=master)](https://coveralls.io/github/zeromq/libzmq?branch=master) diff --git a/builds/cmake/ci_build.sh b/builds/cmake/ci_build.sh index dea9756a..c7b61fde 100755 --- a/builds/cmake/ci_build.sh +++ b/builds/cmake/ci_build.sh @@ -52,6 +52,15 @@ CMAKE_PREFIXES=() MAKE_PREFIXES=() PARALLEL_MAKE_OPT="-j5" if [ -n "$CLANG_TIDY" ] ; then + # To allow sonar to process history information, unshallow clone first. + git fetch --unshallow + curl -L https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip -o build-wrapper-linux-x86.zip + unzip build-wrapper-linux-x86.zip + export SONARCLOUD_BUILD_WRAPPER_PATH="${PWD}/build-wrapper-linux-x86/" + curl -L https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.2.0.1873-linux.zip -o sonar-scanner-cli.zip + unzip sonar-scanner-cli.zip + export SONAR_SCANNER_CLI_PATH="${PWD}/sonar-scanner-4.2.0.1873-linux/bin/" + CMAKE_OPTS+=("-DCMAKE_BUILD_TYPE=Debug") # do a debug build to avoid unused variable warnings with assertions, and to speed up build CMAKE_OPTS+=("-DCMAKE_CXX_CLANG_TIDY:STRING=${CLANG_TIDY}") if [ -n ${SONARCLOUD_BUILD_WRAPPER_PATH} ] ; then diff --git a/builds/coverage/ci_build.sh b/builds/coverage/ci_build.sh index 8896116a..39a0457d 100755 --- a/builds/coverage/ci_build.sh +++ b/builds/coverage/ci_build.sh @@ -10,7 +10,5 @@ set_config_opts CONFIG_OPTS+=("--enable-code-coverage") -pip install --user cpp-coveralls - # Build, check, and install from local source -( cd ../..; ./autogen.sh && ./configure "${CONFIG_OPTS[@]}" && make VERBOSE=1 -j5 check && coveralls --include src --exclude src/tweetnacl.c --exclude src/tweetnacl.h --build-root . --gcov-options '\-lp') || exit 1 +( cd ../..; ./autogen.sh && ./configure "${CONFIG_OPTS[@]}" && make VERBOSE=1 -j5 check-code-coverage CODE_COVERAGE_OUTPUT_FILE=lcov.info CODE_COVERAGE_OUTPUT_DIRECTORY=coverage) || exit 1