Skip to content

Include what you use support #1205

Include what you use support

Include what you use support #1205

Workflow file for this run

#
# Copyright 2023 Antony Peacock
#
# 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
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
name: ${{ matrix.settings.name }} ${{ matrix.configuration }}
runs-on: ${{ matrix.settings.os }}
strategy:
matrix:
configuration: [ "Release", "Debug" ]
settings:
- {
name: "Ubuntu GCC-12",
os: ubuntu-latest,
compiler: { type: GCC, version: 12, conan: "gcc", cc: "gcc-12", cxx: "g++-12", std: 20 },
lib: "libstdc++11"
}
- {
name: "Ubuntu GCC-13",
os: ubuntu-latest,
compiler: { type: GCC, version: 13, conan: "gcc", cc: "gcc-13", cxx: "g++-13", std: 20 },
lib: "libstdc++11"
}
- {
name: "Ubuntu Clang-14 + libc++",
os: ubuntu-latest,
compiler:
{
type: CLANG,
version: 14,
conan: "clang",
cc: "clang-14",
cxx: "clang++-14",
std: 20
},
lib: "libc++",
}
- {
name: "Ubuntu Clang-15 + libc++",
os: ubuntu-latest,
compiler:
{
type: CLANG,
version: 15,
conan: "clang",
cc: "clang-15",
cxx: "clang++-15",
std: 20
},
lib: "libc++",
}
- {
name: "Ubuntu Clang-16 + libc++",
os: ubuntu-latest,
compiler:
{
type: CLANG,
version: 16,
conan: "clang",
cc: "clang-16",
cxx: "clang++-16",
std: 20
},
lib: "libc++",
}
- {
name: "Visual Studio 2019",
os: windows-latest,
compiler: { type: VISUAL, version: 16, conan: "mscv", cc: "cl", cxx: "cl", std: 20 },
}
- {
name: "MacOS Apple Clang 14",
os: macos-13,
compiler:
{
type: APPLE_CLANG,
version: "14.3.1",
conan: "apple-clang",
cc: "clang",
cxx: "clang++",
std: 20
},
lib: "libc++",
}
- {
name: "MacOS Apple Clang 15",
os: macos-14,
compiler:
{
type: APPLE_CLANG,
version: "15.3",
conan: "apple-clang",
cc: "clang",
cxx: "clang++",
std: 20
},
lib: "libc++",
}
steps:
- uses: actions/[email protected]
- name: Cache Conan data
uses: actions/[email protected]
env:
cache-name: cache-conan-data
with:
path: ${{github.workspace}}/conan_cache_save.tgz
key: ${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.settings.os }}-${{ matrix.configuration }}-${{ matrix.settings.compiler.conan }}-${{ matrix.settings.compiler.version }}-${{ matrix.settings.lib }}
restore-keys: |
${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.settings.os }}-${{ matrix.configuration }}-${{ matrix.settings.compiler.conan }}-${{ matrix.settings.compiler.version }}-
${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.settings.os }}-${{ matrix.configuration }}-${{ matrix.settings.compiler.conan }}-
${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.settings.os }}-${{ matrix.configuration }}-
${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.settings.os }}-
# - uses: lhotari/action-upterm@v1
# with:
# ## limits ssh access and adds the ssh public key for the user which triggered the workflow
# limit-access-to-actor: true
## limits ssh access and adds the ssh public keys of the listed GitHub users
# limit-access-to-users: twon
- name: Add msbuild to PATH
if: matrix.settings.os == 'windows-latest'
uses: microsoft/setup-msbuild@v2
with:
vs-version: "16.5"
- name: Install Latest GCC
if: matrix.settings.compiler.type == 'GCC'
uses: egor-tensin/[email protected]
with:
version: ${{ matrix.settings.compiler.version }}
platform: x64
- name: Install Latest libstdC++11
if: matrix.settings.compiler.type == 'CLANG' && matrix.settings.lib == 'libstdc++11'
uses: egor-tensin/[email protected]
with:
version: 12
platform: x64
- name: Install Clang
if: matrix.settings.compiler.type == 'CLANG'
uses: egor-tensin/[email protected]
with:
version: ${{ matrix.settings.compiler.version }}
platform: x64
- name: Install Libc++
if: matrix.settings.compiler.type == 'CLANG' && matrix.settings.lib == 'libc++'
shell: bash
run: |
sudo apt install -y libc++-${{ matrix.settings.compiler.version }}-dev libc++abi-${{ matrix.settings.compiler.version }}-dev libunwind-${{ matrix.settings.compiler.version }}-dev
- name: Select Xcode ${{matrix.settings.compiler.version}}
if: contains(matrix.settings.os, 'macos')
uses: maxim-lobanov/[email protected]
with:
xcode-version: '${{matrix.settings.compiler.version}}'
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.11'
- name: Install Python requirements
run: |
pip install -r ./requirements.txt
- name: Configure Conan
shell: bash
run: |
conan profile detect --force
sed -i.backup '/^\[settings\]$/,/^\[/ s/^build_type=.*/build_type=${{ matrix.configuration }}/' .conan2/profiles/default
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.cppstd=.*/compiler.cppstd=${{ matrix.settings.compiler.std }}/' .conan2/profiles/default
if [[ "${{ matrix.settings.compiler.type }}" == "GCC" || "${{ matrix.settings.compiler.type }}" == "CLANG" ]]; then
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler=.*/compiler=${{ matrix.settings.compiler.conan }}/' .conan2/profiles/default
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.version=.*/compiler.version=${{ matrix.settings.compiler.version }}/' .conan2/profiles/default
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.libcxx=.*/compiler.libcxx=${{ matrix.settings.lib }}/' .conan2/profiles/default
sed -i.backup '1a mold*:build_type=Release' .conan2/profiles/default
sed -i.backup '1a onetbb*:build_type=Release' .conan2/profiles/default
sed -i.backup '1a mold*:compiler.libcxx=libstdc++11' .conan2/profiles/default
fi
echo "tools.cmake.cmaketoolchain:generator = Ninja Multi-Config" >> .conan2/global.conf
if [[ "${{ matrix.settings.os }}" != "windows-latest" ]]; then
echo "tools.system.package_manager:mode = install" >> .conan2/global.conf
echo "tools.system.package_manager:sudo = True" >> .conan2/global.conf
fi
conan profile show -pr default
- name: Conan Cache Restore
shell: bash
run: |
if [ -f ./conan_cache_save.tgz ]; then
conan cache restore ./conan_cache_save.tgz
fi
- name: Configure Install
working-directory: ${{github.workspace}}
shell: bash
run: |
conan install "${{github.workspace}}" --build missing -pr:b default -o boost/*:without_cobalt=True
- name: Configure Conan Build
if: matrix.settings.os == 'windows-latest'
shell: cmd
working-directory: ${{github.workspace}}
run: |
call build\generators\conanvcvars.bat
call build\generators\conanbuild.bat
- name: Configure Conan Build
if: matrix.settings.os != 'windows-latest'
shell: bash
working-directory: ${{github.workspace}}
run: |
source build/generators/conanbuild.sh
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
# timeout-minutes: 15
# with:
# detached: true
- name: Configure CMake
if: matrix.settings.os == 'windows-latest'
shell: cmd
run: |
cmake --version
call build\generators\conanbuild.bat
cmake --preset conan-default -DENABLE_ADDRESS_SANITIZER=ON -DENABLE_UNDEFINED_BEHAVIOUR_SANITIZER=ON
- name: Configure CMake
if: matrix.settings.os != 'windows-latest'
shell: bash
run: |
source build/generators/conanbuild.sh
cmake --preset conan-default -DENABLE_ADDRESS_SANITIZER=ON -DENABLE_UNDEFINED_BEHAVIOUR_SANITIZER=ON
- name: Conan Preset
shell: bash
run: echo "CONAN_PRESET=conan-$(echo ${{matrix.configuration}} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Build
if: matrix.settings.os == 'windows-latest'
shell: cmd
run: |
call build\generators\conanbuild.bat
cmake --build --preset ${{ env.CONAN_PRESET }}
- name: Build
if: matrix.settings.os != 'windows-latest'
shell: bash
run: |
source build/generators/conanbuild.sh
cmake --build --preset ${{ env.CONAN_PRESET }}
- name: Test
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest --preset ${{ env.CONAN_PRESET }} -LE GPU # Exclude GPU tests as Github actions do not have the supported hardware/drivers
- name: Conan Cache Save
run: |
conan cache clean
conan cache save "*/*:*"