Merge branch 'main' of https://github.com/IDNI/tau-lang #325
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CMake | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Release | |
# Customize the compiler version | |
GCC_VERSION: 13 | |
jobs: | |
build: | |
# TODO maybe set to a specific runner version to ensure the build environment is consistent | |
# requires to take care of Act runner version because it does not have 24.04 runner | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install boost | |
uses: MarkusJx/[email protected] | |
id: install-boost | |
with: | |
# A list of supported versions can be found here: | |
# https://github.com/MarkusJx/prebuilt-boost/blob/main/versions-manifest.json | |
boost_version: 1.83.0 | |
platform_version: 22.04 | |
arch: x86 | |
- name: Act dependencies and setup | |
# if running locally with act, | |
# install cmake since act runner does not have it | |
# and set the GCC_VERSION to 12 (the highest supported by act runner) | |
if: ${{env.ACT}} | |
run: | | |
echo "GCC_VERSION=12" >> $GITHUB_ENV | |
export GCC_VERSION=12 | |
apt-get update && apt-get install cmake rpm gcc-$GCC_VERSION g++-$GCC_VERSION -y | |
- name: Act update gcc and g++ alternatives to a selected compiler version | |
if: ${{env.ACT}} | |
run: | | |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-$GCC_VERSION 60 | |
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-$GCC_VERSION 60 | |
- name: Initialize git submodules | |
run: git submodule update --init --recursive | |
- name: Configure CMake | |
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | |
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | |
run: | | |
cmake -B ${{github.workspace}}/build \ | |
-DTAU_BUILD_TESTS=ON \ | |
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ | |
-DCMAKE_C_COMPILER=/usr/bin/gcc \ | |
-DCMAKE_CXX_COMPILER=/usr/bin/g++ \ | |
-DBoost_INCLUDE_DIR=${{steps.install-boost.outputs.BOOST_ROOT}}/include \ | |
-DBoost_LIBRARY_DIRS=${{steps.install-boost.outputs.BOOST_ROOT}}/lib | |
env: | |
BOOST_ROOT: ${{steps.install-boost.outputs.BOOST_ROOT}} | |
- name: Build | |
# Build your program with the given configuration | |
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | |
- name: Test | |
working-directory: ${{github.workspace}}/build | |
# Execute tests defined by the CMake configuration. | |
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail | |
run: ctest -C ${{env.BUILD_TYPE}} --output-on-failure | |
- name: Package | |
working-directory: ${{github.workspace}}/build | |
run: cpack -C ${{env.BUILD_TYPE}} |