Skip to content

Commit

Permalink
Test with multiple Ubuntu versions
Browse files Browse the repository at this point in the history
  • Loading branch information
ekilmer committed Jan 8, 2024
1 parent c730109 commit 515d350
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 17 deletions.
30 changes: 23 additions & 7 deletions .github/workflows/vcpkg_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ concurrency:

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

jobs:
build:
Expand All @@ -34,6 +37,11 @@ jobs:
platform:
- linux/amd64
- linux/arm64
ubuntu_version:
- 22.04
- 24.04
env:
REGISTRY_IMAGE: ${{ env.REGISTRY_IMAGE_ROOT }}-${{ matrix.ubuntu_version }}
steps:
- name: Prepare
run: |
Expand Down Expand Up @@ -71,17 +79,17 @@ jobs:
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true
-
name: Export digest

- name: Export digest
run: |
mkdir -p /tmp/digests
digest="${{ steps.build.outputs.digest }}"
touch "/tmp/digests/${digest#sha256:}"
-
name: Upload digest
- name: Upload digest
uses: actions/upload-artifact@v4
with:
name: digests-${{ env.PLATFORM_PAIR }}
name: digests-${{ matrix.ubuntu_version }}-${{ env.PLATFORM_PAIR }}
path: /tmp/digests/*
if-no-files-found: error
retention-days: 1
Expand All @@ -90,12 +98,20 @@ jobs:
runs-on: ubuntu-latest
needs:
- build
strategy:
fail-fast: false
matrix:
ubuntu_version:
- 22.04
- 24.04
env:
REGISTRY_IMAGE: ${{ env.REGISTRY_IMAGE_ROOT }}-${{ matrix.ubuntu_version }}
steps:
- name: Download digests
uses: actions/download-artifact@v4
with:
path: /tmp/digests
pattern: digests-*
pattern: digests-${{ matrix.ubuntu_version }}-*
merge-multiple: true

- name: Set up Docker Buildx
Expand Down
14 changes: 8 additions & 6 deletions docker/Dockerfile.ubuntu.vcpkg
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ ARG UBUNTU_VERSION=22.04
ARG LLVM_VERSION=16

FROM ubuntu:${UBUNTU_VERSION} as base
ARG UBUNTU_VERSION
ARG LLVM_VERSION

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

# Much heavier installation due to mono dependency for NuGet
FROM base as caching
ARG DISTRO_VERSION
RUN export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install --yes mono-devel && \
Expand Down
8 changes: 4 additions & 4 deletions docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ set -euo pipefail
# build vcpkg libraries as well as all lifting-bits tools

# Ubuntu versions to build
UBUNTU_VERSION_MATRIX=( "22.04" )
UBUNTU_VERSION_MATRIX=( "22.04" "24.04" )

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

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

# Build
docker build \
-f Dockerfile.ubuntu.vcpkg \
--no-cache \
--build-arg "DISTRO_VERSION=${version}" \
-t "${tag}" \
--build-arg "UBUNTU_VERSION=${version}" \
-t "${image}" \
.
done

0 comments on commit 515d350

Please sign in to comment.