Skip to content

Boilerplate; '--no-cpp' #18

Boilerplate; '--no-cpp'

Boilerplate; '--no-cpp' #18

Workflow file for this run

name: CI
on:
push:
branches:
- master
- dev
- boilerplate
- rc1
- rc2
- rc3
- rc4
- rc5
- update
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
BUILD_TYPE: Release
jobs:
cell:
name: CI (${{ matrix.id }})
strategy:
fail-fast: false
matrix:
include:
- id: linux-clang
os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
- id: linux-gcc
os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- id: macos-clang
os: macos-latest
c_compiler: clang
cpp_compiler: clang++
- id: macos-gcc
os: macos-latest
c_compiler: gcc
cpp_compiler: g++
- id: windows-cl
os: windows-latest
c_compiler: cl
cpp_compiler: cl
- id: windows-mingw
os: windows-latest
c_compiler: mingw
cpp_compiler: g++
uses: ./.github/workflows/ci-cell.yml
with:
cell-id: ${{ matrix.id }}
os: ${{ matrix.os }}
c-compiler: ${{ matrix.c_compiler }}
cpp-compiler: ${{ matrix.cpp_compiler }}
build-type: Release
secrets: inherit
install-smoke:
name: Install smoke (${{ matrix.os }}, ${{ matrix.c_compiler }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
- os: macos-latest
c_compiler: clang
cpp_compiler: clang++
- os: windows-latest
c_compiler: cl
cpp_compiler: cl
- os: windows-latest
c_compiler: mingw
cpp_compiler: g++
steps:
- uses: actions/checkout@v4
- name: Install Clang (Ubuntu)
if: runner.os == 'Linux' && matrix.c_compiler == 'clang'
run: sudo apt-get update && sudo apt-get install -y clang
- name: Setup MSYS2 MinGW
if: runner.os == 'Windows' && matrix.c_compiler == 'mingw'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-toolchain
mingw-w64-x86_64-cmake
mingw-w64-x86_64-make
- name: Configure
shell: bash
run: |
set -euo pipefail
if [ "${{ matrix.c_compiler }}" = "cl" ]; then
cmake -B build -S . \
-DCMAKE_DISABLE_FIND_PACKAGE_MFC=TRUE \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF
elif [ "${{ matrix.c_compiler }}" = "mingw" ]; then
export PATH="/mingw64/bin:$PATH"
cmake -B build -G "MinGW Makefiles" \
-DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_CXX_COMPILER=g++ \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF
else
cmake -B build -S . \
-DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" \
-DCMAKE_C_COMPILER="${{ matrix.c_compiler }}" \
-DCMAKE_CXX_COMPILER="${{ matrix.cpp_compiler }}" \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF
fi
- name: Build
shell: bash
run: |
set -euo pipefail
if [ "${{ matrix.c_compiler }}" = "cl" ]; then
cmake --build build --config "${{ env.BUILD_TYPE }}" --parallel
elif [ "${{ matrix.c_compiler }}" = "mingw" ]; then
export PATH="/mingw64/bin:$PATH"
cmake --build build --parallel 2
else
cmake --build build --parallel
fi
- name: Install
shell: bash
run: |
set -euo pipefail
PREFIX="${RUNNER_TEMP}/install-prefix"
echo "INSTALL_PREFIX=$PREFIX" >> "$GITHUB_ENV"
if [ "${{ matrix.c_compiler }}" = "cl" ]; then
cmake --install build --config "${{ env.BUILD_TYPE }}" --prefix "$PREFIX"
else
cmake --install build --prefix "$PREFIX"
fi
- name: Verify install tree
shell: bash
run: |
set -euo pipefail
test -f "${INSTALL_PREFIX}/include/cstring/cstring.h"
test -f "${INSTALL_PREFIX}/lib/cmake/cstring/cstring-config.cmake"
- name: Configure and run install smoke consumer
shell: bash
run: |
set -euo pipefail
CONSUMER="${RUNNER_TEMP}/consumer"
mkdir -p "$CONSUMER"
cat > "$CONSUMER/CMakeLists.txt" <<'EOF'
cmake_minimum_required(VERSION 3.13)
project(cstring_install_smoke C)
find_package(cstring REQUIRED)
add_executable(consumer consumer.c)
target_link_libraries(consumer PRIVATE cstring::core)
EOF
cat > "$CONSUMER/consumer.c" <<'EOF'
#include <cstring/cstring.h>
int main(void) { return 0; }
EOF
if [ "${{ matrix.c_compiler }}" = "cl" ]; then
cmake -S "$CONSUMER" -B consumer-build \
-DCMAKE_PREFIX_PATH="${INSTALL_PREFIX};${{ env.SIS_DEPS }}"
cmake --build consumer-build --config "${{ env.BUILD_TYPE }}" --parallel
consumer-build/${{ env.BUILD_TYPE }}/consumer.exe
elif [ "${{ matrix.c_compiler }}" = "mingw" ]; then
export PATH="/mingw64/bin:$PATH"
cmake -S "$CONSUMER" -B consumer-build -G "MinGW Makefiles" \
-DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" \
-DCMAKE_PREFIX_PATH="${INSTALL_PREFIX}"
cmake --build consumer-build --parallel 2
consumer-build/consumer.exe
else
cmake -S "$CONSUMER" -B consumer-build \
-DCMAKE_BUILD_TYPE="${{ env.BUILD_TYPE }}" \
-DCMAKE_C_COMPILER="${{ matrix.c_compiler }}" \
-DCMAKE_CXX_COMPILER="${{ matrix.cpp_compiler }}" \
-DCMAKE_PREFIX_PATH="${INSTALL_PREFIX}"
cmake --build consumer-build --parallel
consumer-build/consumer
fi
no-cpp:
name: Build with --no-cpp
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies (STLSoft + shwild + xTests)
shell: bash
run: |
set -euo pipefail
DEPS="${RUNNER_TEMP}/sis-deps"
STLSRC="${RUNNER_TEMP}/stlsoft-src"
STLBUILD="${RUNNER_TEMP}/stlsoft-build"
SHWSRC="${RUNNER_TEMP}/shwild-src"
SHWBUILD="${RUNNER_TEMP}/shwild-build"
XTSRC="${RUNNER_TEMP}/xtests-src"
XTBUILD="${RUNNER_TEMP}/xtests-build"
mkdir -p "$DEPS"
git clone --depth 1 https://github.com/synesissoftware/STLSoft "$STLSRC"
cmake -S "$STLSRC" -B "$STLBUILD" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$DEPS" \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF
cmake --build "$STLBUILD" --parallel
cmake --install "$STLBUILD"
git clone --depth 1 https://github.com/synesissoftware/shwild "$SHWSRC"
cmake -S "$SHWSRC" -B "$SHWBUILD" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$DEPS" \
-DCMAKE_PREFIX_PATH="$DEPS" \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF
cmake --build "$SHWBUILD" --parallel
cmake --install "$SHWBUILD"
git clone --depth 1 https://github.com/synesissoftware/xTests "$XTSRC"
cmake -S "$XTSRC" -B "$XTBUILD" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$DEPS" \
-DCMAKE_PREFIX_PATH="$DEPS" \
-DBUILD_EXAMPLES=OFF \
-DBUILD_TESTING=OFF
cmake --build "$XTBUILD" --parallel
cmake --install "$XTBUILD"
echo "SIS_DEPS=$DEPS" >> "$GITHUB_ENV"
- name: Configure and build via prepare_cmake.sh --no-cpp
shell: bash
run: |
set -euo pipefail
# Prefer CMAKE_PREFIX_PATH (find_package) over prepare_cmake -s /
# -DSTLSOFT: xTests::core links STLSoft::STLSoft, which only exists
# when the STLSoft CMake package is imported.
export CMAKE_PREFIX_PATH="${{ env.SIS_DEPS }}"
./prepare_cmake.sh --no-cpp -m
- name: Run unit tests
shell: bash
run: |
set -euo pipefail
SIS_CMAKE_BUILD_DIR="${{ github.workspace }}/_build" ./run_all_unit_tests.sh -M --unit-only