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

View File

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

View File

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

View File

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