ci: GitHub workflows updated for Conan 2.0

This commit is contained in:
Mateusz Pusz
2023-02-24 09:36:27 +01:00
parent d46377ee16
commit 1899f7803f
4 changed files with 36 additions and 43 deletions

View File

@@ -59,7 +59,6 @@ jobs:
cxx: "g++-10",
std: 20,
},
lib: "libstdc++11",
}
- {
name: "Ubuntu GCC-11",
@@ -72,7 +71,6 @@ jobs:
cxx: "g++-11",
std: 20,
},
lib: "libstdc++11",
}
- {
name: "Ubuntu GCC-12",
@@ -85,7 +83,6 @@ jobs:
cxx: "g++-12",
std: 20,
},
lib: "libstdc++11",
}
- {
name: "Ubuntu Clang-12 + libstdc++11",
@@ -178,7 +175,7 @@ jobs:
env:
cache-name: cache-conan-data
with:
path: ~/.conan/data
path: ~/.conan2/data
key: build-${{ matrix.config.os }}-${{ matrix.build_type }}-${{ matrix.config.compiler.type }}-${{ matrix.config.compiler.version }}-${{ matrix.config.lib }}
restore-keys: |
build-${{ matrix.config.os }}-${{ matrix.build_type }}-${{ matrix.config.compiler.type }}-${{ matrix.config.compiler.version }}-${{ matrix.config.lib }}
@@ -239,15 +236,14 @@ jobs:
- name: Configure Conan
shell: bash
run: |
conan config init
conan profile detect --force
conan remote add artifactory https://mpusz.jfrog.io/artifactory/api/conan/conan-oss
if [[ "${{ matrix.config.compiler.type }}" == "GCC" || "${{ matrix.config.compiler.type }}" == "CLANG" ]]; then
conan profile update settings.compiler.libcxx=${{ matrix.config.lib }} default
if [[ "${{ matrix.config.compiler.type }}" == "CLANG" ]]; then
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.libcxx=.*/compiler.libcxx=${{ matrix.config.lib }}/' ~/.conan2/profiles/default
fi
conan profile update settings.compiler.cppstd=${{ matrix.config.compiler.std }} default
conan profile update settings.build_type=${{ matrix.build_type }} default
conan profile update conf.tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" default
conan profile show default
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.cppstd=.*/compiler.cppstd=${{ matrix.config.compiler.std }}/' ~/.conan2/profiles/default
sed -i.backup '/^\[settings\]$/,/^\[/ s/^build_type=.*/build_type=${{ matrix.build_type }}/' ~/.conan2/profiles/default
conan profile show -pr default
# - name: Add support for clang-13 to Conan's settings.yml
# # TODO Remove when Conan will support clang-13
# if: matrix.config.compiler.type == 'CLANG'
@@ -262,7 +258,8 @@ jobs:
- name: Create Conan package
shell: bash
run: |
conan create . mpusz/testing -o mp-units:downcast_mode=${{ matrix.downcast_mode }} -c user.build:all=True -c user.build:skip_docs=True -b mp-units -b outdated -u
conan create . --user mpusz --channel testing -b mp-units -b missing -c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" \
-o downcast_mode=${{ matrix.downcast_mode }} -c user.build:all=True -c user.build:skip_docs=True
- name: Upload mp-units Conan package
if: github.ref == 'refs/heads/master' || env.CHANNEL == 'stable'
shell: bash

View File

@@ -63,7 +63,6 @@ jobs:
cxx: "g++-10",
std: 20,
},
lib: "libstdc++11",
}
- {
name: "Ubuntu GCC-11",
@@ -76,7 +75,6 @@ jobs:
cxx: "g++-11",
std: 20,
},
lib: "libstdc++11",
}
- {
name: "Ubuntu GCC-12",
@@ -89,7 +87,6 @@ jobs:
cxx: "g++-12",
std: 20,
},
lib: "libstdc++11",
}
- {
name: "Ubuntu Clang-12 + libstdc++11",
@@ -186,7 +183,7 @@ jobs:
env:
cache-name: cache-conan-data
with:
path: ~/.conan/data
path: ~/.conan2/data
key: build-${{ matrix.config.os }}-${{ matrix.build_type }}-${{ matrix.config.compiler.type }}-${{ matrix.config.compiler.version }}-${{ matrix.config.lib }}
restore-keys: |
build-${{ matrix.config.os }}-${{ matrix.build_type }}-${{ matrix.config.compiler.type }}-${{ matrix.config.compiler.version }}-${{ matrix.config.lib }}
@@ -242,15 +239,14 @@ jobs:
- name: Configure Conan
shell: bash
run: |
conan config init
conan profile detect --force
conan remote add artifactory https://mpusz.jfrog.io/artifactory/api/conan/conan-oss
if [[ "${{ matrix.config.compiler.type }}" == "GCC" || "${{ matrix.config.compiler.type }}" == "CLANG" ]]; then
conan profile update settings.compiler.libcxx=${{ matrix.config.lib }} default
if [[ "${{ matrix.config.compiler.type }}" == "CLANG" ]]; then
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.libcxx=.*/compiler.libcxx=${{ matrix.config.lib }}/' ~/.conan2/profiles/default
fi
conan profile update settings.compiler.cppstd=${{ matrix.config.compiler.std }} default
conan profile update settings.build_type=${{ matrix.build_type }} default
conan profile update conf.tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" default
conan profile show default
sed -i.backup '/^\[settings\]$/,/^\[/ s/^compiler.cppstd=.*/compiler.cppstd=${{ matrix.config.compiler.std }}/' ~/.conan2/profiles/default
sed -i.backup '/^\[settings\]$/,/^\[/ s/^build_type=.*/build_type=${{ matrix.build_type }}/' ~/.conan2/profiles/default
conan profile show -pr default
# - name: Add support for clang-13 to Conan's settings.yml
# # TODO Remove when Conan will support clang-13
# if: matrix.config.compiler.type == 'CLANG'
@@ -260,7 +256,7 @@ jobs:
- name: Install Conan dependencies
shell: bash
run: |
conan install . -b outdated -u
conan install . -b missing -c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config"
mv CMakeUserPresets.json src
- name: Configure mp-units CMake
if: matrix.config.compiler.type == 'VISUAL' || matrix.config.compiler.type == 'MSVC'
@@ -269,19 +265,19 @@ jobs:
run: |
cmake --version
call ..\build\generators\conanvcvars.bat
cmake --preset default -DCMAKE_INSTALL_PREFIX=../out
cmake --preset conan-default -DCMAKE_INSTALL_PREFIX=../out
- name: Configure mp-units CMake
if: matrix.config.compiler.type != 'VISUAL' && matrix.config.compiler.type != 'MSVC'
shell: bash
working-directory: src
run: |
cmake --version
cmake --preset default -DCMAKE_INSTALL_PREFIX=../out
cmake --preset conan-default -DCMAKE_INSTALL_PREFIX=../out
- name: Install mp-units
shell: bash
working-directory: src
run: |
cmake --build --preset ${{ steps.build_type.outputs.lowercase }} --target install
cmake --build --preset conan-${{ steps.build_type.outputs.lowercase }} --target install
- name: Provide dependencies for test_package
shell: bash
working-directory: test_package
@@ -293,14 +289,14 @@ jobs:
working-directory: test_package
run: |
call ..\build\generators\conanvcvars.bat
cmake --preset default -Dmp-units_DIR=../build -Bbuild/local
cmake --preset conan-default -Dmp-units_DIR=../build -Bbuild/local
cmake --build build/local --config ${{ matrix.build_type }}
- name: Build test_package CMake (local build)
if: matrix.config.compiler.type != 'VISUAL' && matrix.config.compiler.type != 'MSVC'
shell: bash
working-directory: test_package
run: |
cmake --preset default -Dmp-units_DIR=../build -Bbuild/local
cmake --preset conan-default -Dmp-units_DIR=../build -Bbuild/local
cmake --build build/local --config ${{ matrix.build_type }}
- name: Run test_package (local build)
shell: bash
@@ -313,14 +309,14 @@ jobs:
working-directory: test_package
run: |
call ..\build\generators\conanvcvars.bat
cmake --preset default -DCMAKE_INSTALL_PREFIX=../out -Bbuild/install
cmake --preset conan-default -DCMAKE_INSTALL_PREFIX=../out -Bbuild/install
cmake --build build/install --config ${{ matrix.build_type }}
- name: Build test_package CMake (installation)
if: matrix.config.compiler.type != 'VISUAL' && matrix.config.compiler.type != 'MSVC'
shell: bash
working-directory: test_package
run: |
cmake --preset default -DCMAKE_INSTALL_PREFIX=../out -Bbuild/install
cmake --preset conan-default -DCMAKE_INSTALL_PREFIX=../out -Bbuild/install
cmake --build build/install --config ${{ matrix.build_type }}
- name: Run test_package (installation)
shell: bash

View File

@@ -37,7 +37,7 @@ jobs:
fail-fast: false
matrix:
language: ["cpp", "python"]
os: [ "ubuntu-latest" ]
os: ["ubuntu-latest"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
@@ -71,7 +71,7 @@ jobs:
env:
cache-name: cache-conan-data
with:
path: ~/.conan/data
path: ~/.conan2/data
key: build-${{ matrix.os }}-$BUILD_TYPE-$COMPILER_TYPE-$COMPILER_VERSION-$STDLIB
restore-keys: |
build-${{ matrix.os }}-$BUILD_TYPE-$COMPILER_TYPE-$COMPILER_VERSION-
@@ -87,10 +87,10 @@ jobs:
if: matrix.language == 'cpp'
run: |
pip install -U conan
conan config init
conan remote add upload https://mpusz.jfrog.io/artifactory/api/conan/conan-oss
conan profile detect --force
conan remote add artifactory https://mpusz.jfrog.io/artifactory/api/conan/conan-oss
mkdir _lgtm_build_dir && cd _lgtm_build_dir
conan install .. -s compiler.cppstd=20 -s compiler.libcxx=$STDLIB -c user.build:all=True -c user.build:skip_docs=True -b outdated -u
conan install .. -s compiler.cppstd=20 -s compiler.libcxx=$STDLIB -c user.build:all=True -c user.build:skip_docs=True -b missing
conan build ..
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

View File

@@ -52,7 +52,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest" ]
os: ["ubuntu-latest"]
steps:
- uses: actions/checkout@v3
- name: Cache Conan data
@@ -60,7 +60,7 @@ jobs:
env:
cache-name: cache-conan-data
with:
path: ~/.conan/data
path: ~/.conan2/data
key: build-${{ matrix.os }}-$BUILD_TYPE-$COMPILER_TYPE-$COMPILER_VERSION-$STDLIB
restore-keys: |
build-${{ matrix.os }}-$BUILD_TYPE-$COMPILER_TYPE-$COMPILER_VERSION-
@@ -82,17 +82,17 @@ jobs:
pip install -U conan
- name: Configure Conan
run: |
conan config init
conan remote add -i 0 upload https://mpusz.jfrog.io/artifactory/api/conan/conan-oss
conan profile detect --force
conan remote add artifactory https://mpusz.jfrog.io/artifactory/api/conan/conan-oss
- name: Install Conan dependencies
run: |
conan install . -s compiler.cppstd=20 -s compiler.libcxx=$STDLIB -c user.build:all=True -c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" -b outdated -u
conan install . -s compiler.cppstd=20 -s compiler.libcxx=$STDLIB -c user.build:all=True -c tools.cmake.cmaketoolchain:generator="Ninja Multi-Config" -b missing
- name: Configure CMake
run: |
cmake --preset default
cmake --preset conan-default
- name: Generate documentation
run: |
cmake --build --preset release --target documentation
cmake --build --preset conan-release --target documentation
- name: Deploy documentation
if: github.ref == 'refs/heads/master'
uses: peaceiris/actions-gh-pages@v3