From 14ca98128cb9a2d7b2392216977ce415ac30cb68 Mon Sep 17 00:00:00 2001 From: Hari Kadayam Date: Thu, 22 May 2025 22:54:31 -0700 Subject: [PATCH] Convert github workflows to conan 2 --- .github/actions/load_conan/action.yml | 4 +-- .github/actions/setup_conan/action.yml | 7 ++--- .github/actions/store_conan/action.yml | 39 +++++++++++++++----------- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/.github/actions/load_conan/action.yml b/.github/actions/load_conan/action.yml index fd23b442..e4be901f 100644 --- a/.github/actions/load_conan/action.yml +++ b/.github/actions/load_conan/action.yml @@ -42,7 +42,7 @@ runs: uses: actions/cache/restore@v4 with: path: | - ~/.conan/data + ~/.conan2/p key: ${{ inputs.key_prefix }}-${{ hashFiles(steps.hash-key-primary.outputs.key, steps.hash-key-3rd.outputs.keys) }} fail-on-cache-miss: ${{ inputs.fail_on_cache_miss }} @@ -50,7 +50,7 @@ runs: uses: actions/cache/restore@v4 with: path: | - ~/.conan/data + ~/.conan2/p key: ${{ inputs.key_prefix }}-${{ hashFiles(steps.hash-key-primary.outputs.key, steps.hash-key-3rd.outputs.keys) }} restore-keys: ${{ inputs.key_prefix }}- if: ${{ steps.restore-cache.outputs.cache-hit != 'true' && (( github.event_name == 'pull_request' && inputs.testing == 'True' ) || ( inputs.load_any == 'True' )) }} diff --git a/.github/actions/setup_conan/action.yml b/.github/actions/setup_conan/action.yml index abe22393..f438df66 100644 --- a/.github/actions/setup_conan/action.yml +++ b/.github/actions/setup_conan/action.yml @@ -17,15 +17,14 @@ runs: shell: bash run: | python -m pip install --upgrade pip - python -m pip install conan~=1.0 + python -m pip install conan python -m pip install gcovr - conan user - conan profile new --detect default + conan profile default - name: Fixup libstdc++ shell: bash run: | # Set std::string to non-CoW C++11 version - sed -i 's,compiler.libcxx=libstdc++$,compiler.libcxx=libstdc++11,g' ~/.conan/profiles/default + sed -i 's,compiler.libcxx=libstdc++$,compiler.libcxx=libstdc++11,g' ~/.conan2/profiles/default if: ${{ inputs.platform == 'ubuntu-22.04' }} diff --git a/.github/actions/store_conan/action.yml b/.github/actions/store_conan/action.yml index 7b633486..d872c78f 100644 --- a/.github/actions/store_conan/action.yml +++ b/.github/actions/store_conan/action.yml @@ -4,33 +4,38 @@ inputs: key_prefix: description: 'Cache prefix' required: true - default: 'ForkDeps' + default: 'Deps' runs: using: "composite" steps: - name: Setup Conan and Export Recipes shell: bash run: | - if [ -d 3rd_party ]; then - dep_pkgs=$(ls -1d 3rd_party/* 2>/dev/null | cut -d'/' -f2 | paste -sd'|' - -) - fi - if [ -z "${dep_pkgs}" ]; then - dep_pkgs="no_3rd_party" - fi - dirty_pkgs=$(ls -1d ~/.conan/data/*/*/*/*/build 2>/dev/null | sed 's,.*data/,,') - if [ -z "${dirty_pkgs}" ]; then - dirty_pkgs="no_public/0" - fi - dirty_pkgs_d=$(echo "${dirty_pkgs}" | cut -d'/' -f1 | paste -sd'|' - -) - echo "::info:: Caching: ${dirty_pkgs_d}|${dep_pkgs}" - ls -1d ~/.conan/data/* | grep -Ev "(${dirty_pkgs_d}|${dep_pkgs})" | xargs rm -rf - rm -rf ~/.conan/data/*/*/*/*/build - rm -rf ~/.conan/data/*/*/*/*/source + rm -rf ~/.conan2/p/*/b + echo "Caching following packages" + find ~/.conan2/p -type d -maxdepth 4 + + #if [ -d 3rd_party ]; then + # dep_pkgs=$(ls -1d 3rd_party/* 2>/dev/null | cut -d'/' -f2 | paste -sd'|' - -) + #fi + #if [ -z "${dep_pkgs}" ]; then + # dep_pkgs="no_3rd_party" + #fi + #dirty_pkgs=$(ls -1d ~/.conan2/p/*/b/ 2>/dev/null | sed 's,.*p/,,') + #if [ -z "${dirty_pkgs}" ]; then + # dirty_pkgs="no_public/0" + #fi + #dirty_pkgs=$(ls -1d ~/.conan2/p/*/b 2>/dev/null | sed 's,.*p/,,') + #dirty_pkgs_d=$(echo "${dirty_pkgs}" | cut -d'/' -f1 | paste -sd'|' - -) + #echo "::info:: Caching: ${dirty_pkgs_d}|${dep_pkgs}" + #ls -1d ~/.conan/data/* | grep -Ev "(${dirty_pkgs_d}|${dep_pkgs})" | xargs rm -rf + #rm -rf ~/.conan/data/*/*/*/*/build + #rm -rf ~/.conan/data/*/*/*/*/source - name: Save Cache uses: actions/cache/save@v4 with: path: | - ~/.conan/data + ~/.conan2/p key: ${{ inputs.key_prefix }}-${{ hashFiles('conanfile.py', '3rd_party/**/conanfile.py') }}