From ebfe4e6468160e02be022ebcafc59607a0e303d0 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Wed, 18 Jun 2025 15:25:40 +0100 Subject: [PATCH] ci: Don't use save/restore cache for conan; use artifactory (#2230) --- .github/actions/generate/action.yml | 8 +++--- .github/actions/restore_cache/action.yml | 30 ++------------------ .github/actions/save_cache/action.yml | 35 +++++------------------- .github/workflows/build_and_test.yml | 2 +- .github/workflows/build_impl.yml | 14 ++++------ .github/workflows/check_libxrpl.yml | 2 -- .github/workflows/clang-tidy.yml | 5 +--- .github/workflows/upload_conan_deps.yml | 2 +- 8 files changed, 21 insertions(+), 77 deletions(-) diff --git a/.github/actions/generate/action.yml b/.github/actions/generate/action.yml index a81daab6..7fead90e 100644 --- a/.github/actions/generate/action.yml +++ b/.github/actions/generate/action.yml @@ -5,8 +5,8 @@ inputs: conan_profile: description: Conan profile name required: true - conan_cache_hit: - description: Whether conan cache has been downloaded + force_conan_source_build: + description: Whether conan should build all dependencies from source required: true default: "false" build_type: @@ -40,7 +40,7 @@ runs: - name: Run conan shell: bash env: - BUILD_OPTION: "${{ inputs.conan_cache_hit == 'true' && 'missing' || '*' }}" + CONAN_BUILD_OPTION: "${{ inputs.force_conan_source_build == 'true' && '*' || 'missing' }}" CODE_COVERAGE: "${{ inputs.code_coverage == 'true' && 'True' || 'False' }}" STATIC_OPTION: "${{ inputs.static == 'true' && 'True' || 'False' }}" INTEGRATION_TESTS_OPTION: "${{ inputs.build_integration_tests == 'true' && 'True' || 'False' }}" @@ -50,7 +50,7 @@ runs: conan \ install .. \ -of . \ - -b "$BUILD_OPTION" \ + -b "$CONAN_BUILD_OPTION" \ -s "build_type=${{ inputs.build_type }}" \ -o "&:static=${STATIC_OPTION}" \ -o "&:tests=True" \ diff --git a/.github/actions/restore_cache/action.yml b/.github/actions/restore_cache/action.yml index dfcd1500..1cfb68f3 100644 --- a/.github/actions/restore_cache/action.yml +++ b/.github/actions/restore_cache/action.yml @@ -1,10 +1,7 @@ name: Restore cache -description: Find and restores conan and ccache cache +description: Find and restores ccache cache inputs: - conan_dir: - description: Path to Conan directory - required: true conan_profile: description: Conan profile name required: true @@ -19,13 +16,8 @@ inputs: description: Whether code coverage is on required: true default: "false" + outputs: - conan_hash: - description: Hash to use as a part of conan cache key - value: ${{ steps.conan_hash.outputs.hash }} - conan_cache_hit: - description: True if conan cache has been downloaded - value: ${{ steps.conan_cache.outputs.cache-hit }} ccache_cache_hit: description: True if ccache cache has been downloaded value: ${{ steps.ccache_cache.outputs.cache-hit }} @@ -37,24 +29,6 @@ runs: id: git_common_ancestor uses: ./.github/actions/git_common_ancestor - - name: Calculate conan hash - id: conan_hash - shell: bash - run: | - conan graph info . --format json --out-file info.json -o '&:tests=True' --profile:all ${{ inputs.conan_profile }} - packages_info="$(cat info.json | jq -r '.graph.nodes[]?.ref' | grep -v 'clio')" - echo "$packages_info" - hash="$(echo "$packages_info" | shasum -a 256 | cut -d ' ' -f 1)" - rm info.json - echo "hash=$hash" >> $GITHUB_OUTPUT - - - name: Restore conan cache - uses: actions/cache/restore@v4 - id: conan_cache - with: - path: ${{ inputs.conan_dir }}/p - key: clio-conan_data-${{ runner.os }}-${{ inputs.build_type }}-${{ inputs.conan_profile }}-develop-${{ steps.conan_hash.outputs.hash }} - - name: Restore ccache cache uses: actions/cache/restore@v4 id: ccache_cache diff --git a/.github/actions/save_cache/action.yml b/.github/actions/save_cache/action.yml index f32f061e..3711f802 100644 --- a/.github/actions/save_cache/action.yml +++ b/.github/actions/save_cache/action.yml @@ -1,27 +1,13 @@ name: Save cache -description: Save conan and ccache cache for develop branch +description: Save ccache cache for develop branch inputs: - conan_dir: - description: Path to Conan directory - required: true conan_profile: description: Conan profile name required: true - conan_hash: - description: Hash to use as a part of conan cache key - required: true - conan_cache_hit: - description: Whether conan cache has been downloaded - required: true ccache_dir: description: Path to .ccache directory required: true - ccache_cache_hit: - description: Whether conan cache has been downloaded - required: true - ccache_cache_miss_rate: - description: How many cache misses happened build_type: description: Current build type (e.g. Release, Debug) required: true @@ -31,6 +17,12 @@ inputs: required: true default: "false" + ccache_cache_hit: + description: Whether ccache cache has been downloaded + required: true + ccache_cache_miss_rate: + description: How many ccache cache misses happened + runs: using: composite steps: @@ -38,19 +30,6 @@ runs: id: git_common_ancestor uses: ./.github/actions/git_common_ancestor - - name: Cleanup conan directory from extra data - if: ${{ inputs.conan_cache_hit != 'true' }} - shell: bash - run: | - conan cache clean --source --build --temp - - - name: Save conan cache - if: ${{ inputs.conan_cache_hit != 'true' }} - uses: actions/cache/save@v4 - with: - path: ${{ inputs.conan_dir }}/p - key: clio-conan_data-${{ runner.os }}-${{ inputs.build_type }}-${{ inputs.conan_profile }}-develop-${{ inputs.conan_hash }} - - name: Save ccache cache if: ${{ inputs.ccache_cache_hit != 'true' || inputs.ccache_cache_miss_rate == '100.0' }} uses: actions/cache/save@v4 diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index c713f5cb..d8ce3740 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -24,7 +24,7 @@ on: type: string disable_cache: - description: Whether ccache and conan cache should be disabled + description: Whether ccache should be disabled required: false type: boolean default: false diff --git a/.github/workflows/build_impl.yml b/.github/workflows/build_impl.yml index f04eeb67..cc52591f 100644 --- a/.github/workflows/build_impl.yml +++ b/.github/workflows/build_impl.yml @@ -24,7 +24,7 @@ on: type: string disable_cache: - description: Whether ccache and conan cache should be disabled + description: Whether ccache should be disabled required: false type: boolean @@ -89,7 +89,6 @@ jobs: uses: ./.github/actions/restore_cache id: restore_cache with: - conan_dir: ${{ env.CONAN_HOME }} conan_profile: ${{ inputs.conan_profile }} ccache_dir: ${{ env.CCACHE_DIR }} build_type: ${{ inputs.build_type }} @@ -99,7 +98,6 @@ jobs: uses: ./.github/actions/generate with: conan_profile: ${{ inputs.conan_profile }} - conan_cache_hit: ${{ !inputs.disable_cache && steps.restore_cache.outputs.conan_cache_hit }} build_type: ${{ inputs.build_type }} code_coverage: ${{ inputs.code_coverage }} static: ${{ inputs.static }} @@ -168,15 +166,13 @@ jobs: if: ${{ !inputs.disable_cache && github.ref == 'refs/heads/develop' }} uses: ./.github/actions/save_cache with: - conan_dir: ${{ env.CONAN_HOME }} - conan_hash: ${{ steps.restore_cache.outputs.conan_hash }} - conan_cache_hit: ${{ steps.restore_cache.outputs.conan_cache_hit }} + conan_profile: ${{ inputs.conan_profile }} ccache_dir: ${{ env.CCACHE_DIR }} - ccache_cache_hit: ${{ steps.restore_cache.outputs.ccache_cache_hit }} - ccache_cache_miss_rate: ${{ steps.ccache_stats.outputs.miss_rate }} build_type: ${{ inputs.build_type }} code_coverage: ${{ inputs.code_coverage }} - conan_profile: ${{ inputs.conan_profile }} + + ccache_cache_hit: ${{ steps.restore_cache.outputs.ccache_cache_hit }} + ccache_cache_miss_rate: ${{ steps.ccache_stats.outputs.miss_rate }} # This is run as part of the build job, because it requires the following: # - source code diff --git a/.github/workflows/check_libxrpl.yml b/.github/workflows/check_libxrpl.yml index df9041d5..d0c524f1 100644 --- a/.github/workflows/check_libxrpl.yml +++ b/.github/workflows/check_libxrpl.yml @@ -38,8 +38,6 @@ jobs: uses: ./.github/actions/generate with: conan_profile: ${{ env.CONAN_PROFILE }} - conan_cache_hit: ${{ steps.restore_cache.outputs.conan_cache_hit }} - build_type: Release - name: Build Clio uses: ./.github/actions/build_clio diff --git a/.github/workflows/clang-tidy.yml b/.github/workflows/clang-tidy.yml index 2b26ae89..e8bfe424 100644 --- a/.github/workflows/clang-tidy.yml +++ b/.github/workflows/clang-tidy.yml @@ -44,16 +44,13 @@ jobs: uses: ./.github/actions/restore_cache id: restore_cache with: - conan_dir: ${{ env.CONAN_HOME }} - ccache_dir: ${{ env.CCACHE_DIR }} conan_profile: ${{ env.CONAN_PROFILE }} + ccache_dir: ${{ env.CCACHE_DIR }} - name: Run conan and cmake uses: ./.github/actions/generate with: conan_profile: ${{ env.CONAN_PROFILE }} - conan_cache_hit: ${{ steps.restore_cache.outputs.conan_cache_hit }} - build_type: Release - name: Get number of threads uses: ./.github/actions/get_number_of_threads diff --git a/.github/workflows/upload_conan_deps.yml b/.github/workflows/upload_conan_deps.yml index 666aa62d..72fe1523 100644 --- a/.github/workflows/upload_conan_deps.yml +++ b/.github/workflows/upload_conan_deps.yml @@ -80,7 +80,7 @@ jobs: uses: ./.github/actions/generate with: conan_profile: ${{ env.CONAN_PROFILE }} - conan_cache_hit: "false" + force_conan_source_build: "true" build_type: ${{ matrix.build_type }} - name: Login to Conan