diff --git a/.github/workflows/vcpkg_docker.yml b/.github/workflows/vcpkg_docker.yml index 7a157f2b..53fe39ab 100644 --- a/.github/workflows/vcpkg_docker.yml +++ b/.github/workflows/vcpkg_docker.yml @@ -23,22 +23,31 @@ 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: "" jobs: build: runs-on: ubuntu-latest + env: + # This needs to be the same as in the `merge` job + REGISTRY_IMAGE: ghcr.io/lifting-bits/cxx-common/vcpkg-builder-ubuntu-${{ matrix.ubuntu_version }} strategy: fail-fast: false matrix: platform: - linux/amd64 - linux/arm64 + ubuntu_version: + - 22.04 + - 24.04 steps: - name: Prepare run: | - platform=${{ matrix.platform }} - echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV + platform="${{ matrix.platform }}" + echo "PLATFORM_PAIR=${platform//\//-}" >> "${GITHUB_ENV}" - name: Checkout uses: actions/checkout@v4 @@ -71,17 +80,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 @@ -90,12 +99,21 @@ jobs: runs-on: ubuntu-latest needs: - build + env: + # This needs to be the same as in the `build` job + REGISTRY_IMAGE: ghcr.io/lifting-bits/cxx-common/vcpkg-builder-ubuntu-${{ matrix.ubuntu_version }} + strategy: + fail-fast: false + matrix: + ubuntu_version: + - 22.04 + - 24.04 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 @@ -117,8 +135,8 @@ jobs: - name: Create manifest list and push working-directory: /tmp/digests run: | - docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ - $(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *) + docker buildx imagetools create "$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON")" \ + "$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)" - name: Inspect image run: | diff --git a/docker/Dockerfile.ubuntu.vcpkg b/docker/Dockerfile.ubuntu.vcpkg index 08e63ffd..2c406b74 100644 --- a/docker/Dockerfile.ubuntu.vcpkg +++ b/docker/Dockerfile.ubuntu.vcpkg @@ -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 @@ -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 \ @@ -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 && \ diff --git a/docker/build.sh b/docker/build.sh index a0c59e03..e0dab0ca 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -6,7 +6,7 @@ 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 @@ -14,13 +14,13 @@ for version in "${UBUNTU_VERSION_MATRIX[@]}"; do # 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