xo-indentlog: github: simplify ubuntu build

This commit is contained in:
Roland Conybeare 2024-05-01 23:29:24 -04:00
commit 96cca5e383

View file

@ -20,11 +20,15 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - name: checkout source
uses: actions/checkout@v3
- name: Install catch2 - name: Install dependencies
# install catch2. see [[https://stackoverflow.com/questions/57982945/how-to-apt-get-install-in-a-github-actions-workflow]] # install catch2. see [[https://stackoverflow.com/questions/57982945/how-to-apt-get-install-in-a-github-actions-workflow]]
run: sudo apt-get install -y catch2 run: |
echo "::group::install catch2"
sudo apt-get install -y catch2
echo "::endgroup"
# ---------------------------------------------------------------- # ----------------------------------------------------------------
@ -34,27 +38,61 @@ jobs:
repository: Rconybea/xo-cmake repository: Rconybea/xo-cmake
path: repo/xo-cmake path: repo/xo-cmake
- name: Configure xo-cmake - name: build xo-cmake
run: cmake -B ${{github.workspace}}/build_xo-cmake -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local repo/xo-cmake run: |
XONAME=xo-cmake
XOSRC=repo/${XONAME}
BUILDDIR=${{github.workspace}}/build_${XONAME}
PREFIX=${{github.workspace}}/local
- name: Build xo-cmake (trivial) echo "::group::configure ${XONAME}"
run: cmake --build ${{github.workspace}}/build_xo-cmake --config ${{env.BUILD_TYPE}} cmake -B ${BUILDDIR} -DCMAKE_INSTALL_PREFIX=${PREFIX} ${XOSRC}
echo "::endgroup"
- name: Install xo-cmake echo "::group::compile ${XONAME}"
run: cmake --install ${{github.workspace}}/build_xo-cmake cmake --build ${BUILDDIR} --config ${{env.BUILD_TYPE}}
echo "::endgroup"
echo "::group::local install ${XONAME}"
cmake --install ${BUILDDIR}
echo "::endgroup"
echo "::group::local dir tree"
tree ${PREFIX}
echo "::endgroup"
# ---------------------------------------------------------------- # ----------------------------------------------------------------
- name: Configure self (indentlog) - name: build self (indentlog)
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. run: |
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type XONAME=xo-indentlog
run: cmake -B ${{github.workspace}}/build -DCMAKE_MODULE_PATH=${{github.workspace}}/local/share/cmake -DCMAKE_PREFIX_PATH=${{github.workspace}}/local -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/local -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} BUILDDIR=${{github.workspace}}/build_${XONAME}
- name: Build self (indentlog) PREFIX=${{github.workspace}}/local
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
- name: Test self (indentlog) echo "::group::repo dir tree"
working-directory: ${{github.workspace}}/build tree -L 2 repo
# Execute tests defined by the CMake configuration. echo "::endgroup"
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}} --rerun-failed --output-on-failure echo "::group::configure ${XONAME}"
cmake -B ${BUILDDIR} -DCMAKE_MODULE_PATH=${PREFIX}/share/cmake -DCMAKE_PREFIX_PATH=${PREFIX} -DCMAKE_INSTALL_PREFIX=${PREFIX} -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
echo "::endgroup"
echo "::group::compile ${XONAME}"
cmake --build ${BUILDDIR} --config ${{env.BUILD_TYPE}}
echo "::endgroup"
echo "::group::run unit tests ${XONAME}"
cmake --build ${BUILDDIR} -- test
echo "::endgroup"
echo "::group::local install ${XONAME}"
cmake --install ${BUILDDIR}
echo "::endgroup"
echo "::group::local dir tree"
tree -L 3 ${PREFIX}
echo "::endgroup"
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
(cd ${BUILDDIR} && ctest -C ${{env.BUILD_TYPE}})