|
10 | 10 | # copyright notice, and modified files need to carry a notice indicating
|
11 | 11 | # that they have been altered from the originals.
|
12 | 12 | name: Build
|
13 |
| -on: [push, pull_request] |
| 13 | +on: |
| 14 | + push: |
| 15 | + branches: |
| 16 | + - 'main' |
| 17 | + - 'release/**' |
| 18 | + - '**/release/**' |
| 19 | + pull_request: |
| 20 | + types: [opened, reopened, labeled, unlabeled, synchronize] |
14 | 21 | jobs:
|
15 | 22 | Build:
|
16 | 23 | runs-on: ubuntu-latest
|
@@ -62,22 +69,22 @@ jobs:
|
62 | 69 | working-directory: build
|
63 | 70 | run: |
|
64 | 71 | export CONAN_LLVM_GIT_CACHE="${{ runner.temp }}/llvm-project"
|
65 |
| - conan install .. -pr:h default -pr:b default |
66 |
| - if [ $? -ne 0 ] |
| 72 | + build_requires=$(conan info .. -pr:h default -pr:b default --build=outdated 2>/dev/null) |
| 73 | + if [[ "$build_requires" == *"Outdated package!"* ]]; |
67 | 74 | then
|
68 |
| - cache_hit=false |
| 75 | + all_in_cache=false |
69 | 76 | else
|
70 |
| - cache_hit=true |
| 77 | + all_in_cache=true |
71 | 78 | fi
|
72 |
| - echo "cache_hit=$cache_hit" >> $GITHUB_OUTPUT |
73 |
| - echo "Cache was hit: $cache_hit" |
| 79 | + echo "all_in_cache=$all_in_cache" >> $GITHUB_OUTPUT |
| 80 | + echo "Conan build requires: $build_requires" |
| 81 | + echo "Conan cache is complete: $all_in_cache" |
74 | 82 | # If we have a cache miss on 'main', clear the cache.
|
75 | 83 | # A dependency was updated, so we need to drop the old one
|
76 | 84 | # to prevent unbounded cache growth over time.
|
77 | 85 | - name : Clear Conan cache
|
78 |
| - if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.check_conan_cache.outputs.cache_hit != 'true' |
| 86 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.check_conan_cache.outputs.all_in_cache != 'true' |
79 | 87 | run: |
|
80 |
| - echo "Cache was hit: ${{ steps.check_conan_cache.outputs.cache_hit }}" |
81 | 88 | rm -rf ./.conan
|
82 | 89 | - name: Conan install
|
83 | 90 | id: conan_install
|
|
98 | 105 | # Note: we only update the cache from 'main' to avoid "cache thrashing", which would result in the 'main'
|
99 | 106 | # cache getting LRU-evicted for every PR, since a single run uses most of the 10GB repo limit.
|
100 | 107 | - uses: actions/cache/save@v3
|
101 |
| - if: always() && (github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.conan_install.outcome == 'success' && steps.check_conan_cache.outputs.cache_hit != 'true') |
| 108 | + if: always() && (github.event_name == 'push' && github.ref == 'refs/heads/main' && steps.conan_install.outcome == 'success' && steps.check_conan_cache.outputs.all_in_cache != 'true') |
102 | 109 | with:
|
103 | 110 | path: .conan
|
104 | 111 | key: conan-${{ runner.os }}
|
0 commit comments