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 7de0cc5
Show file tree
Hide file tree
Showing 22 changed files with 400 additions and 498 deletions.
38 changes: 24 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-${{ env.IMAGE }}-${{ hashFiles('vcpkg.txt') }}-${{ env.VCPKG_TRIPLET }}

- if: steps.vcpkg-cache.outputs.cache-hit != 'true'
run: vcpkg install --triplet ${{ env.VCPKG_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 Down Expand Up @@ -149,10 +149,20 @@ 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
- id: vcpkg-cache
uses: actions/cache@v2
with:
path: ${{ env.VCPKG_ROOT }}/installed
key: vcpkg-${{ env.IMAGE }}-${{ hashFiles('vcpkg.txt') }}-${{ env.VCPKG_TRIPLET }}

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

- name: Build
run: |
. ci/env.inc.sh
# build+install
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 "$@"
7 changes: 2 additions & 5 deletions ci/env-common.inc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@

: "${LOCAL_BUILDS:=$HOME/local-builds}"
: "${LOCAL_INSTALLS:=$HOME/local-installs}"
: "${BOTAN_INSTALL:=$LOCAL_INSTALLS/botan-install}"
: "${JSONC_INSTALL:=$LOCAL_INSTALLS/jsonc-install}"
: "${GPG_INSTALL:=$LOCAL_INSTALLS/gpg-install}"
: "${RNP_INSTALL:=$LOCAL_INSTALLS/rnp-install}"
: "${RUBY_RNP_INSTALL:=$LOCAL_INSTALLS/ruby-rnp}"
: "${RUBY_RNP_VERSION:=main}"
: "${CPU:=}"
: "${SUDO:=}"

for var in LOCAL_BUILDS LOCAL_INSTALLS BOTAN_INSTALL JSONC_INSTALL \
GPG_INSTALL RNP_INSTALL RUBY_RNP_INSTALL RUBY_RNP_VERSION CPU SUDO; do
for var in LOCAL_BUILDS LOCAL_INSTALLS RNP_INSTALL \
RUBY_RNP_INSTALL RUBY_RNP_VERSION CPU SUDO; do
export "${var?}"
done

Expand Down
Loading

0 comments on commit 7de0cc5

Please sign in to comment.