Skip to content

Commit

Permalink
Add CMake GitHub Actions CI (#1367)
Browse files Browse the repository at this point in the history
  • Loading branch information
skmcgrail authored Jan 9, 2024
1 parent da4fdaa commit 7dc34d3
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/docker_images/cmake_build_versions/Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
25 changes: 25 additions & 0 deletions .github/docker_images/cmake_build_versions/awslc_build.sh
Original file line number Diff line number Diff line change
@@ -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}
14 changes: 14 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,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
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}"

/awslc_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: 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 }}

0 comments on commit 7dc34d3

Please sign in to comment.