Skip to content

Commit 732c336

Browse files
committed
Test with multiple Ubuntu versions
1 parent c730109 commit 732c336

File tree

3 files changed

+41
-21
lines changed

3 files changed

+41
-21
lines changed

.github/workflows/vcpkg_docker.yml

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,31 @@ concurrency:
2323

2424
env:
2525
# Also remember to change the 'docker/build.sh' script
26-
REGISTRY_IMAGE: "ghcr.io/lifting-bits/cxx-common/vcpkg-builder-ubuntu-22.04-v2"
26+
# NOTE: Setting the environment variable here isn't ideal because we
27+
# can't use any matrix variables here, and in the future we will probably
28+
# want to support building multiple Ubuntu versions
29+
REGISTRY_IMAGE_ROOT: ""
2730

2831
jobs:
2932
build:
3033
runs-on: ubuntu-latest
34+
env:
35+
# This needs to be the same as in the `merge` job
36+
REGISTRY_IMAGE: ghcr.io/lifting-bits/cxx-common/vcpkg-builder-ubuntu-${{ matrix.ubuntu_version }}
3137
strategy:
3238
fail-fast: false
3339
matrix:
3440
platform:
3541
- linux/amd64
3642
- linux/arm64
43+
ubuntu_version:
44+
- 22.04
45+
- 24.04
3746
steps:
3847
- name: Prepare
3948
run: |
40-
platform=${{ matrix.platform }}
41-
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
49+
platform="${{ matrix.platform }}"
50+
echo "PLATFORM_PAIR=${platform//\//-}" >> "${GITHUB_ENV}"
4251
4352
- name: Checkout
4453
uses: actions/checkout@v4
@@ -71,17 +80,17 @@ jobs:
7180
platforms: ${{ matrix.platform }}
7281
labels: ${{ steps.meta.outputs.labels }}
7382
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
74-
-
75-
name: Export digest
83+
84+
- name: Export digest
7685
run: |
7786
mkdir -p /tmp/digests
7887
digest="${{ steps.build.outputs.digest }}"
7988
touch "/tmp/digests/${digest#sha256:}"
80-
-
81-
name: Upload digest
89+
90+
- name: Upload digest
8291
uses: actions/upload-artifact@v4
8392
with:
84-
name: digests-${{ env.PLATFORM_PAIR }}
93+
name: digests-${{ matrix.ubuntu_version }}-${{ env.PLATFORM_PAIR }}
8594
path: /tmp/digests/*
8695
if-no-files-found: error
8796
retention-days: 1
@@ -90,12 +99,21 @@ jobs:
9099
runs-on: ubuntu-latest
91100
needs:
92101
- build
102+
env:
103+
# This needs to be the same as in the `build` job
104+
REGISTRY_IMAGE: ghcr.io/lifting-bits/cxx-common/vcpkg-builder-ubuntu-${{ matrix.ubuntu_version }}
105+
strategy:
106+
fail-fast: false
107+
matrix:
108+
ubuntu_version:
109+
- 22.04
110+
- 24.04
93111
steps:
94112
- name: Download digests
95113
uses: actions/download-artifact@v4
96114
with:
97115
path: /tmp/digests
98-
pattern: digests-*
116+
pattern: digests-${{ matrix.ubuntu_version }}-*
99117
merge-multiple: true
100118

101119
- name: Set up Docker Buildx
@@ -117,8 +135,8 @@ jobs:
117135
- name: Create manifest list and push
118136
working-directory: /tmp/digests
119137
run: |
120-
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
121-
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
138+
docker buildx imagetools create "$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON")" \
139+
"$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)"
122140
123141
- name: Inspect image
124142
run: |

docker/Dockerfile.ubuntu.vcpkg

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ ARG UBUNTU_VERSION=22.04
22
ARG LLVM_VERSION=16
33

44
FROM ubuntu:${UBUNTU_VERSION} as base
5+
ARG UBUNTU_VERSION
56
ARG LLVM_VERSION
67

78
# All build dependencies for vcpkg packages
@@ -13,16 +14,18 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
1314
apt-get update && apt-get install --yes apt-utils && apt-get upgrade --yes && \
1415
apt-get install --yes --no-install-recommends apt-transport-https software-properties-common gnupg ca-certificates wget && \
1516
apt-add-repository ppa:git-core/ppa --yes && \
16-
wget "https://github.com/Kitware/CMake/releases/download/v3.22.1/cmake-3.22.1-linux-$(uname -m).sh" && \
17+
wget "https://github.com/Kitware/CMake/releases/download/v3.28.1/cmake-3.28.1-linux-$(uname -m).sh" && \
1718
/bin/bash cmake-*.sh --skip-license --prefix=/usr/local && rm cmake-*.sh && \
1819
\
19-
wget https://apt.llvm.org/llvm.sh && \
20-
chmod +x llvm.sh && \
21-
./llvm.sh ${LLVM_VERSION} clang lld && \
20+
if [ "${UBUNTU_VERSION}" != "24.04" ] ; then \
21+
wget https://apt.llvm.org/llvm.sh && \
22+
chmod +x llvm.sh && \
23+
./llvm.sh ${LLVM_VERSION} clang lld ; \
24+
fi && \
2225
\
2326
apt-get update && apt-get upgrade --yes && \
2427
apt-get install --yes --no-install-recommends \
25-
libtinfo-dev libzstd-dev python3-pip python3-setuptools python-setuptools \
28+
libtinfo-dev libzstd-dev python3-pip python3-setuptools \
2629
build-essential binutils-multiarch g++ gcc clang lld clang-${LLVM_VERSION} lld-${LLVM_VERSION} ninja-build \
2730
pixz xz-utils make rpm curl unzip tar git zip python3 pkg-config && \
2831
apt-get install --yes --no-install-recommends \
@@ -41,7 +44,6 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
4144

4245
# Much heavier installation due to mono dependency for NuGet
4346
FROM base as caching
44-
ARG DISTRO_VERSION
4547
RUN export DEBIAN_FRONTEND=noninteractive && \
4648
apt-get update && \
4749
apt-get install --yes mono-devel && \

docker/build.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ set -euo pipefail
66
# build vcpkg libraries as well as all lifting-bits tools
77

88
# Ubuntu versions to build
9-
UBUNTU_VERSION_MATRIX=( "22.04" )
9+
UBUNTU_VERSION_MATRIX=( "22.04" "24.04" )
1010

1111
for version in "${UBUNTU_VERSION_MATRIX[@]}"; do
1212
# Always pull from upstream
1313
docker pull "ubuntu:${version}"
1414

1515
# Also remember to change the '.github/workflows/vcpkg_docker.yml' variable
1616
# Image identification
17-
tag="vcpkg-builder-ubuntu-${version}-v2"
17+
image="vcpkg-builder-ubuntu-${version}"
1818

1919
# Build
2020
docker build \
2121
-f Dockerfile.ubuntu.vcpkg \
2222
--no-cache \
23-
--build-arg "DISTRO_VERSION=${version}" \
24-
-t "${tag}" \
23+
--build-arg "UBUNTU_VERSION=${version}" \
24+
-t "${image}" \
2525
.
2626
done

0 commit comments

Comments
 (0)