Skip to content

move linux setup to appropriate directory #227

move linux setup to appropriate directory

move linux setup to appropriate directory #227

Workflow file for this run

name: Linux Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
strategy:
matrix:
include:
- {"os": ubuntu-latest,
short: linux,
compiler: gcc,
shell: bash,
buildfolder: out/build/GCC/Release}
- {"os": ubuntu-latest,
short: linux,
compiler: clang,
shell: bash,
buildfolder: out/build/Clang/Release}
runs-on: ${{matrix.os}}
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
defaults:
run:
shell: '${{ matrix.shell }} {0}'
steps:
- uses: actions/checkout@v3
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v7
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: 6.7.2
cache: true
- name: Set QTDIR and QtToolsPath
shell: bash
run: |
echo "QTDIR=$QT_ROOT_DIR" >> "$GITHUB_ENV"
echo "QtToolsPath=$QT_ROOT_DIR/bin" >> "$GITHUB_ENV"
- name: "Set environmental variables"
if: runner.os == 'Linux' || runner.os == 'Windows'
shell: bash
run: |
echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> $GITHUB_ENV
- name: Install nasm and other libraries on Linux
if: runner.os == 'Linux'
run: sudo apt-get install -y nasm libxi-dev libxtst-dev libxrandr-dev libomp-14-dev lcov gcovr
- name: Setup headless display
uses: pyvista/setup-headless-display-action@v2
- name: Install jinja2
if: runner.os == 'Linux'
run: pip install jinja2
- name: Configure CMake with coverage
if: matrix.compiler == 'gcc'
run: cmake --preset ${{matrix.short}}-${{matrix.compiler}}-release -DCODE_COVERAGE=ON
- name: Configure CMake without coverage
if: matrix.compiler != 'gcc'
run: cmake --preset ${{matrix.short}}-${{matrix.compiler}}-release
- name: Build
run: cmake --build --preset ${{matrix.short}}-${{matrix.compiler}}-release
- name: Test
run: ctest --verbose --preset ${{matrix.short}}-${{matrix.compiler}}-release -C ${{matrix.short}}-${{matrix.compiler}}-release
working-directory: ${{ github.workspace }}
- name: Capture coverage info
if: matrix.compiler == 'gcc' && runner.os == 'Linux'
run: |
lcov --directory /home/runner/work/WhiskerToolbox/WhiskerToolbox/out/build/GCC/Release --capture --output-file coverage.info
lcov --remove coverage.info '/usr/*' '*/tests/*' '*/out/*' '*/opt/*' --output-file coverage.info
lcov --list coverage.info
- name: Upload coverage to Coveralls
if: matrix.compiler == 'gcc' && runner.os == 'Linux'
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.COVERALLS_REPO_TOKEN }}
path-to-lcov: coverage.info
- name: Install
run: cmake --build --preset ${{matrix.short}}-${{matrix.compiler}}-release --target install
- name: Package with cpack
run: |
pushd ${{matrix.buildfolder}}
cpack -G TGZ
popd
shell: bash
- name: Find CPack Artifact
run: |
ARTIFACT_PATH=$(ls ${{matrix.buildfolder}}/*.tar.gz)
echo "ARTIFACT_PATH=$ARTIFACT_PATH" >> $GITHUB_ENV
shell: bash
- name: Upload CPack Artifact
uses: actions/upload-artifact@v3
with:
name: cpack-artifact
path: ${{ env.ARTIFACT_PATH }}