Files
mp-units/.github/workflows/ci-test-package-cmake.yml
T

102 lines
3.7 KiB
YAML

# The MIT License (MIT)
#
# Copyright (c) 2018 Mateusz Pusz
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
name: CMake Test Package CI
on:
push:
paths-ignore:
- 'docs/**'
- 'example/**'
- 'test/**'
pull_request:
paths-ignore:
- 'docs/**'
- 'example/**'
- 'test/**'
env:
CC: gcc-10
CXX: g++-10
CMAKE_GENERATOR: Ninja
jobs:
test_package:
name: CMake test_package (${{ matrix.build_type }})
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
build_type: [ "Release", "Debug" ]
steps:
- uses: actions/checkout@v2
- name: Cache Conan data
uses: actions/cache@v2
env:
cache-name: cache-conan-data
with:
path: ~/.conan/data
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/metadata.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Ninja
run: |
sudo apt install -y ninja-build
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install Conan
run: |
pip install -U conan
- name: Configure Conan
run: |
conan config init
conan remote add upload https://api.bintray.com/conan/mpusz/conan-mpusz
- name: Install Conan dependencies
run: |
mkdir -p build/${{ matrix.build_type }} && cd build/${{ matrix.build_type }}
conan install ../.. -s compiler.cppstd=20 -s compiler.libcxx=libstdc++11 -s build_type=${{ matrix.build_type }} -b outdated -u
- name: Configure mp-units CMake
run: |
cd build/${{ matrix.build_type }}
cmake ../../src -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake
- name: Install mp-units
run: |
cd build/${{ matrix.build_type }}
cmake --install . --prefix test_package
- name: Configure test_package CMake
run: |
mkdir -p test_package/build/${{ matrix.build_type }} && cd test_package/build/${{ matrix.build_type }}
conan install ../../.. -s compiler.cppstd=20 -s compiler.libcxx=libstdc++11 -s build_type=${{ matrix.build_type }}
cmake ../.. -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_INSTALL_PREFIX=../../../build/${{ matrix.build_type }}/test_package -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake
- name: Build test_package
run: |
cd test_package/build/${{ matrix.build_type }}
cmake --build .
- name: Run test_package
run: |
cd test_package/build/${{ matrix.build_type }}
./test_package