Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial GitHub Actions support for lutok #30

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 200 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
---
# GitHub action to compile and test lutok on supported platforms.
#
# Steps executed:
# * Handle prerequisites
# * Install binary packages
# * Build packages from source (if needed).
# * Build
# * Install
# * Run tests
#
# On MacOS we build with:
# * latest clang from brew (system provided clang lacks sanitizers).
# * ld from system
#
# Notes re: building with Lua 5.3...
# * In order to build/test with 5.3 on MacOS, we would need to build lutok
# and kyua from scratch. Installing via the formula picks up the binary
# package, which is built against the default version of Lua (5.4).
# * I'm not sure why Ubuntu doesn't distribute the liblua5.3-dev package on
# 24.04.
env:
KYUA_REPO: freebsd/kyua
# XXX: kyua-0.13 doesn't build because of std::auto_array no longer being a thing..
# KYUA_REF: kyua-0.13
KYUA_REF: master

name: build
on:
pull_request:
branches:
- master
push:
workflow_dispatch:

permissions:
contents: read

jobs:
build:
name: Build ${{ matrix.build-os }} ${{ matrix.compiler }} ${{ matrix.enable-atf }}
runs-on: "${{ matrix.build-os }}"
strategy:
fail-fast: false
matrix:
build-os:
- ubuntu-24.04
- macos-latest
enable-atf: [--disable-atf, --enable-atf]
include:
- build-os: macos-latest
compiler: clang-19
pkgs:
- llvm@19
- autoconf
- automake
- libtool
- pkgconf
- [email protected]
enable-atf-dep-pkgs:
- atf
llvm-bindir: /opt/homebrew/opt/llvm/bin
- build-os: ubuntu-24.04
compiler: clang-18
pkgs:
- clang-18
- autoconf
- automake
- libtool
- pkgconf
- liblua5.4-dev
- lua5.4
enable-atf-dep-pkgs:
- atf-sh
- libatf-c++-2
- libatf-c-1
- libatf-dev
kyua-dep-pkgs:
- libsqlite3-dev
llvm-bindir: /usr/lib/llvm-18/bin
steps:
- name: Install Lutok base dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew update --quiet || true
brew install ${{ join(matrix.pkgs, ' ') }}
- name: Install Lutok base dependencies (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt -Uqy --no-install-suggests \
--no-install-recommends install \
${{ join(matrix.pkgs, ' ') }}
- name: Install ATF/Kyua dependencies (MacOS)
if: runner.os == 'macOS' && matrix.enable-atf == '--enable-atf'
run: |
brew install \
${{ join(matrix.enable-atf-dep-pkgs, ' ') }} \
${{ join(matrix.kyua-dep-pkgs, ' ') }}
- name: Install ATF/Kyua dependencies (Ubuntu)
if: runner.os == 'Linux' && matrix.enable-atf == '--enable-atf'
run: |
sudo apt -Uqy --no-install-suggests \
--no-install-recommends install \
${{ join(matrix.enable-atf-dep-pkgs, ' ') }} \
${{ join(matrix.kyua-dep-pkgs, ' ') }}
- name: Checking out source
uses: actions/checkout@v4
with:
# Same as `LUTOK_SRCDIR`.
path: ${{ github.workspace }}/lutok-src
- name: Setup Environment
run: |
echo "AR=${{ matrix.llvm-bindir }}/llvm-ar" >> "${GITHUB_ENV}"
echo "CC=${{ matrix.llvm-bindir }}/clang" >> "${GITHUB_ENV}"
echo "CPP=${{ matrix.llvm-bindir }}/clang-cpp" >> "${GITHUB_ENV}"
echo "CXX=${{ matrix.llvm-bindir }}/clang++" >> "${GITHUB_ENV}"
echo "NM=${{ matrix.llvm-bindir }}/llvm-nm" >> "${GITHUB_ENV}"
echo "PKG_CONFIG_PATH='$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig'" >> "${GITHUB_ENV}"
echo "RANLIB=${{ matrix.llvm-bindir }}/llvm-ranlib" >> "${GITHUB_ENV}"
echo "OBJDUMP=${{ matrix.llvm-bindir }}/llvm-objdump" >> "${GITHUB_ENV}"
echo "STRIP=${{ matrix.llvm-bindir }}/llvm-strip" >> "${GITHUB_ENV}"
echo "KYUA_SRCDIR=${GITHUB_WORKSPACE}/kyua-src" >> "${GITHUB_ENV}"
echo "KYUA_OBJDIR=${GITHUB_WORKSPACE}/kyua-obj" >> "${GITHUB_ENV}"
echo "LUTOK_SRCDIR=${GITHUB_WORKSPACE}/lutok-src" >> "${GITHUB_ENV}"
echo "LUTOK_OBJDIR=${GITHUB_WORKSPACE}/lutok-obj" >> "${GITHUB_ENV}"
echo "LUTOK_PREFIX=/usr/local" >> "${GITHUB_ENV}"
echo "NPROC=`getconf _NPROCESSORS_ONLN 2>/dev/null || getconf NPROCESSORS_ONLN 2>/dev/null || echo 1`" >> "${GITHUB_ENV}"
- name: Build Lutok
run: |
CFG_OPTS="--disable-dependency-tracking ${{ matrix.enable-atf }}"
CFG_OPTS="${CFG_OPTS} --prefix=${LUTOK_PREFIX}"
echo "Building lutok with ${CFG_OPTS}..."
echo "uname -a: $(uname -a)"
echo "uname -m: $(uname -m)"
echo "uname -p: $(uname -p)"
echo "Build environment:"
cat "${GITHUB_ENV}"
cd "${LUTOK_SRCDIR}"
autoreconf -isv -I/usr/local/share/aclocal
mkdir -p "${LUTOK_OBJDIR}"
cd "${LUTOK_OBJDIR}"
"${LUTOK_SRCDIR}/configure" ${CFG_OPTS}
make -j${NPROC} all | tee lutok-make-all.log
- name: Install Lutok
run: |
cd "${LUTOK_OBJDIR}"
sudo make install
- name: Regenerate linker config (Ubuntu)
if: runner.os == 'Linux' && matrix.enable-atf == '--enable-atf'
run: |
sudo ldconfig
# Everything from here on out is --enable-atf related.
- name: Clone Kyua source
if: matrix.enable-atf == '--enable-atf'
uses: actions/checkout@v4
with:
repository: "${{ env.KYUA_REPO }}"
ref: "${{ env.KYUA_REF }}"
# Same as `KYUA_SRCDIR`.
path: "${{ github.workspace }}/kyua-src"
- name: Build and Install Kyua
if: matrix.enable-atf == '--enable-atf'
run: |
CFG_OPTS="--disable-dependency-tracking"
CFG_OPTS="${CFG_OPTS} --prefix=${LUTOK_PREFIX}"
CXXFLAGS="$(pkgconf --cflags atf-c++ lutok)"
LDFLAGS="$(pkgconf --libs-only-L atf-c++ lutok)"
echo "Building lutok with ${CFG_OPTS}..."
echo "uname -a: $(uname -a)"
echo "uname -m: $(uname -m)"
echo "uname -p: $(uname -p)"
cd "${KYUA_SRCDIR}"
autoreconf -isv -I/usr/local/share/aclocal
mkdir -p "${KYUA_OBJDIR}"
cd "${KYUA_OBJDIR}"
set -x
env CXXFLAGS="${CXXFLAGS}" \
LDFLAGS="${LDFLAGS}" \
"${KYUA_SRCDIR}/configure" ${CFG_OPTS}
make -j${NPROC} all | tee kyua-make-all.log
sudo make install
- name: Test Lutok
if: matrix.enable-atf == '--enable-atf'
run: |
cd "${LUTOK_PREFIX}/tests/lutok"
kyua test
check_exit=$?
if [ $check_exit -eq 0 ]; then
echo "# ✅ All mandatory checks passed" >> $GITHUB_STEP_SUMMARY
else
echo "# ❌ Some checks failed" >> $GITHUB_STEP_SUMMARY
echo "::error file=.github/workflows/build.yaml,line=173,endLine=173,title=Checks failed!::checks failed"
fi
kyua report-html --output ${LUTOK_OBJDIR}/html # produces html subdirectory
# Include the plaintext and JUnit reports.
kyua report --verbose --results-filter=xfail,broken,failed > ${LUTOK_OBJDIR}/html/test-reportfailed.txt
kyua report-junit --output ${LUTOK_OBJDIR}/html/test-reportfailed.xml
# Include the kyua log.
cp -a ~/.kyua/logs ${LUTOK_OBJDIR}/html/
exit $check_exit
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ The following flags are specific to Lutok's `configure` script:
detection features regardless of the value of this flag. However, such
warnings are only fatal when `--enable-developer` is set to "yes".

- `--with-atf`
- `--enable-atf`
- **Possible values**: "yes", "no", "auto".
- **Default**: "auto"

Expand Down
17 changes: 9 additions & 8 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ AC_CONFIG_SRCDIR([state.hpp])


AM_INIT_AUTOMAKE([1.9 check-news foreign subdir-objects -Wall])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])

AM_PROG_AR
LT_INIT


AC_LANG([C++])
AC_PROG_CXX
KYUA_REQUIRE_CXX
AX_CXX_COMPILE_STDCXX(14, noext, mandatory)
KYUA_DEVELOPER_MODE([C++])

# Check for ATF and add --enable-atf flag
Expand All @@ -58,12 +59,12 @@ AC_ARG_ENABLE([atf],
AM_CONDITIONAL([WITH_ATF], [test "x$enable_atf" = "xyes"])

# ATF dependencies
if test "x$enable_atf" = "xyes"; then
ATF_CHECK_CXX([>= 0.15])
ATF_CHECK_SH([>= 0.15])
else
AC_MSG_NOTICE([ATF support disabled])
fi
m4_ifdef([ATF_CHECK_CXX],[
AS_IF([test "x$enable_atf" = "xyes"],[
ATF_CHECK_CXX([>= 0.21])
ATF_CHECK_SH([>= 0.21])
],[AC_MSG_NOTICE([ATF support disabled])])
])

KYUA_DOXYGEN
KYUA_LUA
Expand Down
8 changes: 0 additions & 8 deletions debug.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,7 @@
#define LUTOK_DEBUG_HPP

#include <string>
#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
#include <memory>
#else
#include <tr1/memory>
#endif

namespace lutok {

Expand All @@ -59,11 +55,7 @@ class debug {
struct impl;

/// Pointer to the shared internal implementation.
#if defined(_LIBCPP_VERSION) || __cplusplus >= 201103L
std::shared_ptr< impl > _pimpl;
#else
std::tr1::shared_ptr< impl > _pimpl;
#endif

public:
debug(void);
Expand Down
Loading