Skip to content

Commit

Permalink
ci conan presets (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
petiaccja authored Feb 22, 2024
1 parent 56548c6 commit cf571aa
Show file tree
Hide file tree
Showing 10 changed files with 184 additions and 152 deletions.
13 changes: 13 additions & 0 deletions .github/build_profiles/clang20d
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[settings]
arch=x86_64
build_type=Debug
compiler=clang
compiler.cppstd=20
compiler.libcxx=libstdc++11
compiler.version=17
os=Linux

[conf]
tools.build:compiler_executables={'c': 'clang', 'cpp': 'clang++' }
tools.cmake.cmaketoolchain:generator=Ninja
tools.cmake.cmake_layout:build_folder_vars=["settings.compiler", "settings.compiler.cppstd", "settings.build_type"]
13 changes: 13 additions & 0 deletions .github/build_profiles/clang20r
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[settings]
arch=x86_64
build_type=Release
compiler=clang
compiler.cppstd=20
compiler.libcxx=libstdc++11
compiler.version=17
os=Linux

[conf]
tools.build:compiler_executables={'c': 'clang', 'cpp': 'clang++' }
tools.cmake.cmaketoolchain:generator=Ninja
tools.cmake.cmake_layout:build_folder_vars=["settings.compiler", "settings.compiler.cppstd", "settings.build_type"]
13 changes: 13 additions & 0 deletions .github/build_profiles/gcc20d
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[settings]
arch=x86_64
build_type=Debug
compiler=gcc
compiler.cppstd=20
compiler.libcxx=libstdc++11
compiler.version=13
os=Linux

[conf]
tools.build:compiler_executables={'c': 'gcc', 'cpp': 'g++' }
tools.cmake.cmaketoolchain:generator=Ninja
tools.cmake.cmake_layout:build_folder_vars=["settings.compiler", "settings.compiler.cppstd", "settings.build_type"]
13 changes: 13 additions & 0 deletions .github/build_profiles/gcc20r
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=20
compiler.libcxx=libstdc++11
compiler.version=13
os=Linux

[conf]
tools.build:compiler_executables={'c': 'gcc', 'cpp': 'g++' }
tools.cmake.cmaketoolchain:generator=Ninja
tools.cmake.cmake_layout:build_folder_vars=["settings.compiler", "settings.compiler.cppstd", "settings.build_type"]
13 changes: 13 additions & 0 deletions .github/build_profiles/msvc20d
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[settings]
arch=x86_64
build_type=Debug
compiler=msvc
compiler.cppstd=20
compiler.version=193
compiler.runtime=dynamic
os=Windows

[conf]
tools.build:compiler_executables={'c': 'cl.exe', 'cpp': 'cl.exe' }
tools.cmake.cmaketoolchain:generator=Ninja
tools.cmake.cmake_layout:build_folder_vars=["settings.compiler", "settings.compiler.cppstd", "settings.build_type"]
13 changes: 13 additions & 0 deletions .github/build_profiles/msvc20r
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=20
compiler.version=193
compiler.runtime=dynamic
os=Windows

[conf]
tools.build:compiler_executables={'c': 'cl.exe', 'cpp': 'cl.exe' }
tools.cmake.cmaketoolchain:generator=Ninja
tools.cmake.cmake_layout:build_folder_vars=["settings.compiler", "settings.compiler.cppstd", "settings.build_type"]
81 changes: 29 additions & 52 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,28 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest]
c_compiler: [gcc, clang, cl]
build_type: [Debug, Release]
cxx_standard: ["20"]
build_profile: [clang20d, clang20r, gcc20d, gcc20r, msvc20d, msvc20r]
include:
- c_compiler: gcc
cxx_compiler: g++
- c_compiler: clang
cxx_compiler: clang++
- c_compiler: cl
cxx_compiler: cl
- os: windows-latest
binary_ext: ".exe"
- os: ubuntu-latest
binary_ext: ""
- build_type: Debug
conan_preset: "conan-debug"
- build_type: Release
conan_preset: "conan-release"
exclude:
- os: windows-latest
c_compiler: gcc
- os: windows-latest
c_compiler: clang
- os: ubuntu-latest
c_compiler: cl
- build_profile: clang20d
conan_preset: clang-20-debug
os: ubuntu-latest
- build_profile: clang20r
conan_preset: clang-20-release
os: ubuntu-latest
- build_profile: gcc20d
conan_preset: gcc-20-debug
os: ubuntu-latest
- build_profile: gcc20r
conan_preset: gcc-20-release
os: ubuntu-latest
- build_profile: msvc20d
conan_preset: msvc-20-debug
os: windows-latest
- build_profile: msvc20r
conan_preset: msvc-20-release
os: windows-latest

name: ${{ matrix.c_compiler }} - ${{ matrix.build_type }} - ${{ matrix.os }} - c++${{ matrix.cxx_standard }}
name: ${{ matrix.build_profile }}

runs-on: ${{matrix.os}}

Expand All @@ -54,9 +48,9 @@ jobs:
with:
version: "17.0"
directory: ${{ runner.temp }}/llvm
- run: pip install conan

- name: Install GCC
shell: bash
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
Expand All @@ -66,46 +60,29 @@ jobs:
sudo update-alternatives --remove-all g++ || true
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 10 --slave /usr/bin/g++ g++ /usr/bin/g++-13
- name: Install conan
shell: bash
env:
CC: "${{ matrix.c_compiler != 'cl' && matrix.c_compiler || '' }}"
CXX: "${{ matrix.cxx_compiler != 'cl' && matrix.cxx_compiler || '' }}"
run: |
pip install conan
conan profile detect --name ci --force
python $GITHUB_WORKSPACE/support/update-conan-profile.py $(conan profile path ci) ${{matrix.build_type}} ${{matrix.c_compiler}} ${{matrix.cxx_compiler}} ${{matrix.cxx_standard}}
- name: Cache conan packages
id: cache-conan
uses: actions/cache@v3
with:
path: ~/.conan2/p
key: conan-cache-packages-${{ matrix.os }}-${{ matrix.c_compiler }}-${{ matrix.build_type }}-${{ matrix.cxx_standard }}
key: conan-cache-packages-${{ matrix.build_profile }}

- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build
run: cmake -E make_directory ${{github.workspace}}/build

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
env:
CC: ${{matrix.c_compiler}}
CXX: ${{matrix.cxx_compiler}}
PR: "${{github.workspace}}/.github/build_profiles/${{matrix.build_profile}}"
run: |
conan install $GITHUB_WORKSPACE --output-folder=. --build="*" -pr ci -pr:b ci -s build_type=${{ matrix.build_type }}
cmake -E make_directory "${{github.workspace}}/build"
conan install "${{github.workspace}}" --build=missing -pr $PR -pr:b $PR
conan cache clean
cmake $GITHUB_WORKSPACE --preset ${{ matrix.conan_preset }}
cmake -S "${{github.workspace}}" --preset conan-${{ matrix.conan_preset }}
- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
cmake --build ./build/${{ matrix.build_type }}
cmake -E make_directory ${{runner.workspace}}/installation/SEDManager
cmake --install ./build/${{ matrix.build_type }} --prefix '${{runner.workspace}}/installation/SEDManager'
cmake --build --preset conan-${{ matrix.conan_preset }}
- name: Test
working-directory: ${{runner.workspace}}/build
shell: bash
run: ./build/${{ matrix.build_type }}/bin/test
run: ${{github.workspace}}/build/${{ matrix.conan_preset }}/bin/test
114 changes: 48 additions & 66 deletions .github/workflows/sanitizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,75 +27,57 @@ jobs:

env:
os: "ubuntu-latest"
build_type: "Debug"
cxx_standard: "20"
c_compiler: "clang"
cxx_compiler: "clang++"
conan_preset: "conan-debug"
build_profile: "clang20d"
conan_preset: "clang-20-debug"

name: ${{ matrix.sanitize }}

runs-on: "ubuntu-latest"

steps:
- uses: actions/checkout@v4
- uses: seanmiddleditch/gha-setup-ninja@v4
- uses: seanmiddleditch/gha-setup-vsdevenv@master
- uses: KyleMayes/install-llvm-action@v1
with:
version: "17.0"
directory: ${{ runner.temp }}/llvm

- name: Install GCC
shell: bash
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-13 g++-13
sudo update-alternatives --remove-all gcc || true
sudo update-alternatives --remove-all g++ || true
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 10 --slave /usr/bin/g++ g++ /usr/bin/g++-13
- name: Install conan
shell: bash
env:
CC: "${{ env.c_compiler != 'cl' && env.c_compiler || '' }}"
CXX: "${{ env.cxx_compiler != 'cl' && env.cxx_compiler || '' }}"
run: |
pip install conan
conan profile detect --name ci --force
python $GITHUB_WORKSPACE/support/update-conan-profile.py $(conan profile path ci) ${{env.build_type}} ${{env.c_compiler}} ${{env.cxx_compiler}} ${{env.cxx_standard}}
- name: Cache conan packages
id: cache-conan
uses: actions/cache@v3
with:
path: ~/.conan2/p
key: conan-cache-packages-${{ env.os }}-${{ env.c_compiler }}-${{ env.build_type }}-${{ env.cxx_standard }}

- name: Create Build Environment
run: cmake -E make_directory ${{runner.workspace}}/build

- name: Configure CMake
shell: bash
working-directory: ${{runner.workspace}}/build
env:
CC: ${{env.c_compiler}}
CXX: ${{env.cxx_compiler}}
run: |
conan install $GITHUB_WORKSPACE --output-folder=. --build="*" -pr ci -pr:b ci -s build_type=${{ env.build_type }}
conan cache clean
cmake $GITHUB_WORKSPACE --preset ${{ env.conan_preset }} -D${{ matrix.sanitize_flag }}:BOOL=ON
- name: Build
working-directory: ${{runner.workspace}}/build
shell: bash
run: |
cmake --build ./build/${{ env.build_type }}
cmake -E make_directory ${{runner.workspace}}/installation/SEDManager
cmake --install ./build/${{ env.build_type }} --prefix '${{runner.workspace}}/installation/SEDManager'
- name: Test
working-directory: ${{runner.workspace}}/build
shell: bash
run: ./build/${{ env.build_type }}/bin/test
- uses: actions/checkout@v4
- uses: seanmiddleditch/gha-setup-ninja@v4
- uses: seanmiddleditch/gha-setup-vsdevenv@master
- uses: KyleMayes/install-llvm-action@v1
with:
version: "17.0"
directory: ${{ runner.temp }}/llvm
- run: pip install conan

- name: Install GCC
if: ${{ env.os == 'ubuntu-latest' }}
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt update
sudo apt install gcc-13 g++-13
sudo update-alternatives --remove-all gcc || true
sudo update-alternatives --remove-all g++ || true
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 10 --slave /usr/bin/g++ g++ /usr/bin/g++-13
- name: Cache conan packages
id: cache-conan
uses: actions/cache@v3
with:
path: ~/.conan2/p
key: conan-cache-packages-${{ env.build_profile }}

- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build

- name: Configure CMake
shell: bash
env:
PR: "${{github.workspace}}/.github/build_profiles/${{env.build_profile}}"
run: |
cmake -E make_directory "${{github.workspace}}/build"
conan install "${{github.workspace}}" --build=missing -pr $PR -pr:b $PR
conan cache clean
cmake -S "${{github.workspace}}" --preset conan-${{ env.conan_preset }} -D${{ matrix.sanitize_flag }}:BOOL=ON
- name: Build
run: |
cmake --build --preset conan-${{ env.conan_preset }}
- name: Test
run: ${{github.workspace}}/build/${{ env.conan_preset }}/bin/test

Loading

0 comments on commit cf571aa

Please sign in to comment.