Skip to content

Commit

Permalink
chore: modernize repo versions and dependencies (#422)
Browse files Browse the repository at this point in the history
  • Loading branch information
scotthart authored Nov 4, 2024
1 parent 1a595cc commit 2e3d900
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 41 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:

env:
vcpkg_SHA: "2023.06.20"
vcpkg_SHA: "2024.09.30"

jobs:
build-ubuntu-focal:
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
run: cmake --build "${{runner.temp}}/build"
- name: test
working-directory: "${{runner.temp}}/build"
run: ctest --output-on-failure --timeout=60s
run: ctest --output-on-failure --timeout 60

# Verify the howto guides compile correctly, they need a special setup to use the
# current version of `functions-framework-cpp` through vcpkg.
Expand Down Expand Up @@ -150,7 +150,7 @@ jobs:
run: cmake --build "${{runner.temp}}/build"
- name: test
working-directory: "${{runner.temp}}/build"
run: ctest --output-on-failure --timeout=60s
run: ctest --output-on-failure --timeout 60

build-macos:
if: ${{ false }} # TODO(#367) - disable for now
Expand Down Expand Up @@ -197,4 +197,4 @@ jobs:
run: cmake --build "${{runner.temp}}/build"
- name: test
working-directory: "${{runner.temp}}/build"
run: ctest --output-on-failure --timeout=60s
run: ctest --output-on-failure --timeout 60
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:

env:
vcpkg_SHA: "2023.06.20"
vcpkg_SHA: "2024.09.30"

jobs:
coverage:
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
run: cmake --build ${{runner.workspace}}/build
- name: test
working-directory: ${{runner.workspace}}/build
run: ctest --output-on-failure --timeout=60s
run: ctest --output-on-failure --timeout 60

- name: Setup Go
uses: actions/setup-go@v5
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:

env:
vcpkg_SHA: "2023.06.20"
vcpkg_SHA: "2024.09.30"

jobs:
clang-format:
Expand Down
24 changes: 15 additions & 9 deletions build_scripts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

FROM gcr.io/gcp-runtimes/ubuntu_18_0_4 AS parent
FROM gcr.io/gcp-runtimes/ubuntu_20_0_4 AS parent

ARG cnb_uid=1000
ARG cnb_gid=1000
Expand All @@ -21,18 +21,18 @@ ARG stack_id="google"
# Required by python/runtime.
RUN apt-get update && apt-get install -y --no-install-recommends \
libexpat1 \
libffi6 \
libffi7 \
libmpdec2 \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# Required by dotnet/runtime.
RUN apt-get update && apt-get install -y --no-install-recommends \
libicu60 \
libicu66 \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# Required by cpp/runtime.
RUN apt-get update \
&& apt-get install -y libc++1-9 \
&& apt-get install -y libc++1-10 libc++abi1-10 \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

LABEL io.buildpacks.stack.id=${stack_id}
Expand All @@ -53,10 +53,8 @@ USER cnb
FROM parent AS gcf-cpp-incremental-0
RUN apt-get update \
&& apt install -y --no-install-recommends \
build-essential g++-8 gcc-8 git libstdc++-8-dev pkg-config python3 tar unzip zip \
build-essential git pkg-config python3 tar unzip zip \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 100 \
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 100

# Install cmake, ninja and vcpkg. The first two are build systems for C++, the
# latter is the package manager we use. In an open source builder these would
Expand All @@ -65,15 +63,20 @@ RUN update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 100 \
FROM gcf-cpp-incremental-0 AS gcf-cpp-incremental-1

WORKDIR /usr/local
RUN curl -sSL https://github.com/Kitware/CMake/releases/download/v3.19.4/cmake-3.19.4-Linux-x86_64.tar.gz | \
# Depending on the version of vcpkg, vcpkg may or may not prefer newer versions
# of cmake and will try to download it for every build_example. Instead, make
# sure we have already installed a suitable version of cmake.
RUN curl -sSL https://github.com/Kitware/CMake/releases/download/v3.29.8/cmake-3.29.8-Linux-x86_64.tar.gz | \
tar -xzf - --strip-components=1

RUN curl -sSL https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-linux.zip | \
funzip >/usr/local/bin/ninja && \
chmod 755 /usr/local/bin/ninja

WORKDIR /usr/local/vcpkg
RUN curl -sSL https://github.com/Microsoft/vcpkg/archive/2023.06.20.tar.gz | \
# This version of vcpkg should match the version in ci/pack/buildpack/bin/build
# otherwise the contents of the vcpkg cache may not be used.
RUN curl -sSL https://github.com/Microsoft/vcpkg/archive/2024.09.30.tar.gz | \
tar -xzf - --strip-components=1 && \
./bootstrap-vcpkg.sh -disableMetrics -useSystemBinaries && \
rm -fr toolsrc/build.rel downloads/*
Expand Down Expand Up @@ -141,6 +144,9 @@ FROM gcf-cpp-incremental-2 AS gcf-cpp-ci-0
COPY . /usr/local/share/gcf
RUN find /usr/local/share/gcf -type f | xargs chmod 644
RUN find /usr/local/share/gcf -type d | xargs chmod 755
# More recent versions of cmake error when attempting to run `configure_file` on
# files owned by root. Changing the owner to user cnb fixes this.
RUN chown -R cnb:cnb /usr/local/share/gcf
RUN VCPKG_OVERLAY_PORTS=/usr/local/share/gcf/build_scripts/vcpkg-overlays \
/usr/local/vcpkg/vcpkg install --feature-flags=-manifests --triplet x64-linux-nodebug functions-framework-cpp

Expand Down
10 changes: 6 additions & 4 deletions build_scripts/vcpkg-overlays/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
set(SOURCE_PATH "/usr/local/share/gcf")
vcpkg_configure_cmake(SOURCE_PATH ${SOURCE_PATH} PREFER_NINJA
DISABLE_PARALLEL_CONFIGURE OPTIONS -DBUILD_TESTING=OFF)

vcpkg_install_cmake(ADD_BIN_TO_PATH)
vcpkg_cmake_configure(SOURCE_PATH ${SOURCE_PATH} DISABLE_PARALLEL_CONFIGURE
OPTIONS -DBUILD_TESTING=OFF)
vcpkg_cmake_install(ADD_BIN_TO_PATH)

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# vcpkg_fixup_cmake_targets is marked as deprecated and vcpkg_cmake_config_fixup
# is listed as its replacement. However, for our purposes, it is not a drop in
# replacement and additional work needs to be done if we are to switch.
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake TARGET_PATH share)

file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
Expand Down
12 changes: 10 additions & 2 deletions build_scripts/vcpkg-overlays/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
{
"name": "functions-framework-cpp",
"version-string": "0.6.0",
"version-string": "1.2.0",
"homepage": "https://github.com/GoogleCloudPlatform/functions-framework-cpp/",
"description": "Functions Framework for C++.",
"dependencies": [
"abseil",
"boost-beast",
"boost-program-options",
"boost-serialization",
"nlohmann-json"
"nlohmann-json",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
14 changes: 12 additions & 2 deletions ci/build-examples.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# WARNING: DO NOT EDIT THIS FILE
# This file is automatically generated by ci/generate-build-examples.sh
timeout: 3600s
timeout: 7200s
options:
machineType: 'N1_HIGHCPU_32'
diskSizeGb: '512'
Expand All @@ -15,6 +15,7 @@ steps:

# Create the docker images for the buildpacks builder.
- name: 'gcr.io/kaniko-project/executor:v1.12.0'
id: 'create run-image'
args: [
"--context=dir:///workspace/",
"--dockerfile=build_scripts/Dockerfile",
Expand All @@ -26,9 +27,11 @@ steps:
waitFor: ['-']
timeout: 1800s
- name: 'gcr.io/cloud-builders/docker'
id: 'pull run-image'
args: ['pull', 'gcr.io/${PROJECT_ID}/ci/run-image:${BUILD_ID}']

- name: 'gcr.io/kaniko-project/executor:v1.12.0'
id: 'create build-image'
args: [
"--context=dir:///workspace/",
"--dockerfile=build_scripts/Dockerfile",
Expand All @@ -38,20 +41,25 @@ steps:
"--destination=gcr.io/${PROJECT_ID}/ci/build-image:${BUILD_ID}",
]
waitFor: ['-']
timeout: 1800s
timeout: 3600s
- name: 'gcr.io/cloud-builders/docker'
id: 'pull build-image'
args: ['pull', 'gcr.io/${PROJECT_ID}/ci/build-image:${BUILD_ID}']

# Setup local names for the builder images.
- name: 'gcr.io/cloud-builders/docker'
id: 'tag build-image'
args: ['tag', 'gcr.io/${PROJECT_ID}/ci/build-image:${BUILD_ID}', 'ci-build-image:latest']
- name: 'gcr.io/cloud-builders/docker'
id: 'tag run-image'
args: ['tag', 'gcr.io/${PROJECT_ID}/ci/run-image:${BUILD_ID}', 'ci-run-image:latest']

# Create the buildpacks builder, and make it the default.
- name: 'pack'
id: 'create builder'
args: ['builder', 'create', 'gcf-cpp-builder:bionic', '--config', 'ci/pack/builder.toml', ]
- name: 'pack'
id: 'set builder as trusted'
args: ['config', 'trusted-builders', 'add', 'gcf-cpp-builder:bionic', ]
- name: 'pack'
args: ['config', 'default-builder', 'gcf-cpp-builder:bionic', ]
Expand Down Expand Up @@ -417,6 +425,7 @@ steps:
# Remove the images created by this build.
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
allowFailure: true
id: 'delete images from this build'
entrypoint: 'bash'
args:
- '-c'
Expand All @@ -432,6 +441,7 @@ steps:
# build does.
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
allowFailure: true
id: 'garbage collect old images'
waitFor: ['-']
entrypoint: 'bash'
args:
Expand Down
2 changes: 1 addition & 1 deletion ci/etc/vcpkg-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ fi # include guard
#
# Common configuration parameters.
#
export VCPKG_RELEASE_VERSION="2023.06.20"
export VCPKG_RELEASE_VERSION="2024.09.30"
14 changes: 12 additions & 2 deletions ci/generate-build-examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set -eu
cat <<'_EOF_'
# WARNING: DO NOT EDIT THIS FILE
# This file is automatically generated by ci/generate-build-examples.sh
timeout: 3600s
timeout: 7200s
options:
machineType: 'N1_HIGHCPU_32'
diskSizeGb: '512'
Expand All @@ -33,6 +33,7 @@ steps:
# Create the docker images for the buildpacks builder.
- name: 'gcr.io/kaniko-project/executor:v1.12.0'
id: 'create run-image'
args: [
"--context=dir:///workspace/",
"--dockerfile=build_scripts/Dockerfile",
Expand All @@ -44,9 +45,11 @@ steps:
waitFor: ['-']
timeout: 1800s
- name: 'gcr.io/cloud-builders/docker'
id: 'pull run-image'
args: ['pull', 'gcr.io/${PROJECT_ID}/ci/run-image:${BUILD_ID}']
- name: 'gcr.io/kaniko-project/executor:v1.12.0'
id: 'create build-image'
args: [
"--context=dir:///workspace/",
"--dockerfile=build_scripts/Dockerfile",
Expand All @@ -56,20 +59,25 @@ steps:
"--destination=gcr.io/${PROJECT_ID}/ci/build-image:${BUILD_ID}",
]
waitFor: ['-']
timeout: 1800s
timeout: 3600s
- name: 'gcr.io/cloud-builders/docker'
id: 'pull build-image'
args: ['pull', 'gcr.io/${PROJECT_ID}/ci/build-image:${BUILD_ID}']
# Setup local names for the builder images.
- name: 'gcr.io/cloud-builders/docker'
id: 'tag build-image'
args: ['tag', 'gcr.io/${PROJECT_ID}/ci/build-image:${BUILD_ID}', 'ci-build-image:latest']
- name: 'gcr.io/cloud-builders/docker'
id: 'tag run-image'
args: ['tag', 'gcr.io/${PROJECT_ID}/ci/run-image:${BUILD_ID}', 'ci-run-image:latest']
# Create the buildpacks builder, and make it the default.
- name: 'pack'
id: 'create builder'
args: ['builder', 'create', 'gcf-cpp-builder:bionic', '--config', 'ci/pack/builder.toml', ]
- name: 'pack'
id: 'set builder as trusted'
args: ['config', 'trusted-builders', 'add', 'gcf-cpp-builder:bionic', ]
- name: 'pack'
args: ['config', 'default-builder', 'gcf-cpp-builder:bionic', ]
Expand Down Expand Up @@ -213,6 +221,7 @@ cat <<_EOF_
# Remove the images created by this build.
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
allowFailure: true
id: 'delete images from this build'
entrypoint: 'bash'
args:
- '-c'
Expand All @@ -228,6 +237,7 @@ cat <<_EOF_
# build does.
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk'
allowFailure: true
id: 'garbage collect old images'
waitFor: ['-']
entrypoint: 'bash'
args:
Expand Down
Loading

0 comments on commit 2e3d900

Please sign in to comment.