cmake: Make use of GNUInstallDirs as optional #126
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: plibsys-ci | |
on: [push, pull_request] | |
jobs: | |
main: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
CC: gcc | |
CXX: g++ | |
USE_COV: '1' | |
- os: ubuntu-latest | |
CC: clang | |
CXX: clang++ | |
USE_COV: '0' | |
- os: macos-latest | |
CC: clang | |
CXX: clang++ | |
USE_COV: '1' | |
- os: macos-latest | |
CC: gcc-12 | |
CXX: g++-12 | |
USE_COV: '0' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: config | |
run: | | |
pwd | |
cd .. | |
mkdir ./plibsys-build | |
cd ./plibsys-build | |
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=${{ matrix.CC }} -DCMAKE_CXX_COMPILER=${{ matrix.CXX }} -DPLIBSYS_COVERAGE=ON ../plibsys | |
- name: build | |
run: | | |
pwd | |
cd ../plibsys-build | |
make -j | |
- name: test | |
run: | | |
pwd | |
cd ../plibsys-build | |
ctest | |
- name: coverage-install | |
if: ${{ success() && matrix.USE_COV == '1' && github.ref == 'refs/heads/coverage' }} | |
run: | | |
pwd | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
sudo apt-get update | |
sudo apt-get install lcov | |
echo "CODECOV_OS=linux" >> ${GITHUB_ENV} | |
elif [ "$RUNNER_OS" == "macOS" ]; then | |
brew update | |
brew install lcov | |
echo "CODECOV_OS=macos" >> ${GITHUB_ENV} | |
else | |
echo "Unknown operating system of runner" | |
exit 1 | |
fi | |
pip install codecov-cli | |
- name: coverage-run | |
if: ${{ success() && matrix.USE_COV == '1' && github.ref == 'refs/heads/coverage' }} | |
run: | | |
pwd | |
codecovcli create-commit -t ${{ secrets.CODECOV_TOKEN }} | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
lcov -c --directory ../plibsys-build --no-external --base-directory . --output-file ../plibsys-build/coverage.info | |
elif [ "$RUNNER_OS" == "macOS" ]; then | |
lcov -c --directory ../plibsys-build --branch-coverage --base-directory . --output-file ../plibsys-build/coverage.info --exclude "/Applications/Xcode*" --verbose | |
else | |
echo "Unknown operating system of runner" | |
exit 1 | |
fi | |
codecovcli -v create-report -t ${{ secrets.CODECOV_TOKEN }} | |
codecovcli -v do-upload --dir ../plibsys-build --name github-${{ env.CODECOV_OS }} -t ${{ secrets.CODECOV_TOKEN }} |