diff --git a/.github/docker_images/cmake_build_versions/Dockerfile b/.github/docker_images/cmake_build_versions/Dockerfile new file mode 100644 index 0000000000..3315c6e154 --- /dev/null +++ b/.github/docker_images/cmake_build_versions/Dockerfile @@ -0,0 +1,33 @@ +# 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 awslc_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 + +WORKDIR / + +ENTRYPOINT ["/entry.sh"] diff --git a/.github/docker_images/cmake_build_versions/awslc_build.sh b/.github/docker_images/cmake_build_versions/awslc_build.sh new file mode 100755 index 0000000000..de9145d785 --- /dev/null +++ b/.github/docker_images/cmake_build_versions/awslc_build.sh @@ -0,0 +1,25 @@ +#!/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)" + +BUILD_DIR=$(mktemp -d) +SRC_DIR="${SRC_DIR:-/awslc}" +CMAKE_CONFIGURE_ARGS=("${argv[@]}") + +pushd "${BUILD_DIR}" + +cmake "${SRC_DIR}" "${CMAKE_CONFIGURE_ARGS[@]}" +cmake --build . + +"${BUILD_DIR}/crypto/crypto_test" + +if [[ -a "${BUILD_DIR}/ssl/ssl_test" ]]; then + "${BUILD_DIR}/ssl/ssl_test" +fi + +popd # ${BUILD_DIR} diff --git a/.github/docker_images/cmake_build_versions/cmake_build.sh b/.github/docker_images/cmake_build_versions/cmake_build.sh new file mode 100755 index 0000000000..6db53347ca --- /dev/null +++ b/.github/docker_images/cmake_build_versions/cmake_build.sh @@ -0,0 +1,14 @@ +#!/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}" + +# 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 +make install diff --git a/.github/docker_images/cmake_build_versions/entry.sh b/.github/docker_images/cmake_build_versions/entry.sh new file mode 100755 index 0000000000..10e6b32204 --- /dev/null +++ b/.github/docker_images/cmake_build_versions/entry.sh @@ -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}" + +/awslc_build.sh "${argv[@]}" diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml new file mode 100644 index 0000000000..4f5acf1497 --- /dev/null +++ b/.github/workflows/cmake.yml @@ -0,0 +1,40 @@ +name: AWS-LC CMake Compatability +on: + pull_request: + branches: [ '*' ] + push: + branches: [ '*' ] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true +env: + DOCKER_BUILDKIT: 1 + GOPROXY: https://proxy.golang.org,direct +jobs: + cmake: + name: CMake Version Build + strategy: + matrix: + cmake: + - { version: "3.2", url: "https://cmake.org/files/v3.2/cmake-3.2.3.tar.gz", hash: "a1ebcaf6d288eb4c966714ea457e3b9677cdfde78820d0f088712d7320850297" } + - { version: "3.28", url: "https://cmake.org/files/v3.28/cmake-3.28.1.tar.gz", hash: "15e94f83e647f7d620a140a7a5da76349fc47a1bfed66d0f5cdee8e7344079ad" } + generator: + - "Unix Makefiles" + - "Ninja" + fips: + - 0 + - 1 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - 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: ${{ matrix.generator }} (Static) + run: | + docker run -v "${{ github.workspace }}:/awslc" "cmake-${{ matrix.cmake.version }}" -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=0 -DFIPS=${{ matrix.fips }} + - name: ${{ matrix.generator }} (Shared) + run: | + docker run -v "${{ github.workspace }}:/awslc" "cmake-${{ matrix.cmake.version }}" -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=1 -DFIPS=${{ matrix.fips }}