Skip to content

update workflow files to include clang and fix configure step #89

update workflow files to include clang and fix configure step

update workflow files to include clang and fix configure step #89

Workflow file for this run

name: C++ CI
on: [ push, pull_request ]
jobs:
precommit_checks:
runs-on: 'ubuntu-latest'
name: Pre-Commit Checks
steps:
- name: checkout
uses: actions/checkout@v3
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Update pip
run: |
python -m pip install --upgrade pip
- name: Install and run pre-commit
uses: pre-commit/[email protected]
with:
extra_args: --all-files
matrix-strategy-setup:
needs: precommit_checks
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
- id: set-matrix
run: |
TASKS=$(echo $(cat .github/workflows/build-matrix.json) | sed 's/ //g' )
echo "matrix=$TASKS" >> $GITHUB_OUTPUT
build-test-install:
needs: matrix-strategy-setup
name: ${{ matrix.config.os }}_${{ matrix.config.cc }}-${{ matrix.config.compiler_version }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.matrix-strategy-setup.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
with:
submodules: 'true'
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Set up GCC
if: ${{ runner.os == 'Linux' && matrix.config.cc == 'gcc' }}
uses: egor-tensin/setup-gcc@v1
with:
version: ${{ matrix.config.compiler_version }}
platform: x64
- name: Cache LLVM Download
id: cache-llvm
uses: actions/cache@v3
env:
cache-name: cache-llvm-files
with:
path: ./llvm-${{ matrix.config.compiler_version }}
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.config.cc }}-${{ matrix.config.compiler_version }}-${{ hashFiles('**/workflows/cpp.yml') }}
- name: Install LLVM and Clang
if: ${{ steps.cache-llvm.outputs.cache-hit != 'true' && runner.os == 'Linux' && matrix.config.cc == 'clang' }}
uses: KyleMayes/install-llvm-action@v2
with:
version: ${{ matrix.config.compiler_version }}
directory: ./llvm-${{ matrix.config.compiler_version }}
env: 'true'
- name: Append LLVM To Path
if: ${{ runner.os == 'Linux' && matrix.config.cc == 'clang' }}
shell: bash
run: |
llvmdir=$(pwd)/llvm-${{ matrix.config.compiler_version }}
echo "$llvmdir"
echo "LLVM_DIR=$llvmdir" >> $GITHUB_OUTPUT
echo "$llvmdir/bin" >> $GITHUB_PATH
- name: Print Clang version
if: ${{ runner.os == 'Linux' && matrix.config.cc == 'clang' }}
shell: bash
run: |
echo $PATH
ls -l ./llvm-${{ matrix.config.compiler_version }}
ls -l ./llvm-${{ matrix.config.compiler_version }}/bin
echo "$PATH"
clang --version
llvm-config --version
- name: Install conan
id: conan
shell: bash
run: |
python3 -m pip install --upgrade pip setuptools
python3 -m pip install conan
echo "CONAN_HOME=$HOME/.conan2-${{ runner.os }}-${{ matrix.config.build_type }}-${{ matrix.config.cc }}-${{ matrix.config.compiler_version }}" >> $GITHUB_OUTPUT
- name: Install Doxygen
if: ${{ runner.os }} == "Linux" || ${{ runner.os }} == "macOS"
shell: bash
run: |
if [[ ${{ runner.os }} == 'Linux' ]]; then
sudo apt-get clean && sudo apt-get update && sudo apt-get install -y doxygen graphviz
elif [[ ${{ runner.os }} == 'macOS' ]]; then
brew install doxygen graphviz
elif [[ ${{ runner.os }} == 'Windows' ]]; then
echo "Deferring to chocolatey"
fi
- name: Chocolatey install Doxygen
if: runner.os == 'Windows'
uses: crazy-max/ghaction-chocolatey@v1
with:
args: install doxygen.install graphviz --no-progress
- name: Source profile
if: runner.os == 'Linux'
shell: bash
run: source ~/.profile
- name: Setup cmake
uses: jwlawson/[email protected]
with:
cmake-version: '3.22'
- name: Configure Windows compile environment
uses: ilammy/msvc-dev-cmd@v1
if: runner.os == 'Windows' && matrix.config.cxx == 'cl'
with:
arch: amd64
- name: Cache Conan Dependencies Install
id: cache-conan-deps
uses: actions/cache@v3
env:
cache-name: cache-conan-deps
with:
path: ${{ steps.conan.outputs.CONAN_HOME }}
key: ${{ runner.os }}-${{ env.cache-name }}-${{ matrix.config.build_type }}-${{ matrix.config.cc }}-${{ matrix.config.compiler_version }}-${{ hashFiles('**/conandata.yml') }}-${{ hashFiles('**/conanfile.py') }}
- name: Configure CMake
shell: bash
env:
CC: ${{ matrix.config.cc }}
CXX: ${{ matrix.config.cxx }}
run: >
export CONAN_HOME=${{ steps.conan.outputs.CONAN_HOME }} &&
cmake
-S .
-B ./build
-G Ninja
-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES="conan_provider.cmake"
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }}
-DWARNINGS_AS_ERRORS:BOOL=OFF
-DUSE_PYBIND11_FINDPYTHON:BOOL=ON
- name: Build NOR Games
shell: bash
run: |
cmake --build ./build --config Release --target game_test_targets_all
- name: Build NOR Library
shell: bash
run: |
cmake --build ./build --config Release --target nor_tests_all
- name: Run Game Implementation Tests
shell: bash
run: >
GTEST_OUTPUT=xml:gtest-report-${{ github.jobs.build-test-install.name }}-games.xml
GTEST_COLOR=1
ctest -R Test_game_.+_test
--test-dir ./build
--verbose
-C ${{ matrix.config.build_type }}
- name: Upload game test result artifacts
uses: actions/upload-artifact@v3
if: success()
with:
name: gtest-results
path: ./build/**/gtest-report-${{ github.jobs.build-test-install.name }}-games.xml
retention-days: 1
- name: Run No-Regret Tests
shell: bash
run: >
GTEST_OUTPUT=xml:gtest-report-${{ github.jobs.build-test-install.name }}.xml
GTEST_COLOR=1
ctest -R Test_nor_tests_all
--test-dir ./build
--verbose
-C ${{ matrix.config.build_type }}
- name: Upload lib test result artifacts
uses: actions/upload-artifact@v3
if: success()
with:
name: gtest-results
path: ./build/**/gtest-report-${{ github.jobs.build-test-install.name }}.xml
retention-days: 1
publish-gtest-results:
name: "Publish GTest Results"
needs: build-test-install
runs-on: ubuntu-latest
if: always()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: gtest-results
path: ./artifacts/gtest-results_downloaded
- name: Display structure of downloaded files
run: ls
working-directory: ./artifacts/gtest-results_downloaded
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: ./artifacts/**/*.xml