xo-umbrella2/.forgejo/workflows/ci-cmake.yaml.j2
Roland Conybeare f2c7415463
Some checks failed
cmake-docker / cmake-build (clang, clang++) (push) Successful in 51m38s
cmake-docker / cmake-build (gcc, g++) (push) Has been cancelled
CI / smoke-test (push) Failing after 34m20s
github forjejo: ci facepalm [BUGFIX]
2026-10-03 13:46:23 -04:00

115 lines
3.6 KiB
Django/Jinja

name: cmake-docker
# - Verifies a plain (non-nix) cmake build works inside docker-xo-builder.
# Links:
# - org-howto/articles/2026/06/forgejo/docker-container-registry.org
# - xo-umbrella2/pkgs/docker-xo-builder.nix
on:
push:
branches: [main]
paths-ignore:
- '**.nix'
- '**.md'
jobs:
cmake-build:
runs-on: xo-builder
strategy:
fail-fast: false # a failure in one compiler must not cancel the other
max-parallel: 1 # run gcc, then clang -- never both at once (8GB host)
matrix:
include:
- { cc: gcc, cxx: g++ }
- { cc: clang, cxx: clang++ }
env:
CC: ${{matrix.cc}}
CXX: ${{matrix.cxx}}
PREFIX: ${{github.workspace}}/local-${{matrix.cc}}
steps:
- name: set PATH
run: |
echo "$PREFIX/bin" >> $GITHUB_PATH
- name: compiler
run: |
# print canonical choices
for c in c++ g++ clang++; do
p="$(command -v "$c" 2>/dev/null || true)"
printf '%-8s %s\n' "$c" "${p:+$(readlink -f "$p")}"
done
# cmake will use CXX, default to c++
choice=$(${CXX:-c++} --version | head -1)
echo "build with: ${choice}"
- name: pkgconfig
run: |
# list packages known to pkg-config
pkg-config --list-all
- name: dirs
run: |
tree -L 1 /include
ls /lib
- name: checkout
run: |
echo PATH=${PATH}
# the run's own commit, $GITHUB_SHA -- NOT a plain clone, which takes
# whatever main is when the job STARTS: with runs queued, a result
# then describes a later commit than the one it is labelled with
# (.xo-backlog/ci/issues/02).
# the workspace is owned by another user than this job's (the
# container's): without this, git refuses to work in it ("dubious
# ownership") once init has made it a repository
git config --global --add safe.directory "$PWD"
git init --quiet .
git remote add origin $GITHUB_SERVER_URL/roland/xo-umbrella2.git
git fetch --quiet --depth=1 origin "$GITHUB_SHA"
git checkout --quiet FETCH_HEAD
echo "checked out $(git rev-parse HEAD)"
mkdir -p "$PREFIX"
- name: bootstrap xo-cmake
run: |
echo "::group::xo-cmake configure"
cmake -S xo-cmake -B .build/xo-cmake -DCMAKE_INSTALL_PREFIX=$PREFIX
echo "::endgroup::"
echo "::group::xo-cmake build (no-op)"
cmake --build .build/xo-cmake
echo "::endgroup::"
echo "::group::xo-cmake install"
cmake --install .build/xo-cmake
echo "::endgroup::"
# ---- GENERATED from [[ template_name ]] by xo-gen-ci ----
# Do not edit these steps by hand. Membership and order come from
# [[ subsystem_list ]]; regenerate with:
# cmake --build .build --target xo-gen-ci
<% for sub in subsystems %>
- name: build [[ sub ]]
run: |
echo "::group::[[ sub ]] configure"
xo-build --configure --with-utests --with-examples [[ sub ]]
echo "::endgroup::"
echo "::group::[[ sub ]] build"
xo-build --build [[ sub ]]
echo "::endgroup::"
echo "::group::[[ sub ]] utest"
xo-build --utest [[ sub ]]
echo "::endgroup::"
echo "::group::[[ sub ]] install"
xo-build --install [[ sub ]]
echo "::endgroup::"
<% endfor %>
# ---- end GENERATED ----
- name: print install path
run: |
tree $PREFIX