Skip to content

Commit

Permalink
Test several versions of CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Mar 6, 2025
1 parent f4f8e23 commit 6996e1a
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/docker_images/cmake_build_versions/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0 OR ISC

FROM amazonlinux:2023

ARG CMAKE_VERSION
ARG CMAKE_DOWNLOAD_URL
ARG CMAKE_SHA256

VOLUME ["/awslc"]

RUN dnf install -y tar ninja-build golang gcc gcc-c++ libcurl-devel libarchive-devel zlib-devel xz-devel

RUN mkdir /cmake

COPY cmake_build.sh /
COPY aws_lc_rs_build.sh /
COPY entry.sh /

WORKDIR /cmake

RUN curl -L -o source.tar.gz "${CMAKE_DOWNLOAD_URL}" && \
echo "${CMAKE_SHA256} source.tar.gz" | sha256sum -c - && \
mkdir source && \
tar -x -f source.tar.gz -v --strip-components=1 -C source

WORKDIR /cmake/source

RUN /cmake_build.sh

RUN useradd -m docker
USER docker
RUN cd "${HOME}" && \
git config --global --add safe.directory '*' && \
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > ./rustup.sh && \
chmod +x ./rustup.sh && \
./rustup.sh -y && \
. "${HOME}/.cargo/env" && \
cargo install --locked bindgen-cli && \
rustup component add rustfmt clippy && \
rm ./rustup.sh

ENV AWS_LC_SYS_CMAKE_BUILDER=1

ENTRYPOINT ["/entry.sh"]
26 changes: 26 additions & 0 deletions .github/docker_images/cmake_build_versions/aws_lc_rs_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0 OR ISC

set -ex -o pipefail

echo "Building with CMake Version: $(cmake --version)"

. "${HOME}/.cargo/env"
SRC_DIR="${SRC_DIR:-/aws_lc_rs}"

sudo chown "$USER":"$USER" "${SRC_DIR}" -R

pushd "${SRC_DIR}"
cargo clean
cargo test -p aws-lc-rs --features=unstable
cargo clean
cargo test -p aws-lc-rs --features=unstable,fips
cargo clean
cargo test -p aws-lc-rs --release --features=unstable
cargo clean
cargo test -p aws-lc-rs --release --features=unstable,fips


popd # ${BUILD_DIR}
16 changes: 16 additions & 0 deletions .github/docker_images/cmake_build_versions/cmake_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0 OR ISC

set -ex -o pipefail

echo "Building CMake Version: ${CMAKE_VERSION:-unknown}"

NUM_CPU_THREADS=$(grep -c ^processor /proc/cpuinfo)

# At the moment this works fine for all versions, in the future build logic can be modified to
# look at it ${CMAKE_VERSION}.
./configure --prefix=/opt/cmake --system-curl --system-libarchive
make -j"${NUM_CPU_THREADS}"
make install
10 changes: 10 additions & 0 deletions .github/docker_images/cmake_build_versions/entry.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash

# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: Apache-2.0 OR ISC

set -ex -o pipefail

export PATH="/opt/cmake/bin:${PATH}"

/aws_lc_rs_build.sh "${argv[@]}"
40 changes: 40 additions & 0 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CMake Compatability
on:
push:
branches: [ '*' ]
pull_request:
branches: [ '*' ]
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
env:
DOCKER_BUILDKIT: 1
GOPROXY: https://proxy.golang.org,direct
jobs:
cmake:
if: github.repository_owner == 'aws'
name: CMake ${{ matrix.cmake.version}} build with ${{ matrix.generator}}
strategy:
fail-fast: false
matrix:
cmake:
- { version: "3.5", url: "https://cmake.org/files/v3.5/cmake-3.5.0.tar.gz", hash: "92c83ad8a4fd6224cf6319a60b399854f55b38ebe9d297c942408b792b1a9efa" }
- { version: "3.28", url: "https://cmake.org/files/v3.28/cmake-3.28.1.tar.gz", hash: "15e94f83e647f7d620a140a7a5da76349fc47a1bfed66d0f5cdee8e7344079ad" }
- { version: "4.0", url: "https://cmake.org/files/v4.0/cmake-4.0.0-rc3.tar.gz", hash: "d1ae66637fb083efde5c12b45a76ab9bcd419970979c93b14a0d0d21eb8c6c08" }
runs-on: ubuntu-latest
env:
DOCKER_BUILDKIT: 1
steps:
- uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Build Docker Image
working-directory: .github/docker_images/cmake_build_versions
run: |
docker build -t "cmake-${{ matrix.cmake.version }}" --build-arg CMAKE_VERSION=${{ matrix.cmake.version }} --build-arg CMAKE_DOWNLOAD_URL=${{ matrix.cmake.url }} --build-arg CMAKE_SHA256=${{ matrix.cmake.hash }} .
- name: Test - Debug
run: |
docker run -v "${{ github.workspace }}:/aws_lc_rs" "cmake-${{ matrix.cmake.version }}"
- name: Test - Release
run: |
docker run -v "${{ github.workspace }}:/aws_lc_rs" "cmake-${{ matrix.cmake.version }}"

0 comments on commit 6996e1a

Please sign in to comment.