Skip to content

Commit

Permalink
simplify vcpkg port overrides (#1019)
Browse files Browse the repository at this point in the history
* move vcpkg-overlays into ziti-tunnel-build-action
* include vcpkg overlays when calculating vcpkg cache key for linux builds
  • Loading branch information
scareything authored Oct 14, 2024
1 parent 18bf474 commit 16206d8
Show file tree
Hide file tree
Showing 27 changed files with 37 additions and 50 deletions.
10 changes: 9 additions & 1 deletion .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,17 @@ runs:
vcpkgJsonGlob: './vcpkg.json'

- uses: actions/cache@v4
if: runner.os != 'Linux'
with:
key: deps-${{ inputs.preset }}-${{ hashFiles('./vcpkg.json') }}
path: ./vcpkg_cache

- uses: actions/cache@v4
if: runner.os == 'Linux'
with:
key: deps=${{ inputs.preset }}-${{ hashFiles('./vcpkg.json', '.github/actions/openziti-tunnel-build-action/gh-release/vcpkg-overlays/**/vcpkg.json') }}
path: ./vcpkg_cache

- uses: lukka/[email protected] # pin version to avoid failed glibc dependency on ubuntu 20 runners. go back to @latest when ubuntu 22+ is adopted for runner os.
if: runner.os != 'Linux'
name: Configure CMake
Expand All @@ -62,9 +69,10 @@ runs:
--verbose
- name: configure build action for github release binaries
if: runner.os == 'Linux'
shell: bash
run: |
mv -v ./.github/actions/openziti-tunnel-build-action/gh-release/* ./.github/actions/openziti-tunnel-build-action/
cp -vr ./.github/actions/openziti-tunnel-build-action/gh-release/* ./.github/actions/openziti-tunnel-build-action/
- name: build ziti-edge-tunnel (linux)
if: runner.os == 'Linux'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ cmake -E make_directory ./build
cmake \
--preset "${cmake_preset}" \
-DCMAKE_BUILD_TYPE="${cmake_config}" \
-DVCPKG_OVERLAY_PORTS=./.github/actions/openziti-tunnel-build-action/gh-release/vcpkg-overlays \
-S . \
-B ./build
cmake \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ RUN dnf install -y \
zlib-devel \
systemd-rpm-macros \
cmake-rpm-macros \
openssl-devel \
perl \
&& dnf config-manager --set-enabled powertools \
&& dnf install -y \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ cmake -E make_directory ./build
&& cmake \
--preset "${cmake_preset}" \
-DCMAKE_BUILD_TYPE="${cmake_config}" \
-DVCPKG_OVERLAY_PORTS=./.github/actions/openziti-tunnel-build-action/redhat-8/vcpkg-overlays \
-DBUILD_DIST_PACKAGES=ON \
-S . \
-B ./build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ RUN dnf install -y \
zlib-devel \
systemd-rpm-macros \
cmake-rpm-macros \
openssl-devel \
perl-FindBin perl-IPC-Cmd perl-File-Compare perl-File-Copy \
libatomic \
&& dnf config-manager --set-enabled crb \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ done
cmake \
--preset "${cmake_preset}" \
-DCMAKE_BUILD_TYPE="${cmake_config}" \
-DVCPKG_OVERLAY_PORTS=./.github/actions/openziti-tunnel-build-action/redhat-9/vcpkg-overlays \
-DBUILD_DIST_PACKAGES=ON \
"${TLSUV_TLSLIB:+-DTLSUV_TLSLIB=${TLSUV_TLSLIB}}" \
-S . \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ RUN apt-get update \
pkg-config \
python3 \
zlib1g-dev \
libssl-dev \
ninja-build \
&& rm -rf /var/lib/apt/lists/*

Expand All @@ -41,8 +40,6 @@ RUN sed -Ei 's/^deb/deb [arch=amd64]/g' /etc/apt/sources.list
RUN dpkg --add-architecture arm64 && dpkg --add-architecture armhf
RUN apt-get update \
&& apt-get -y install \
libssl-dev:arm64 \
libssl-dev:armhf \
zlib1g-dev:arm64 \
zlib1g-dev:armhf \
&& rm -rf /var/lib/apt/lists/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ echo "INFO: $(git --version)"
if [ ${#} -ge 1 ]; then
cmake_preset="${1}"
else
cmake_preset="ci-linux-x64-static-libssl"
cmake_preset="ci-linux-x64"
fi

if [ ${#} -ge 2 ]; then
Expand Down Expand Up @@ -50,6 +50,7 @@ cmake \
cmake \
--preset "${cmake_preset}" \
-DCMAKE_BUILD_TYPE="${cmake_config}" \
-DVCPKG_OVERLAY_PORTS=./.github/actions/openziti-tunnel-build-action/ubuntu-20.04/vcpkg-overlays \
-DBUILD_DIST_PACKAGES=ON \
-S "${PWD}/" \
-B ./build/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ RUN apt-get update \
pkg-config \
python3 \
zlib1g-dev \
libssl-dev \
ninja-build \
&& rm -rf /var/lib/apt/lists/*

Expand All @@ -41,8 +40,6 @@ RUN sed -Ei 's/^deb/deb [arch=amd64]/g' /etc/apt/sources.list
RUN dpkg --add-architecture arm64 && dpkg --add-architecture armhf
RUN apt-get update \
&& apt-get -y install \
libssl-dev:arm64 \
libssl-dev:armhf \
zlib1g-dev:arm64 \
zlib1g-dev:armhf \
&& rm -rf /var/lib/apt/lists/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ echo "INFO: $(git --version)"
if [ ${#} -ge 1 ]; then
cmake_preset="${1}"
else
cmake_preset="ci-linux-x64-static-libssl"
cmake_preset="ci-linux-x64"
fi

if [ ${#} -ge 2 ]; then
Expand Down Expand Up @@ -50,6 +50,7 @@ cmake \
cmake \
--preset "${cmake_preset}" \
-DCMAKE_BUILD_TYPE="${cmake_config}" \
-DVCPKG_OVERLAY_PORTS=./.github/actions/openziti-tunnel-build-action/ubuntu-22.04/vcpkg-overlays \
-DBUILD_DIST_PACKAGES=ON \
"${TLSUV_TLSLIB:+-DTLSUV_TLSLIB=${TLSUV_TLSLIB}}" \
-S "${PWD}/" \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "zlib",
"version": "0"
}
10 changes: 5 additions & 5 deletions .github/cpack-matrix.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
cpack_matrix:
arch:
- cmake: ci-linux-x64-static-libssl # selects cmake preset
- cmake: ci-linux-x64 # selects cmake preset
rpm: x86_64 # yum $basearch
deb: amd64 # dpkg --print-architecture
- cmake: ci-linux-arm-static-libssl
- cmake: ci-linux-arm
rpm: armhfp
deb: armhf
- cmake: ci-linux-arm64-static-libssl
- cmake: ci-linux-arm64
rpm: aarch64
deb: arm64
distro:
Expand All @@ -32,8 +32,8 @@ cpack_matrix:
- distro:
name: redhat
arch:
cmake: ci-linux-arm-static-libssl
cmake: ci-linux-arm
- distro:
name: redhat
arch:
cmake: ci-linux-arm64-static-libssl
cmake: ci-linux-arm64
6 changes: 3 additions & 3 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ jobs:

- os: ubuntu-20.04
name: Linux x86_64
preset: linux-x64-static-libssl
preset: linux-x64

- os: ubuntu-20.04
name: Linux arm
preset: linux-arm-static-libssl
preset: linux-arm

- os: ubuntu-20.04
name: Linux arm64
preset: linux-arm64-static-libssl
preset: linux-arm64

steps:
- name: Debug action
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/cpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ jobs:
DISTRO_LABEL: ${{ format('{0}-{1}', matrix.distro.name, matrix.distro.version) }}
shell: bash
run: |
mv -v ./.github/actions/openziti-tunnel-build-action/${DISTRO_LABEL}/* ./.github/actions/openziti-tunnel-build-action/
cp -vr ./.github/actions/openziti-tunnel-build-action/${DISTRO_LABEL}/* ./.github/actions/openziti-tunnel-build-action/
- uses: actions/cache@v4
with:
key: deps-cpack-${{ matrix.arch.rpm }}-${{ matrix.distro.name }}-${{ matrix.distro.version }}-${{ hashFiles('./vcpkg.json') }}
key: deps-cpack-${{ matrix.arch.rpm }}-${{ matrix.distro.name }}-${{ matrix.distro.version }}-${{ hashFiles('./vcpkg.json', './.github/actions/openziti-tunnel-build-action/vcpkg-overlays/**/vcpkg.json') }}
path: ./vcpkg_cache

# entrypoint.sh uses the value of arch to select the cmake preset
Expand Down Expand Up @@ -137,7 +137,7 @@ jobs:
run: |
set -x
cat /etc/*-release
ldd ./build/programs/ziti-edge-tunnel/Release/ziti-edge-tunnel
ldd ./build/programs/ziti-edge-tunnel/RelWithDebInfo/ziti-edge-tunnel
./build/programs/ziti-edge-tunnel/RelWithDebInfo/ziti-edge-tunnel version --verbose
- name: Upload Package to Workflow Summary Page
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-container-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ jobs:
set -x
ls -horRAS ./downloads
mkdir -p ./build/{arm64,amd64}/linux/
unzip -d ./build/arm64/linux/ ./downloads/linux-arm64-static-libssl/ziti-edge-tunnel-Linux_aarch64.zip
unzip -d ./build/amd64/linux/ ./downloads/linux-x64-static-libssl/ziti-edge-tunnel-Linux_x86_64.zip
unzip -d ./build/arm64/linux/ ./downloads/linux-arm64/ziti-edge-tunnel-Linux_aarch64.zip
unzip -d ./build/amd64/linux/ ./downloads/linux-x64/ziti-edge-tunnel-Linux_x86_64.zip
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ${{ runner.workspace }}/downloads/linux-arm64-static-libssl/ziti-edge-tunnel-Linux_aarch64.zip
asset_path: ${{ runner.workspace }}/downloads/linux-arm64/ziti-edge-tunnel-Linux_aarch64.zip
asset_name: ziti-edge-tunnel-Linux_arm64.zip
asset_content_type: application/octet-stream

Expand Down
25 changes: 1 addition & 24 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,7 @@
"ci-unix",
"vcpkg",
"dev-mode"
],
"cacheVariables": {
"VCPKG_OVERLAY_PORTS": "${sourceDir}/vcpkg-overlays/linux-syslibs/default"
}
]
},
{
"name": "ci-linux-arm64",
Expand All @@ -204,26 +201,6 @@
"VCPKG_CHAINLOAD_TOOLCHAIN_FILE": "${sourceDir}/toolchains/Linux-arm.cmake"
}
},
{
"name": "ci-linux-static-libssl",
"description": "preset to use static ssl libs provided by vcpkg for broad compatibility of GH release binaries",
"cacheVariables": {
"VCPKG_OVERLAY_PORTS": "${sourceDir}/vcpkg-overlays/linux-syslibs/ubuntu18"
},
"hidden": true
},
{
"name": "ci-linux-x64-static-libssl",
"inherits": [ "ci-linux-static-libssl", "ci-linux-x64" ]
},
{
"name": "ci-linux-arm64-static-libssl",
"inherits": [ "ci-linux-static-libssl", "ci-linux-arm64" ]
},
{
"name": "ci-linux-arm-static-libssl",
"inherits": [ "ci-linux-static-libssl", "ci-linux-arm" ]
},
{
"name": "ci-windows-x64",
"inherits": "ci-windows-x64-vs2022"
Expand Down
2 changes: 1 addition & 1 deletion docker/docker.test.bash
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ done
: "${ZITI_ROUTER_PORT:=30224}"
# : "${ZIGGY_UID:=$(id -u)}"

bash -x ./scripts/ziti-builder.sh -p ci-linux-x64-static-libssl
bash -x ./scripts/ziti-builder.sh -p ci-linux-x64
mkdir -p ./build/amd64/linux
cp ./build/programs/ziti-edge-tunnel/Release/ziti-edge-tunnel ./build/amd64/linux/ziti-edge-tunnel

Expand Down

0 comments on commit 16206d8

Please sign in to comment.