ci: Don't use save/restore cache for conan; use artifactory (#2230)

This commit is contained in:
Ayaz Salikhov
2025-06-18 15:25:40 +01:00
committed by GitHub
parent 534518f13e
commit ebfe4e6468
8 changed files with 21 additions and 77 deletions

View File

@@ -5,8 +5,8 @@ inputs:
conan_profile: conan_profile:
description: Conan profile name description: Conan profile name
required: true required: true
conan_cache_hit: force_conan_source_build:
description: Whether conan cache has been downloaded description: Whether conan should build all dependencies from source
required: true required: true
default: "false" default: "false"
build_type: build_type:
@@ -40,7 +40,7 @@ runs:
- name: Run conan - name: Run conan
shell: bash shell: bash
env: 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' }}" CODE_COVERAGE: "${{ inputs.code_coverage == 'true' && 'True' || 'False' }}"
STATIC_OPTION: "${{ inputs.static == 'true' && 'True' || 'False' }}" STATIC_OPTION: "${{ inputs.static == 'true' && 'True' || 'False' }}"
INTEGRATION_TESTS_OPTION: "${{ inputs.build_integration_tests == 'true' && 'True' || 'False' }}" INTEGRATION_TESTS_OPTION: "${{ inputs.build_integration_tests == 'true' && 'True' || 'False' }}"
@@ -50,7 +50,7 @@ runs:
conan \ conan \
install .. \ install .. \
-of . \ -of . \
-b "$BUILD_OPTION" \ -b "$CONAN_BUILD_OPTION" \
-s "build_type=${{ inputs.build_type }}" \ -s "build_type=${{ inputs.build_type }}" \
-o "&:static=${STATIC_OPTION}" \ -o "&:static=${STATIC_OPTION}" \
-o "&:tests=True" \ -o "&:tests=True" \

View File

@@ -1,10 +1,7 @@
name: Restore cache name: Restore cache
description: Find and restores conan and ccache cache description: Find and restores ccache cache
inputs: inputs:
conan_dir:
description: Path to Conan directory
required: true
conan_profile: conan_profile:
description: Conan profile name description: Conan profile name
required: true required: true
@@ -19,13 +16,8 @@ inputs:
description: Whether code coverage is on description: Whether code coverage is on
required: true required: true
default: "false" default: "false"
outputs: 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: ccache_cache_hit:
description: True if ccache cache has been downloaded description: True if ccache cache has been downloaded
value: ${{ steps.ccache_cache.outputs.cache-hit }} value: ${{ steps.ccache_cache.outputs.cache-hit }}
@@ -37,24 +29,6 @@ runs:
id: git_common_ancestor id: git_common_ancestor
uses: ./.github/actions/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 - name: Restore ccache cache
uses: actions/cache/restore@v4 uses: actions/cache/restore@v4
id: ccache_cache id: ccache_cache

View File

@@ -1,27 +1,13 @@
name: Save cache name: Save cache
description: Save conan and ccache cache for develop branch description: Save ccache cache for develop branch
inputs: inputs:
conan_dir:
description: Path to Conan directory
required: true
conan_profile: conan_profile:
description: Conan profile name description: Conan profile name
required: true 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: ccache_dir:
description: Path to .ccache directory description: Path to .ccache directory
required: true 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: build_type:
description: Current build type (e.g. Release, Debug) description: Current build type (e.g. Release, Debug)
required: true required: true
@@ -31,6 +17,12 @@ inputs:
required: true required: true
default: "false" 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: runs:
using: composite using: composite
steps: steps:
@@ -38,19 +30,6 @@ runs:
id: git_common_ancestor id: git_common_ancestor
uses: ./.github/actions/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 - name: Save ccache cache
if: ${{ inputs.ccache_cache_hit != 'true' || inputs.ccache_cache_miss_rate == '100.0' }} if: ${{ inputs.ccache_cache_hit != 'true' || inputs.ccache_cache_miss_rate == '100.0' }}
uses: actions/cache/save@v4 uses: actions/cache/save@v4

View File

@@ -24,7 +24,7 @@ on:
type: string type: string
disable_cache: disable_cache:
description: Whether ccache and conan cache should be disabled description: Whether ccache should be disabled
required: false required: false
type: boolean type: boolean
default: false default: false

View File

@@ -24,7 +24,7 @@ on:
type: string type: string
disable_cache: disable_cache:
description: Whether ccache and conan cache should be disabled description: Whether ccache should be disabled
required: false required: false
type: boolean type: boolean
@@ -89,7 +89,6 @@ jobs:
uses: ./.github/actions/restore_cache uses: ./.github/actions/restore_cache
id: restore_cache id: restore_cache
with: with:
conan_dir: ${{ env.CONAN_HOME }}
conan_profile: ${{ inputs.conan_profile }} conan_profile: ${{ inputs.conan_profile }}
ccache_dir: ${{ env.CCACHE_DIR }} ccache_dir: ${{ env.CCACHE_DIR }}
build_type: ${{ inputs.build_type }} build_type: ${{ inputs.build_type }}
@@ -99,7 +98,6 @@ jobs:
uses: ./.github/actions/generate uses: ./.github/actions/generate
with: with:
conan_profile: ${{ inputs.conan_profile }} conan_profile: ${{ inputs.conan_profile }}
conan_cache_hit: ${{ !inputs.disable_cache && steps.restore_cache.outputs.conan_cache_hit }}
build_type: ${{ inputs.build_type }} build_type: ${{ inputs.build_type }}
code_coverage: ${{ inputs.code_coverage }} code_coverage: ${{ inputs.code_coverage }}
static: ${{ inputs.static }} static: ${{ inputs.static }}
@@ -168,15 +166,13 @@ jobs:
if: ${{ !inputs.disable_cache && github.ref == 'refs/heads/develop' }} if: ${{ !inputs.disable_cache && github.ref == 'refs/heads/develop' }}
uses: ./.github/actions/save_cache uses: ./.github/actions/save_cache
with: with:
conan_dir: ${{ env.CONAN_HOME }} conan_profile: ${{ inputs.conan_profile }}
conan_hash: ${{ steps.restore_cache.outputs.conan_hash }}
conan_cache_hit: ${{ steps.restore_cache.outputs.conan_cache_hit }}
ccache_dir: ${{ env.CCACHE_DIR }} 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 }} build_type: ${{ inputs.build_type }}
code_coverage: ${{ inputs.code_coverage }} 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: # This is run as part of the build job, because it requires the following:
# - source code # - source code

View File

@@ -38,8 +38,6 @@ jobs:
uses: ./.github/actions/generate uses: ./.github/actions/generate
with: with:
conan_profile: ${{ env.CONAN_PROFILE }} conan_profile: ${{ env.CONAN_PROFILE }}
conan_cache_hit: ${{ steps.restore_cache.outputs.conan_cache_hit }}
build_type: Release
- name: Build Clio - name: Build Clio
uses: ./.github/actions/build_clio uses: ./.github/actions/build_clio

View File

@@ -44,16 +44,13 @@ jobs:
uses: ./.github/actions/restore_cache uses: ./.github/actions/restore_cache
id: restore_cache id: restore_cache
with: with:
conan_dir: ${{ env.CONAN_HOME }}
ccache_dir: ${{ env.CCACHE_DIR }}
conan_profile: ${{ env.CONAN_PROFILE }} conan_profile: ${{ env.CONAN_PROFILE }}
ccache_dir: ${{ env.CCACHE_DIR }}
- name: Run conan and cmake - name: Run conan and cmake
uses: ./.github/actions/generate uses: ./.github/actions/generate
with: with:
conan_profile: ${{ env.CONAN_PROFILE }} conan_profile: ${{ env.CONAN_PROFILE }}
conan_cache_hit: ${{ steps.restore_cache.outputs.conan_cache_hit }}
build_type: Release
- name: Get number of threads - name: Get number of threads
uses: ./.github/actions/get_number_of_threads uses: ./.github/actions/get_number_of_threads

View File

@@ -80,7 +80,7 @@ jobs:
uses: ./.github/actions/generate uses: ./.github/actions/generate
with: with:
conan_profile: ${{ env.CONAN_PROFILE }} conan_profile: ${{ env.CONAN_PROFILE }}
conan_cache_hit: "false" force_conan_source_build: "true"
build_type: ${{ matrix.build_type }} build_type: ${{ matrix.build_type }}
- name: Login to Conan - name: Login to Conan