Skip to content

Commit c7b4719

Browse files
authored
Another attempt at fixing the cache (#228)
1 parent 9d4f202 commit c7b4719

File tree

2 files changed

+19
-37
lines changed

2 files changed

+19
-37
lines changed

.github/workflows/lint.yml

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -56,42 +56,22 @@ jobs:
5656
run: |
5757
version=`python -c "from setuptools_scm import get_version; print(get_version())"`
5858
echo "QSSC_VERSION=$version" >> $GITHUB_ENV
59+
- name: Prepare Conan
60+
run: |
61+
conan profile new default --detect || true
62+
conan profile update settings.compiler.libcxx=libstdc++11 default
63+
# Add QASM, LLVM, and clang tools recipes to Conan cache.
64+
./conan_deps.sh
65+
conan lock create conanfile.py -pr:h default -pr:b default --build=outdated
5966
- name: Load Conan cache
6067
id: cache
6168
uses: actions/cache/restore@v3
6269
with:
6370
path: .conan
6471
key: conan-${{ runner.os }}
65-
restore-keys: conan-${{ runner.os }}
66-
- name: Create Conan default profile
67-
run: |
68-
conan profile new default --detect || true
69-
conan profile update settings.compiler.libcxx=libstdc++11 default
70-
- name: Add QASM, LLVM, and clang tools recipes to Conan cache.
71-
run: ./conan_deps.sh
72+
restore-keys: conan-${{ runner.os }}-${{ hashFiles('conan.lock') }}
7273
- name: Create build dir
7374
run: mkdir build
74-
# Check if all conan packages are within the cache. If not
75-
# we will need to build packages (and if on main flush the cache)
76-
- name : Check Conan dependencies are cached
77-
id: check_conan_cache
78-
working-directory: build
79-
run: |
80-
export CONAN_LLVM_GIT_CACHE="${{ runner.temp }}/llvm-project"
81-
conan info .. -pr:h default -pr:b default --build=outdated --json build_requires.json
82-
build_requires=$(cat build_requires.json)
83-
if [[ "$build_requires" == *"[]"* ]];
84-
then
85-
all_in_cache=true
86-
else
87-
all_in_cache=false
88-
fi
89-
echo "all_in_cache=$all_in_cache" >> $GITHUB_OUTPUT
90-
echo "Conan build requires: $build_requires"
91-
echo "Conan cache is complete: $all_in_cache"
92-
# If we have a cache miss on 'main', clear the cache.
93-
# A dependency was updated, so we need to drop the old one
94-
# to prevent unbounded cache growth over time.
9575
- name: Conan install
9676
id: conan_install
9777
working-directory: build

.github/workflows/test.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# that they have been altered from the originals.
1212
name: Build
1313
on: [push, pull_request]
14+
1415
jobs:
1516
Build:
1617
runs-on: ubuntu-latest
@@ -40,19 +41,20 @@ jobs:
4041
run: |
4142
version=`python -c "from setuptools_scm import get_version; print(get_version())"`
4243
echo "QSSC_VERSION=$version" >> $GITHUB_ENV
44+
- name: Prepare Conan
45+
run: |
46+
conan profile new default --detect || true
47+
conan profile update settings.compiler.libcxx=libstdc++11 default
48+
# Add QASM, LLVM, and clang tools recipes to Conan cache.
49+
./conan_deps.sh
50+
conan lock create conanfile.py -pr:h default -pr:b default --build=outdated
4351
- name: Load Conan cache
4452
id: cache
4553
uses: actions/cache/restore@v3
4654
with:
4755
path: .conan
4856
key: conan-${{ runner.os }}
49-
restore-keys: conan-${{ runner.os }}
50-
- name: Create Conan default profile
51-
run: |
52-
conan profile new default --detect || true
53-
conan profile update settings.compiler.libcxx=libstdc++11 default
54-
- name: Add QASM, LLVM, and clang tools recipes to Conan cache.
55-
run: ./conan_deps.sh
57+
restore-keys: conan-${{ runner.os }}-${{ hashFiles('conan.lock') }}
5658
- name: Create build dir
5759
run: mkdir build
5860
# Check if all conan packages are within the cache. If not
@@ -61,7 +63,6 @@ jobs:
6163
id: check_conan_cache
6264
working-directory: build
6365
run: |
64-
export CONAN_LLVM_GIT_CACHE="${{ runner.temp }}/llvm-project"
6566
conan info .. -pr:h default -pr:b default --build=outdated --json build_requires.json
6667
build_requires=$(cat build_requires.json)
6768
if [[ "$build_requires" == *"[]"* ]];
@@ -84,6 +85,7 @@ jobs:
8485
conan profile new default --detect || true
8586
conan profile update settings.compiler.libcxx=libstdc++11 default
8687
./conan_deps.sh
88+
conan lock create conanfile.py -pr:h default -pr:b default --build=outdated
8789
- name: Conan install
8890
id: conan_install
8991
working-directory: build
@@ -106,4 +108,4 @@ jobs:
106108
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')
107109
with:
108110
path: .conan
109-
key: conan-${{ runner.os }}
111+
key: conan-${{ runner.os }}-${{ hashFiles('conan.lock') }}

0 commit comments

Comments
 (0)