Ensure object file paths are correctly handled for multi-config builds #1035
Workflow file for this run
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
# | |
# 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: Documentation | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | |
BUILD_TYPE: Debug | |
COMPILER_TYPE: gcc | |
COMPILER_VERSION: 13 | |
STDLIB: libstdc++11 | |
jobs: | |
documentation: | |
# The CMake configure and build commands are platform agnostic and should work equally | |
# well on Windows or Mac. You can convert this to a matrix build if you need | |
# cross-platform coverage. | |
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ "ubuntu-latest" ] | |
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.os }}-${{ env.BUILD_TYPE }}-${{ env.COMPILER_TYPE }}-${{ env.COMPILER_VERSION }}-${{ env.STDLIB }}-documentation | |
restore-keys: | | |
${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.os }}-${{ env.BUILD_TYPE }}-${{ env.COMPILER_TYPE }}-${{ env.COMPILER_VERSION }}-${{ env.STDLIB }} | |
${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.os }}-${{ env.BUILD_TYPE }}-${{ env.COMPILER_TYPE }}-${{ env.COMPILER_VERSION }}- | |
${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.os }}-${{ env.BUILD_TYPE }}-${{ env.COMPILER_TYPE }}- | |
${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.os }}-${{ env.BUILD_TYPE }}- | |
${{ hashFiles('**/conanfile.py') }}-build-${{ matrix.os }}- | |
- name: Install Latest GCC | |
uses: egor-tensin/[email protected] | |
with: | |
version: ${{ env.COMPILER_VERSION }} | |
platform: x64 | |
- 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/^compiler.cppstd=.*/compiler.cppstd=20/' .conan2/profiles/default | |
sed -i.backup '/^\[settings\]$/,/^\[/ s/^build_type=.*/build_type=${{ env.BUILD_TYPE }}/' .conan2/profiles/default | |
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler=.*/compiler=${{ env.COMPILER_TYPE }}/' .conan2/profiles/default | |
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.version=.*/compiler.version=${{ env.COMPILER_VERSION }}/' .conan2/profiles/default | |
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.libcxx=.*/compiler.libcxx=${{ env.STDLIB }}/' .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 | |
echo "tools.cmake.cmaketoolchain:generator = Ninja Multi-Config" >> .conan2/global.conf | |
echo "tools.system.package_manager:mode = install" >> .conan2/global.conf | |
echo "tools.system.package_manager:sudo = True" >> .conan2/global.conf | |
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 -o build_docs=True -o boost/*:without_cobalt=True | |
- name: Configure Conan Build | |
shell: bash | |
working-directory: ${{github.workspace}} | |
run: | | |
source build/generators/conanbuild.sh | |
- name: Configure CMake | |
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | |
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | |
run: | | |
cmake --preset conan-default -DMORPHEUS_BUILD_DOCUMENTATION:BOOL=ON | |
- name: Conan Preset | |
shell: bash | |
run: echo "CONAN_PRESET=conan-$(echo ${{env.BUILD_TYPE}} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV | |
- name: Build | |
# Build your program with the given configuration | |
run: cmake --build --preset ${{ env.CONAN_PRESET }} --target Documentation | |
- name: Deploy documentation | |
if: github.ref == 'refs/heads/main' | |
uses: peaceiris/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./build/documentation/sphinx | |
- name: Conan Cache Save | |
run: | | |
conan cache clean | |
conan cache save "*/*:*" |