Skip to content

Commit

Permalink
#1648 building dependencies with vcpkg (skip ci)
Browse files Browse the repository at this point in the history
  • Loading branch information
CAMOBAP committed Nov 20, 2021
1 parent 5d6b598 commit 63df656
Show file tree
Hide file tree
Showing 15 changed files with 338 additions and 152 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/centos7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ env:
jobs:
tests:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
if: false
container:
image: ${{ matrix.env.IMAGE }}
timeout-minutes: 70
Expand Down Expand Up @@ -127,7 +127,7 @@ jobs:
[ $(grep -c rnp_version_string_full exports) == "1" ]
pkgconfig-cmake-target:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
if: false
container:
image: centos:7
timeout-minutes: 10
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/centos8-ossl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ env:
jobs:
tests:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
if: false
container:
image: ${{ matrix.env.IMAGE }}
timeout-minutes: 70
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/centos8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ env:
jobs:
tests:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
if: false
container:
image: ${{ matrix.env.IMAGE }}
timeout-minutes: 70
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/debian9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
tests:
name: ${{ matrix.env.IMAGE }} [CC ${{ matrix.env.CC }}; GnuPG stable]
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip ci')"
if: false
container:
image: ${{ matrix.env.IMAGE }}
timeout-minutes: 120
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
CXX: g++
- CC: clang
CXX: clang++
if: "!contains(github.event.head_commit.message, 'skip ci')"
if: false
env: ${{ matrix.env }}
timeout-minutes: 250
steps:
Expand Down
137 changes: 71 additions & 66 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@ env:
BUILD_MODE: normal
GPG_VERSION: stable
USE_STATIC_DEPENDENCIES: yes
VCPKG_ROOT: '/usr/local/share/vcpkg'

jobs:
tests:
name: ${{ matrix.os }} [CC ${{ matrix.env.CC }}; GnuPG stable]
name: ${{ matrix.triplet }} ${{ matrix.build_type }} ${{ matrix.env.CC }}; GnuPG stable
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, 'skip ci')"
timeout-minutes: 50
strategy:
fail-fast: false
matrix:
Expand All @@ -36,37 +39,41 @@ jobs:
CXX: g++
- CC: clang
CXX: clang++
if: "!contains(github.event.head_commit.message, 'skip ci')"
triplet: [x64-linux, x64-linux-dynamic]
build_type: [Release, Debug]
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
- run: ci/install_noncacheable_dependencies.sh

- if: matrix.triplet == 'x64-linux-dynamic'
run: |
. ci/gha/setup-env.inc.sh
ci/install_noncacheable_dependencies.sh
- name: Cache
id: cache
cp ${{ env.VCPKG_ROOT }}/triplets/x64-linux.cmake ${{ env.VCPKG_ROOT }}/triplets/x64-linux-dynamic.cmake
sed -i -- 's/static/dynamic/g' ${{ env.VCPKG_ROOT }}/triplets/x64-linux-dynamic.cmake
- id: vcpkg-cache
uses: actions/cache@v2
with:
path: ${{ env.CACHE_DIR }}
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: |
set -x
ci/install_cacheable_dependencies.sh
- name: tests
run: |
set -x
ci/run.sh
- 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"
path: ${{ env.VCPKG_ROOT }}/installed
key: vcpkg-${{ matrix.os }}-${{ hashFiles('vcpkg.txt') }}-${{ matrix.triplet }}

- if: steps.vcpkg-cache.outputs.cache-hit != 'true'
run: vcpkg install --triplet ${{ matrix.triplet }} --overlay-ports=vcpkg/ports $(cat vcpkg.txt)

- run: ci/run.sh
env:
BUILD_TYPE: ${{ matrix.build_type }}
VCPKG_TRIPLET: ${{ matrix.triplet }}

- run: ci/build_package_deb.sh
env:
BUILD_TYPE: ${{ matrix.build_type }}
VCPKG_TRIPLET: ${{ matrix.triplet }}

cmake-offline-googletest-src:
env:
GTEST_SOURCES: /usr/src/googletest
Expand All @@ -78,29 +85,29 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Setup environment
run: |
. ci/gha/setup-env.inc.sh
ci/install_noncacheable_dependencies.sh
sudo apt-get -y install googletest
- name: Cache
id: cache

- run: . ci/gha/setup-env.inc.sh
- run: ci/install_noncacheable_dependencies.sh
- run: sudo apt-get -y install googletest

- id: vcpkg-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
path: ${{ env.VCPKG_ROOT }}/installed
key: vcpkg-${{ matrix.os }}-${{ hashFiles('vcpkg.txt') }}-${{ matrix.triplet }}

- if: steps.vcpkg-cache.outputs.cache-hit != 'true'
run: vcpkg install --triplet x64-linux --overlay-ports=vcpkg/ports $(cat vcpkg.txt)

- name: tests
run: |
set -x
ci/run.sh
[ -d "${LOCAL_BUILDS}/rnp-build/src/tests" ]
[ -d "${LOCAL_BUILDS}/rnp-build/src/tests/googletest-build" ]
[ ! -d "${LOCAL_BUILDS}/rnp-build/src/tests/googletest-src" ]
env:
VCPKG_TRIPLET: x64-linux
cmake-offline-googletest:
env:
DOWNLOAD_GTEST: Off
Expand All @@ -112,23 +119,19 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: Setup environment
run: |
. ci/gha/setup-env.inc.sh
ci/install_noncacheable_dependencies.sh
sudo apt-get -y install googletest
- name: Cache
id: cache

- run: . ci/gha/setup-env.inc.sh
- run: ci/install_noncacheable_dependencies.sh

- id: vcpkg-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
path: ${{ env.VCPKG_ROOT }}/installed
key: vcpkg-${{ matrix.os }}-${{ hashFiles('vcpkg.txt') }}-${{ matrix.triplet }}

- if: steps.vcpkg-cache.outputs.cache-hit != 'true'
run: vcpkg install --triplet x64-linux --overlay-ports=vcpkg/ports $(cat vcpkg.txt)

- name: Build googletest
run: |
set -x
Expand All @@ -137,13 +140,16 @@ jobs:
cmake /usr/src/googletest
sudo make -j2 install
popd
- name: tests
run: |
set -x
ci/run.sh
[ -d "${LOCAL_BUILDS}/rnp-build/src/tests" ]
[ ! -d "${LOCAL_BUILDS}/rnp-build/src/tests/googletest-build" ]
[ ! -d "${LOCAL_BUILDS}/rnp-build/src/tests/googletest-src" ]
env:
VCPKG_TRIPLET: x64-linux
cmake-disable-rubyrnp:
env:
DOWNLOAD_RUBYRNP: Off
Expand All @@ -155,28 +161,27 @@ jobs:
- 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

- run: . ci/gha/setup-env.inc.sh
- run: ci/install_noncacheable_dependencies.sh

- id: vcpkg-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
path: ${{ env.VCPKG_ROOT }}/installed
key: vcpkg-${{ matrix.os }}-${{ hashFiles('vcpkg.txt') }}-${{ matrix.triplet }}

- if: steps.vcpkg-cache.outputs.cache-hit != 'true'
run: vcpkg install --triplet x64-linux --overlay-ports=vcpkg/ports $(cat vcpkg.txt)

- 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')"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-msys2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
tests:
name: ${{ matrix.os }} msys2 [CC ${{ matrix.env.CC }}; GnuPG stable]
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, 'skip ci')"
if: false
timeout-minutes: 70
strategy:
fail-fast: false
Expand Down
16 changes: 16 additions & 0 deletions ci/build_package_deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash
set -euxo pipefail

main() {
pushd "${LOCAL_BUILDS}/rnp-build"
local build_type_subdir
if [[ "${BUILD_TYPE}" == "Debug" ]]; then
build_type_subdir="/debug"
else
build_type_subdir=""
fi
cpack -G DEB -D CPACK_DEBIAN_PACKAGE_SHLIBDEPS_PRIVATE_DIRS="${VCPKG_ROOT}/installed/${VCPKG_TRIPLET}${build_type_subdir}/lib"
popd
}

main "$@"
22 changes: 18 additions & 4 deletions ci/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ set -eux
: "${DIST_VERSION:=}"

: "${SKIP_TESTS:=0}"
: "${BUILD_TYPE:=Release}"

prepare_build_prerequisites() {
CMAKE=cmake
Expand All @@ -32,11 +33,19 @@ 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"
if [[ "${BUILD_TYPE}" == "Debug" ]]; then
build_type_subdir="/debug"
else
build_type_subdir=""
fi

lib_path="${VCPKG_ROOT}/installed/${VCPKG_TRIPLET}${build_type_subdir}/lib"

export LD_LIBRARY_PATH="${lib_path}"

# update dll search path for windows
if [[ "${OS}" = "msys" ]]; then
export PATH="${LOCAL_BUILDS}/rnp-build/lib:${LOCAL_BUILDS}/rnp-build/bin:${LOCAL_BUILDS}/rnp-build/src/lib:${BOTAN_INSTALL}/bin:$PATH"
export PATH="${lib_path}:$PATH"
fi
}

Expand Down Expand Up @@ -81,11 +90,16 @@ main() {
pushd "${LOCAL_BUILDS}/rnp-build"

cmakeopts=(
-DCMAKE_BUILD_TYPE=Release # RelWithDebInfo -- DebInfo commented out to speed up recurring CI runs.
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" # RelWithDebInfo -- DebInfo commented out to speed up recurring CI runs.
-DBUILD_SHARED_LIBS=yes
-DCMAKE_INSTALL_PREFIX="${RNP_INSTALL}"
-DCMAKE_PREFIX_PATH="${BOTAN_INSTALL};${JSONC_INSTALL};${GPG_INSTALL}"
)

[ -n "${VCPKG_TRIPLET:-}" ] && [ -n "${VCPKG_ROOT:-}" ] && {
cmakeopts+=(-DVCPKG_TARGET_TRIPLET="${VCPKG_TRIPLET}")
cmakeopts+=(-DCMAKE_TOOLCHAIN_FILE="${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake")
}

[[ ${SKIP_TESTS} = 1 ]] && cmakeopts+=(-DBUILD_TESTING=OFF)
[[ "${BUILD_MODE}" = "coverage" ]] && cmakeopts+=(-DENABLE_COVERAGE=yes)
[[ "${BUILD_MODE}" = "sanitize" ]] && cmakeopts+=(-DENABLE_SANITIZERS=yes)
Expand Down
2 changes: 2 additions & 0 deletions cmake/Modules/FindBotan2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ if (BOTAN2_FOUND AND NOT TARGET Botan2::Botan2)
PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${BOTAN2_INCLUDE_DIRS}"
)
# https://gitlab.kitware.com/cmake/cmake/-/issues/15052
file(MAKE_DIRECTORY ${BOTAN2_INCLUDE_DIRS})
endif()
# set the required libraries for the target
if (EXISTS "${BOTAN2_LIBRARY}")
Expand Down
Loading

0 comments on commit 63df656

Please sign in to comment.