diff --git a/.github/workflows/centos7.yml b/.github/workflows/centos7.yml index 0da04465ed..dd3d6de286 100644 --- a/.github/workflows/centos7.yml +++ b/.github/workflows/centos7.yml @@ -9,6 +9,8 @@ on: - 'docs/**' - '**.adoc' - '**.md' + - '.github/workflows/*.yml' + - '!.github/workflows/centos7.yml' pull_request: paths-ignore: - 'docs/**' @@ -36,19 +38,42 @@ jobs: matrix: env: - BUILD_MODE: normal - GPG_VERSION: stable + GPG_VERSION: stable + CC: gcc + CXX: g++ + - BUILD_MODE: normal + GPG_VERSION: beta + CC: gcc + CXX: g++ + - BUILD_MODE: normal + GPG_VERSION: stable + CC: clang + CXX: clang++ - BUILD_MODE: normal GPG_VERSION: beta + CC: clang + CXX: clang++ +# Sanitize can only been tested with the clang compiler (why ???) +# see env-common.inc.sh - BUILD_MODE: sanitize GPG_VERSION: stable + CC: clang + CXX: clang++ - BUILD_MODE: sanitize GPG_VERSION: beta + CC: clang + CXX: clang++ +# Coverage can only been tested with the GNU compiler. - BUILD_MODE: coverage GPG_VERSION: beta RNP_TESTS: cli_tests + CC: gcc + CXX: g++ - BUILD_MODE: coverage GPG_VERSION: beta RNP_TESTS: rnp_tests + CC: gcc + CXX: g++ env: ${{ matrix.env }} steps: - run: | @@ -72,7 +97,7 @@ jobs: uses: actions/cache@v2 with: path: ${{ env.CACHE_DIR }} - key: ${{ github.workflow }}-${{ runner.os }}-${{ matrix.env.BUILD_MODE }}-gpg-${{ matrix.env.GPG_VERSION }}-${{ hashFiles('ci/**') }}-${{ hashFiles('.github/workflows/**') }} + key: ${{ github.workflow }}-${{ runner.os }}-${{ matrix.env.BUILD_MODE }}-${{ matrix.env.CC }}-gpg-${{ matrix.env.GPG_VERSION }}-${{ hashFiles('ci/**') }}-${{ hashFiles('.github/workflows/**') }} - name: Build cache if: steps.cache.outputs.cache-hit != 'true' run: | @@ -95,14 +120,26 @@ jobs: if: "!contains(github.event.head_commit.message, 'skip ci')" container: image: centos:7 - timeout-minutes: 10 + timeout-minutes: 30 strategy: + fail-fast: false matrix: env: - BUILD_SHARED_LIBS: yes + CC: gcc + CXX: g++ - BUILD_SHARED_LIBS: no + CC: gcc + CXX: g++ +# We think do not need it but it is here if we start thinking that we need it +# - BUILD_SHARED_LIBS: yes +# CC: clang +# CXX: clang++ +# - BUILD_SHARED_LIBS: no +# CC: clang +# CXX: clang++ env: ${{ matrix.env }} - continue-on-error: true + name: pkgconfig-cmake-target BUILD_SHARED_LIBS=${{ matrix.env.BUILD_SHARED_LIBS }}, ${{ matrix.env.CC }}, ${{ matrix.env.CXX }} steps: - run: | yum -y install http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm @@ -116,12 +153,9 @@ jobs: export USE_STATIC_DEPENDENCIES=no ci/install_noncacheable_dependencies.sh ci/install_cacheable_dependencies.sh - . ci/env.inc.sh - # build+install build_and_install /usr - # check for install issues check_build build_example_pkgconfig diff --git a/.github/workflows/centos8-ossl.yml b/.github/workflows/centos8-ossl.yml index 280f8a05e0..bbeb8ba9ff 100644 --- a/.github/workflows/centos8-ossl.yml +++ b/.github/workflows/centos8-ossl.yml @@ -1,11 +1,21 @@ name: centos8-openssl on: - pull_request: push: branches: - master - 'release/**' + paths-ignore: + - 'docs/**' + - '**.adoc' + - '**.md' + - '.github/workflows/*.yml' + - '!.github/workflows/centos8-ossl.yml' + pull_request: + paths-ignore: + - 'docs/**' + - '**.adoc' + - '**.md' env: CORES: 2 @@ -23,17 +33,40 @@ jobs: image: centos:8 timeout-minutes: 70 strategy: - fail-fast: false matrix: env: - BUILD_MODE: normal RNP_TESTS: rnp_tests + CC: gcc + CXX: g++ - BUILD_MODE: sanitize RNP_TESTS: rnp_tests + CC: gcc + CXX: g++ - BUILD_MODE: normal RNP_TESTS: cli_tests + CC: gcc + CXX: g++ - BUILD_MODE: sanitize RNP_TESTS: cli_tests + CC: gcc + CXX: g++ + - BUILD_MODE: normal + RNP_TESTS: rnp_tests + CC: clang + CXX: clang++ + - BUILD_MODE: sanitize + RNP_TESTS: rnp_tests + CC: clang + CXX: clang++ + - BUILD_MODE: normal + RNP_TESTS: cli_tests + CC: clang + CXX: clang++ + - BUILD_MODE: sanitize + RNP_TESTS: cli_tests + CC: clang + CXX: clang++ env: ${{ matrix.env }} steps: - run: | @@ -56,7 +89,7 @@ jobs: uses: actions/cache@v2 with: path: ${{ env.CACHE_DIR }} - key: ${{ github.workflow }}-${{ runner.os }}-${{ matrix.env.BUILD_MODE }}-gpg-${{ matrix.env.GPG_VERSION }}-${{ hashFiles('ci/**') }}-${{ hashFiles('.github/workflows/**') }} + key: ${{ github.workflow }}-${{ runner.os }}-${{ matrix.env.BUILD_MODE }}-${{ matrix.env.CC }}-gpg-${{ matrix.env.GPG_VERSION }}-${{ hashFiles('ci/**') }}-${{ hashFiles('.github/workflows/**') }} - name: Build cache if: steps.cache.outputs.cache-hit != 'true' run: | @@ -74,3 +107,4 @@ jobs: export CRYPTO_BACKEND=openssl chown -R rnpuser:rnpuser $PWD exec su rnpuser -c ci/run.sh + diff --git a/.github/workflows/centos8.yml b/.github/workflows/centos8.yml index 0ddb2fb711..71830b4e9e 100644 --- a/.github/workflows/centos8.yml +++ b/.github/workflows/centos8.yml @@ -9,6 +9,8 @@ on: - 'docs/**' - '**.adoc' - '**.md' + - '.github/workflows/*.yml' + - '!.github/workflows/centos8.yml' pull_request: paths-ignore: - 'docs/**' @@ -36,27 +38,49 @@ jobs: env: - BUILD_MODE: normal GPG_VERSION: stable + CC: gcc + CXX: g++ - BUILD_MODE: normal GPG_VERSION: beta + CC: gcc + CXX: g++ - BUILD_MODE: normal GPG_VERSION: 2.3.1 - - BUILD_MODE: sanitize + CC: gcc + CXX: g++ + - BUILD_MODE: normal GPG_VERSION: stable - - # TODO: fix build error: - # libcommon.a(libcommon_a-iobuf.o):(.bss+0x8): multiple definition of `iobuf_debug_mode' - # t-iobuf.o:(.bss+0x0): first defined here - # clang-11: error: linker command failed with exit code 1 (use -v to see invocation) - # - # - BUILD_MODE: sanitize - # GPG_VERSION: beta - + CC: clang + CXX: clang++ + - BUILD_MODE: normal + GPG_VERSION: beta + CC: clang + CXX: clang++ + - BUILD_MODE: normal + GPG_VERSION: 2.3.1 + CC: clang + CXX: clang++ +# Coverage can only been tested with the GNU compiler - BUILD_MODE: coverage GPG_VERSION: beta RNP_TESTS: cli_tests + CC: gcc + CXX: g++ - BUILD_MODE: coverage GPG_VERSION: beta RNP_TESTS: rnp_tests + CC: gcc + CXX: g++ +# Sanitize is only tested with the clang compiler +# see env-common.inc.sh + - BUILD_MODE: sanitize + GPG_VERSION: stable + CC: clang + CXX: clang++ + - BUILD_MODE: sanitize + GPG_VERSION: beta + CC: clang + CXX: clang++ env: ${{ matrix.env }} steps: - run: | @@ -79,7 +103,7 @@ jobs: uses: actions/cache@v2 with: path: ${{ env.CACHE_DIR }} - key: ${{ github.workflow }}-${{ runner.os }}-${{ matrix.env.BUILD_MODE }}-gpg-${{ matrix.env.GPG_VERSION }}-${{ hashFiles('ci/**') }}-${{ hashFiles('.github/workflows/**') }} + key: ${{ github.workflow }}-${{ runner.os }}-${{ matrix.env.BUILD_MODE }}-${{ matrix.env.CC }}-gpg-${{ matrix.env.GPG_VERSION }}-${{ hashFiles('ci/**') }}-${{ hashFiles('.github/workflows/**') }} - name: Build cache if: steps.cache.outputs.cache-hit != 'true' run: | @@ -99,18 +123,35 @@ jobs: grep -qw rnp_version_string exports pkgconfig-cmake-target: runs-on: ubuntu-latest - # TODO: re-enable when the following can pass - if: "${{ false && !contains(github.event.head_commit.message, 'skip ci') }}" + if: "${{ !contains(github.event.head_commit.message, 'skip ci') }}" container: image: centos:8 - timeout-minutes: 10 + timeout-minutes: 30 strategy: + fail-fast: false +# CXXFLAGS environment setting resolves dual ABI issues caused by BOTAN libraries +# https://gcc.gnu.org/onlinedocs/gcc-5.2.0/libstdc++/manual/manual/using_dual_abi.html matrix: env: - BUILD_SHARED_LIBS: yes + CC: gcc + CXX: g++ + CXXFLAGS: -D_GLIBCXX_USE_CXX11_ABI=0 - BUILD_SHARED_LIBS: no + CC: gcc + CXX: g++ + CXXFLAGS: -D_GLIBCXX_USE_CXX11_ABI=0 +# We think do not need it but it is here if we start thinking that we need it +# - BUILD_SHARED_LIBS: yes +# CC: clang +# CXX: clang++ +# CXXFLAGS: -D_GLIBCXX_USE_CXX11_ABI=0 +# - BUILD_SHARED_LIBS: no +# CC: clang +# CXX: clang++ +# CXXFLAGS: -D_GLIBCXX_USE_CXX11_ABI=0 env: ${{ matrix.env }} - continue-on-error: true + name: pkgconfig-cmake-target BUILD_SHARED_LIBS=${{ matrix.env.BUILD_SHARED_LIBS }}, ${{ matrix.env.CC }}, ${{ matrix.env.CXX }} steps: - run: | yum -y install git @@ -119,18 +160,14 @@ jobs: fetch-depth: 1 - name: Test run: | - # cmake set -euxo pipefail export USE_STATIC_DEPENDENCIES=no ci/install_noncacheable_dependencies.sh ci/install_cacheable_dependencies.sh - . ci/env.inc.sh - # build+install build_and_install /usr - # check for install issues check_build build_example_pkgconfig diff --git a/.github/workflows/debian9.yml b/.github/workflows/debian9.yml index 84902dd1bf..5e142fa67d 100644 --- a/.github/workflows/debian9.yml +++ b/.github/workflows/debian9.yml @@ -9,6 +9,8 @@ on: - 'docs/**' - '**.adoc' - '**.md' + - '.github/workflows/*.yml' + - '!.github/workflows/debian9.yml' pull_request: paths-ignore: - 'docs/**' @@ -37,44 +39,48 @@ jobs: strategy: fail-fast: false matrix: -# I386: actions/checkout@V2, actions/cache@V2 actions/cache@V2 -# give error about OCI container [https://github.com/actions/checkout/issues/334] -# [https://github.com/actions/runner/issues/1011] env: - - CPU: i386 + - CC: gcc + CXX: g++ + CPU: i386 + IMAGE: "i386/debian:9" + - CC: clang + CXX: clang++ + CPU: i386 IMAGE: "i386/debian:9" env: ${{ matrix.env }} + name: ${{ matrix.env.IMAGE }}, ${{ matrix.env.CC }}, ${{ matrix.env.CXX }} steps: - name: Install prerequisites run: | apt update apt -y install git sudo - + apt -y install git sudo +# I386: actions/checkout@V2, actions/cache@V2 actions/cache@V2 +# give error about OCI container [https://github.com/actions/checkout/issues/334] +# [https://github.com/actions/runner/issues/1011] - name: Check out repository uses: actions/checkout@v1 with: - fetch-depth: 1 + fetch-depth: 10 - name: Setup noncacheable dependencies run: | . ci/gha/setup-env.inc.sh ci/install_noncacheable_dependencies.sh shell: bash - # - name: Cache # id: cache # uses: actions/cache@v2 # with: # path: ${{github.workspace}}/${{ env.CACHE_DIR }} # key: ${{runner.os}}-${{ matrix.env.CPU }}-${{ matrix.env.IMAGE }}-v1 - - name: Setup cacheable dependencies if: steps.cache.outputs.cache-hit != 'true' run: | set -euxo pipefail ci/install_cacheable_dependencies.sh shell: bash - - name: Add rnpuser # it's only needed for rnpkeys_generatekey_verifykeyHomeDirNoPermission test run: | @@ -82,16 +88,15 @@ jobs: printf "\nrnpuser\tALL=(ALL)\tNOPASSWD:\tALL" > /etc/sudoers.d/rnpuser printf "\nrnpuser\tsoft\tnproc\tunlimited\n" > /etc/security/limits.d/30-rnpuser.conf echo "SUDO=sudo" >> $GITHUB_ENV - - name: Build and Test run: | set -x chown -R rnpuser:rnpuser $PWD exec su rnpuser -c ci/run.sh shell: bash - - name: Package run: | set -x cd ${LOCAL_BUILDS}/rnp-build cpack -G DEB -D CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS="${BOTAN_INSTALL}/lib;${JSONC_INSTALL}/lib;${GPG_INSTALL}/lib" + diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 5d54b3e519..18d42aa243 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -9,6 +9,8 @@ on: - 'docs/**' - '**.adoc' - '**.md' + - '.github/workflows/*.yml' + - '!.github/workflows/macos.yml' pull_request: paths-ignore: - 'docs/**' @@ -23,13 +25,19 @@ env: jobs: tests: - name: ${{ matrix.os }} - runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: os: [macos-10.15, macos-11.0] + env: + - CC: gcc + CXX: g++ + - CC: clang + CXX: clang++ if: "!contains(github.event.head_commit.message, 'skip ci')" + name: ${{ matrix.os }}, ${{ matrix.env.CC }}, ${{ matrix.env.CXX }} + runs-on: ${{ matrix.os }} + env: ${{ matrix.env }} timeout-minutes: 250 steps: - uses: actions/checkout@v2 @@ -44,7 +52,7 @@ jobs: uses: actions/cache@v2 with: path: ${{ env.CACHE_DIR }} - key: ${{ github.workflow }}-${{ matrix.os }}-${{ env.BUILD_MODE }}-gpg-${{ env.GPG_VERSION }}-${{ hashFiles('ci/**') }}-${{ hashFiles('.github/workflows/**') }} + key: ${{ github.workflow }}-${{ matrix.os }}-${{ env.BUILD_MODE }}-${{ matrix.env.CC }}-gpg-${{ env.GPG_VERSION }}-${{ hashFiles('ci/**') }}-${{ hashFiles('.github/workflows/**') }} - name: Build cache if: steps.cache.outputs.cache-hit != 'true' run: | diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 6bff64c01a..79461e526c 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -9,6 +9,8 @@ on: - 'docs/**' - '**.adoc' - '**.md' + - '.github/workflows/*.yml' + - '!.github/workflows/ubuntu.yml' pull_request: paths-ignore: - 'docs/**' @@ -23,8 +25,17 @@ env: jobs: tests: + strategy: + matrix: + env: + - CC: gcc + CXX: g++ + - CC: clang + CXX: clang++ runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'skip ci')" + name: ubuntu ${{ matrix.env.CC }}, ${{ matrix.env.CXX }} + env: ${{ matrix.env }} timeout-minutes: 50 steps: - uses: actions/checkout@v2 @@ -39,7 +50,7 @@ jobs: uses: actions/cache@v2 with: path: ${{ env.CACHE_DIR }} - key: ${{ github.workflow }}-${{ runner.os }}-${{ env.BUILD_MODE }}-gpg-${{ env.GPG_VERSION }}-${{ hashFiles('ci/**') }}-${{ hashFiles('.github/workflows/**') }} + key: ${{ github.workflow }}-${{ runner.os }}-${{ env.BUILD_MODE }}-${{ matrix.env.CC }}-gpg-${{ env.GPG_VERSION }}-${{ hashFiles('ci/**') }}-${{ hashFiles('.github/workflows/**') }} - name: Build cache if: steps.cache.outputs.cache-hit != 'true' run: | @@ -55,12 +66,22 @@ jobs: cd ${LOCAL_BUILDS}/rnp-build cpack -G DEB -D CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS="${BOTAN_INSTALL}/lib;${JSONC_INSTALL}/lib;${GPG_INSTALL}/lib" cmake-offline-googletest-src: - env: - GTEST_SOURCES: /usr/src/googletest - RNP_TESTS: rnp_tests + strategy: + matrix: + env: + - CC: gcc + CXX: g++ + GTEST_SOURCES: /usr/src/googletest + RNP_TESTS: rnp_tests +# We think do not need it but it is here if we start thinking that we need it +# - CC: clang +# CXX: clang++ +# GTEST_SOURCES: /usr/src/googletest +# RNP_TESTS: rnp_tests runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'skip ci')" - timeout-minutes: 30 + env: ${{ matrix.env }} + timeout-minutes: 50 steps: - uses: actions/checkout@v2 with: @@ -89,11 +110,21 @@ jobs: [ -d "${LOCAL_BUILDS}/rnp-build/src/tests/googletest-build" ] [ ! -d "${LOCAL_BUILDS}/rnp-build/src/tests/googletest-src" ] cmake-offline-googletest: - env: - DOWNLOAD_GTEST: Off - RNP_TESTS: rnp_tests + strategy: + matrix: + env: + - CC: gcc + CXX: g++ + DOWNLOAD_GTEST: Off + RNP_TESTS: rnp_tests +# We think do not need it but it is here if we start thinking that we need it +# - CC: clang +# CXX: clang++ +# DOWNLOAD_GTEST: Off +# RNP_TESTS: rnp_tests runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'skip ci')" + env: ${{ matrix.env }} timeout-minutes: 50 steps: - uses: actions/checkout@v2 @@ -132,38 +163,48 @@ jobs: [ ! -d "${LOCAL_BUILDS}/rnp-build/src/tests/googletest-build" ] [ ! -d "${LOCAL_BUILDS}/rnp-build/src/tests/googletest-src" ] cmake-disable-rubyrnp: - env: - DOWNLOAD_RUBYRNP: Off - RNP_TESTS: rnp_tests.hash_test_success + strategy: + matrix: + env: + - CC: gcc + CXX: g++ + DOWNLOAD_RUBYRNP: Off + RNP_TESTS: rnp_tests.hash_test_success +# We think do not need it but it is here if we start thinking that we need it +# - CC: clang +# CXX: clang++ +# DOWNLOAD_RUBYRNP: Off +# RNP_TESTS: rnp_tests.hash_test_success runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'skip ci')" + env: ${{ matrix.env }} timeout-minutes: 50 steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 1 - - name: Setup environment - run: | - . ci/gha/setup-env.inc.sh - ci/install_noncacheable_dependencies.sh - - name: Cache - id: cache - uses: actions/cache@v2 - with: - path: ${{ env.CACHE_DIR }} - key: ${{ github.workflow }}-${{ github.job }}-${{ runner.os }}-${{ env.BUILD_MODE }}-gpg-${{ env.GPG_VERSION }}-${{ hashFiles('ci/**') }}-${{ hashFiles('.github/workflows/**') }} - - name: Build cache - if: steps.cache.outputs.cache-hit != 'true' - run: | - set -x - ci/install_cacheable_dependencies.sh - - name: tests - run: | - set -x - ci/run.sh - ls -la "${RNP_INSTALL}/lib/"librnp*.so - ! ctest -N | grep 'ruby' > /dev/null - ! ls -la src/tests/ | grep 'ruby' > /dev/null + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - name: Setup environment + run: | + . ci/gha/setup-env.inc.sh + ci/install_noncacheable_dependencies.sh + - name: Cache + id: cache + uses: actions/cache@v2 + with: + path: ${{ env.CACHE_DIR }} + key: ${{ github.workflow }}-${{ github.job }}-${{ runner.os }}-${{ env.BUILD_MODE }}-gpg-${{ env.GPG_VERSION }}-${{ hashFiles('ci/**') }}-${{ hashFiles('.github/workflows/**') }} + - name: Build cache + if: steps.cache.outputs.cache-hit != 'true' + run: | + set -x + ci/install_cacheable_dependencies.sh + - name: tests + run: | + set -x + ci/run.sh + ls -la "${RNP_INSTALL}/lib/"librnp*.so + ! ctest -N | grep 'ruby' > /dev/null + ! ls -la src/tests/ | grep 'ruby' > /dev/null version-cmake-up-to-date: runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, 'skip ci')" diff --git a/.github/workflows/windows-msvc.yml b/.github/workflows/windows-msvc.yml index a8c3f32c5f..2b831032c1 100644 --- a/.github/workflows/windows-msvc.yml +++ b/.github/workflows/windows-msvc.yml @@ -8,6 +8,8 @@ on: - 'docs/**' - '**.adoc' - '**.md' + - '.github/workflows/*.yml' + - '!.github/workflows/windows-msvc.yml' pull_request: paths-ignore: - 'docs/**' diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 7f1f66fe4b..13a290fb78 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -9,6 +9,8 @@ on: - 'docs/**' - '**.adoc' - '**.md' + - '.github/workflows/*.yml' + - '!.github/workflows/windows.yml' pull_request: paths-ignore: - 'docs/**' @@ -22,11 +24,25 @@ env: jobs: tests: + strategy: + fail-fast: false + matrix: + env: + - CC: gcc + CXX: g++ + GTEST_SOURCES: /home/runneradmin/googletest-download/googletest-src + - CC: clang + CXX: clang++ + GTEST_SOURCES: /home/runneradmin/googletest-download/googletest-src + # Note re clang setup + # https://github.com/randombit/botan/issues/1191: "botan-2 is c++11 till the end of the times" + # It may cause ABI problems with clang (but not with gcc) if extra library is required and it is not loaded from clang64 repo, + # but comes from mingw64. If so try '-std=c++11' runs-on: windows-latest + name: msys2 ${{ matrix.env.CC }}, ${{ matrix.env.CXX }} + env: ${{ matrix.env }} if: "!contains(github.event.head_commit.message, 'skip ci')" timeout-minutes: 70 - env: - GTEST_SOURCES: /home/runneradmin/googletest-download/googletest-src steps: - uses: actions/checkout@v2 with: @@ -55,7 +71,8 @@ jobs: - name: tests shell: msys2 {0} run: bash ci/main.sh - - shell: msys2 {0} + - name: dependencies + shell: msys2 {0} run: | set -euxo pipefail wget https://github.com/lucasg/Dependencies/releases/download/v1.10/Dependencies_x64_Release.zip @@ -63,3 +80,4 @@ jobs: ./Dependencies -exports $HOME/local-installs/rnp-install/bin/librnp*.dll > exports grep -qv dst_close exports grep -qw rnp_version_string exports + diff --git a/.gitignore b/.gitignore index ef7ef66b7f..20c7cd1f7a 100644 --- a/.gitignore +++ b/.gitignore @@ -443,6 +443,10 @@ $RECYCLE.BIN/ *.msm *.msp +# VS +CMakeSettings.json +.vs/* + # Windows shortcuts *.lnk diff --git a/ci/env-freebsd.inc.sh b/ci/env-freebsd.inc.sh index ba1f025eb2..d2a2fabad2 100644 --- a/ci/env-freebsd.inc.sh +++ b/ci/env-freebsd.inc.sh @@ -1,6 +1,6 @@ #!/usr/bin/env sh -export PATH=/usr/local/bin:$PATH +export PATH="/usr/local/bin:$PATH" export MAKE=gmake export SUDO=sudo diff --git a/ci/env-msys.inc.sh b/ci/env-msys.inc.sh index 9ec404aca7..aafc258cee 100644 --- a/ci/env-msys.inc.sh +++ b/ci/env-msys.inc.sh @@ -6,8 +6,8 @@ export CFLAGS="${CFLAGS}" export CXXFLAGS="${CXXFLAGS}" export LDFLAGS="${LDFLAGS}" -export CC=gcc -export CXX=g++ +export CC=${CC-gcc} +export CXX=${CXX-g++} : "${CORES:=$(nproc --all)}" export CORES export MAKE=make diff --git a/ci/lib/cacheable_install_functions.inc.sh b/ci/lib/cacheable_install_functions.inc.sh index f1cbd5bddf..76624b7472 100644 --- a/ci/lib/cacheable_install_functions.inc.sh +++ b/ci/lib/cacheable_install_functions.inc.sh @@ -158,7 +158,7 @@ _install_gpg() { local common_args=( --force-autogen -# --verbose commnted out to speed up recurring CI builds +# --verbose commented out to speed up recurring CI builds # --trace uncomment if you are debugging CI --build-dir "${gpg_build}" --configure-opts "${configure_opts[*]}" @@ -180,6 +180,11 @@ _install_gpg() { # Workaround to correctly build pinentry on the latest GHA on macOS. Most likely there is a better solution. export CFLAGS="-D_XOPEN_SOURCE_EXTENDED" export CXXFLAGS="-D_XOPEN_SOURCE_EXTENDED" + + # Always build gnugpg with gcc, even if we are testing clang + # ref https://github.com/rnpgp/rnp/issues/1669 + export CC="gcc" + export CXX="g++" for component in libgpg-error:$LIBGPG_ERROR_VERSION \ libgcrypt:$LIBGCRYPT_VERSION \ diff --git a/ci/lib/install_functions.inc.sh b/ci/lib/install_functions.inc.sh index 79e25bb882..83ef804a59 100644 --- a/ci/lib/install_functions.inc.sh +++ b/ci/lib/install_functions.inc.sh @@ -155,18 +155,19 @@ declare util_depedencies_yum=( git ) + declare basic_build_dependencies_yum=( - # cmake3 # XXX: Fedora 22+ only has cmake - clang - gcc - gcc-c++ - make - autoconf - automake - libtool - bzip2 - gzip -) +# cmake3 # XXX: Fedora 22+ only has cmake + clang + gcc + gcc-c++ + make + autoconf + automake + libtool + bzip2 + gzip + ) declare build_dependencies_yum=( ncurses-devel @@ -235,6 +236,7 @@ linux_install_centos7() { ensure_cmake ensure_ruby rubygem_install_build_dependencies + } linux_install_centos8() { @@ -248,6 +250,7 @@ linux_install_centos8() { ensure_cmake ensure_ruby rubygem_install_build_dependencies + } is_use_static_dependencies() { @@ -479,6 +482,7 @@ declare util_dependencies_deb=( sudo wget git + software-properties-common ) declare basic_build_dependencies_deb=( @@ -522,6 +526,17 @@ linux_install_debian() { "${build_dependencies_deb[@]}" \ "$@" + if [ "${CC-gcc}" = "clang" ]; then +# Add apt.llvm.org repository and install clang +# We may use https://packages.debian.org/stretch/clang-3.8 as well but this package gets to +# /usr/lib/clang... and requires update-alternatives which would be very ugly considering CC/CXX environment +# coming from yaml already + wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add - + ${SUDO} apt-add-repository "deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch main" + ${SUDO} apt-get install -y clang + fi + + ensure_automake build_and_install_cmake } @@ -535,8 +550,6 @@ linux_install() { msys_install() { local packages=( tar - zlib-devel - libbz2-devel git automake autoconf @@ -544,21 +557,36 @@ msys_install() { automake-wrapper gnupg2 make - pkg-config + pkg-config mingw64/mingw-w64-x86_64-cmake - mingw64/mingw-w64-x86_64-gcc - mingw64/mingw-w64-x86_64-json-c mingw64/mingw-w64-x86_64-python3 ) + if [ "${CC-gcc}" = "gcc" ]; then + packages+=(mingw64/mingw-w64-x86_64-gcc + mingw64/mingw-w64-x86_64-json-c + ) + else + packages+=(clang64/mingw-w64-clang-x86_64-clang + clang64/mingw-w64-clang-x86_64-openmp + clang64/mingw-w64-clang-x86_64-libc++ + clang64/mingw-w64-clang-x86_64-libbotan + clang64/mingw-w64-clang-x86_64-libssp + clang64/mingw-w64-clang-x86_64-json-c + clang64/mingw-w64-clang-x86_64-libsystre + ) + fi + pacman --noconfirm -S --needed "${packages[@]}" + if [ "${CC-gcc}" = "gcc" ]; then # any version starting with 2.14 up to 2.17.3 caused the application to hang # as described in https://github.com/randombit/botan/issues/2582 # fixed with https://github.com/msys2/MINGW-packages/pull/7640/files - botan_pkg="mingw-w64-x86_64-libbotan-2.17.3-2-any.pkg.tar.zst" - pacman --noconfirm -U https://repo.msys2.org/mingw/x86_64/${botan_pkg} || \ - pacman --noconfirm -U https://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86_64/${botan_pkg} + botan_pkg="mingw-w64-x86_64-libbotan-2.17.3-2-any.pkg.tar.zst" + pacman --noconfirm -U https://repo.msys2.org/mingw/x86_64/${botan_pkg} || \ + pacman --noconfirm -U https://sourceforge.net/projects/msys2/files/REPOS/MINGW/x86_64/${botan_pkg} + fi # msys includes ruby 2.6.1 while we need lower version #wget http://repo.msys2.org/mingw/x86_64/mingw-w64-x86_64-ruby-2.5.3-1-any.pkg.tar.xz -O /tmp/ruby-2.5.3.pkg.tar.xz @@ -699,7 +727,7 @@ is_version_at_least() { local installed_version installed_version_major installed_version_minor #version_patch installed_version="$("$@")" - # shellcheck disable=SC2181 + # shellcheck disable=SC2181 if [[ $? -ne 0 ]]; then need_to_build=1 else @@ -707,7 +735,9 @@ is_version_at_least() { installed_version_minor="${installed_version#*.}" installed_version_minor="${installed_version_minor%%.*}" installed_version_minor="${installed_version_minor:-0}" + # shellcheck disable=SC2295 installed_version_patch="${installed_version#${installed_version_major}.}" + # shellcheck disable=SC2295 installed_version_patch="${installed_version_patch#${installed_version_minor}}" installed_version_patch="${installed_version_patch#.}" installed_version_patch="${installed_version_patch%%.*}" @@ -719,7 +749,9 @@ is_version_at_least() { need_version_minor="${need_version_minor%%.*}" need_version_minor="${need_version_minor:-0}" need_version_patch="${version_constraint##*.}" + # shellcheck disable=SC2295 need_version_patch="${version_constraint#${need_version_major}.}" + # shellcheck disable=SC2295 need_version_patch="${need_version_patch#${need_version_minor}}" need_version_patch="${need_version_patch#.}" need_version_patch="${need_version_patch%%.*}" @@ -780,7 +812,8 @@ build_and_install() { if [[ $# -gt 0 ]]; then shift fi - + + post_build_tool_install_set_env build_rnp "$@" make_install VERBOSE="${VERBOSE}" } @@ -833,7 +866,7 @@ build_example_pkgconfig() { pushd "$(mktemp -d)" || return 1 # shellcheck disable=SC2046 - gcc "${rnpsrc}/src/examples/generate.c" -ogenerate $(pkg-config --cflags --libs $pkgflags librnp) $gccflags + ${CC-gcc} "${rnpsrc}/src/examples/generate.c" -ogenerate $(pkg-config --cflags --libs $pkgflags librnp) $gccflags ./generate readelf -d generate if is_true_cmake_bool "${BUILD_SHARED_LIBS}"; then diff --git a/ci/main.sh b/ci/main.sh index db1062b3fa..febab6c93f 100755 --- a/ci/main.sh +++ b/ci/main.sh @@ -32,11 +32,22 @@ prepare_build_prerequisites() { prepare_test_env() { prepare_build_tool_env - export LD_LIBRARY_PATH="${GPG_INSTALL}/lib:${BOTAN_INSTALL}/lib:${JSONC_INSTALL}/lib:${RNP_INSTALL}/lib:$LD_LIBRARY_PATH" + export LD_LIBRARY_PATH="${GPG_INSTALL}/lib:${BOTAN_INSTALL}/lib:${JSONC_INSTALL}/lib:${RNP_INSTALL}/lib:${LD_LIBRARY_PATH-}" - # update dll search path for windows if [[ "${OS}" = "msys" ]]; then + # update dll search path for windows export PATH="${LOCAL_BUILDS}/rnp-build/lib:${LOCAL_BUILDS}/rnp-build/bin:${LOCAL_BUILDS}/rnp-build/src/lib:$PATH" + if [[ "${CC-gcc}" = "clang" ]]; then + # clang paths shall have higher priority + export PATH="/clang64/bin:$PATH" + export LD_LIBRARY_PATH="/clang64/lib:$LD_LIBRARY_PATH" + export LIBRARY_PATH="/clang64/lib:${LIBRARY_PATH-}" + export C_INCLUDE_PATH="/clang64/include:${C_INCLUDE_PATH-}" + export CPP_INCLUDE_PATH="/clang64/include:${CPP_INCLUDE_PATH-}" + + # clang 'wants' it explicit as opposed to gcc that links to glibc by default + export LDFLAGS="${LDFLAGS-} -lregex" + fi fi }