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 21, 2021
1 parent f1dd038 commit 33937b9
Show file tree
Hide file tree
Showing 21 changed files with 380 additions and 493 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/centos7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ env:
LANG: en_US.UTF-8
LC_ALL: en_US.UTF-8
LC_LANG: en_US.UTF-8
USE_STATIC_DEPENDENCIES: yes
USE_DYNAMIC_BUILD_DEPS: yes
BOTAN_VERSION: 2.17.3 # NOTE: 2.18.x may need newer GCC versions to build
VCPKG_ROOT: /opt/vcpkg
VCPKG_TRIPLET: x64-linux
DOWNLOAD_RUBYRNP: Off

jobs:
Expand Down Expand Up @@ -98,26 +100,24 @@ jobs:
yum -y -q install sudo
echo -e "rnpuser\tALL=(ALL)\tNOPASSWD:\tALL" > /etc/sudoers.d/rnpuser
echo -e "rnpuser\tsoft\tnproc\tunlimited\n" > /etc/security/limits.d/30-rnpuser.conf
chown -R rnpuser:rnpuser $PWD
- name: Setup environment
run: |
. ci/gha/setup-env.inc.sh
exec su rnpuser -c ci/install_noncacheable_dependencies.sh
- name: Cache
id: cache
- id: vcpkg-cache
uses: actions/cache@v2
with:
path: ${{ env.CACHE_DIR }}
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: |
set -x
chown -R rnpuser:rnpuser $PWD
exec su rnpuser -c ci/install_cacheable_dependencies.sh
path: ${{ env.VCPKG_ROOT }}/installed
key: vcpkg-${{ matrix.env.IMAGE }}-${{ 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)

- name: tests
run: |
set -x
chown -R rnpuser:rnpuser $PWD
exec su rnpuser -c ci/run.sh
- name: symbol-visibility
run: |
Expand All @@ -128,7 +128,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 All @@ -149,7 +149,7 @@ jobs:
- name: Test
run: |
set -euxo pipefail
export USE_STATIC_DEPENDENCIES=no
export USE_DYNAMIC_BUILD_DEPS=no
ci/install_noncacheable_dependencies.sh
ci/install_cacheable_dependencies.sh
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 @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/centos8.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
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
141 changes: 74 additions & 67 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ env:
CORES: 2
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 +38,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 +84,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 +118,20 @@ 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: 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,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
- 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
env:
VCPKG_TRIPLET: x64-linux

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 "$@"
11 changes: 2 additions & 9 deletions ci/gha/setup-env.inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,13 @@ fi
ln -s "$GITHUB_WORKSPACE/installs" "${rnp_local_installs}"
LOCAL_INSTALLS="${rnp_local_installs}"

# When building packages, dependencies with non-standard installation paths must
# be found by the (DEB) package builder.
BOTAN_INSTALL="${rnp_local_installs}/botan-install"
JSONC_INSTALL="${rnp_local_installs}/jsonc-install"
GPG_INSTALL="${rnp_local_installs}/gpg-install"

# set this explicitly since we don't want to cache the rnp installation
RNP_INSTALL="${GITHUB_WORKSPACE}/rnp-install"

for var in \
LOCAL_BUILDS \
CACHE_DIR \
LOCAL_INSTALLS \
BOTAN_INSTALL \
JSONC_INSTALL \
GPG_INSTALL \
RNP_INSTALL
do
val="${!var}"
Expand All @@ -58,3 +49,5 @@ do

echo "${var}=${val}" >> "$GITHUB_ENV"
done

echo "${VCPKG_ROOT}" >> $GITHUB_PATH
2 changes: 1 addition & 1 deletion ci/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ set -exu

. ci/env.inc.sh

install_static_cacheable_build_dependencies "$@"
rubygem_install_build_dependencies "$@"
7 changes: 0 additions & 7 deletions ci/install_cacheable_dependencies.sh

This file was deleted.

2 changes: 1 addition & 1 deletion ci/install_noncacheable_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ set -exu
. ci/env.inc.sh

"${OS}_install"
install_static_noncacheable_build_dependencies_if_needed "$@"
rubygem_install_build_dependencies "$@"
Loading

0 comments on commit 33937b9

Please sign in to comment.