@@ -72,17 +72,22 @@ jobs:
7272 shell : bash
7373 run : |
7474 set -euo pipefail
75- # Hash every conanfile.txt under the tree (top-level today,
76- # pj_ported_plugins/ in the near future) so the key invalidates
77- # whenever any of them changes.
78- hash=$(find . -name conanfile.txt -not -path './build/*' -not -path './.git/*' \
75+ # Hash every conanfile.{py,txt} under the tree so the key invalidates
76+ # whenever any of them changes. The top-level is now conanfile.py
77+ # (Conan recipe); subtrees like pj_ported_plugins/ still use .txt.
78+ hash=$(find . \( -name 'conanfile.py' -o -name 'conanfile.txt' \) \
79+ -not -path './build/*' -not -path './.git/*' \
7980 -print0 | sort -z | xargs -0 sha256sum | sha256sum | cut -c1-16)
8081 owner="${GITHUB_REPOSITORY_OWNER,,}"
8182 # Build-type suffix leaves room for a future debug-asan variant
8283 # without colliding on the same tag.
8384 tag="ghcr.io/${owner}/plotjuggler-core-conan-cache:linux-gcc-relwithdebinfo-${hash}"
85+ main_tag="ghcr.io/${owner}/plotjuggler-core-conan-cache:linux-gcc-relwithdebinfo-main"
86+ echo "hash=${hash}" >> "${GITHUB_OUTPUT}"
8487 echo "tag=${tag}" >> "${GITHUB_OUTPUT}"
88+ echo "main_tag=${main_tag}" >> "${GITHUB_OUTPUT}"
8589 echo "Cache tag: ${tag}"
90+ echo "Main fallback cache tag: ${main_tag}"
8691
8792 - name : Login to ghcr.io
8893 # Required for both pull (private packages) and push. GITHUB_TOKEN is
@@ -100,23 +105,33 @@ jobs:
100105 shell : bash
101106 run : |
102107 set +e
103- tag="${{ steps.conan_cache.outputs.tag }}"
108+ exact_tag="${{ steps.conan_cache.outputs.tag }}"
109+ main_tag="${{ steps.conan_cache.outputs.main_tag }}"
104110 pull_dir="${RUNNER_TEMP}/conan-cache-pull"
105111 mkdir -p "${pull_dir}"
106- (
107- cd "${pull_dir}"
108- oras pull "${tag}" 2>&1
109- )
110- pulled=$?
111112 tarball="${pull_dir}/conan-cache.tar.zst"
112- if [ "${pulled}" -eq 0 ] && [ -f "${tarball}" ]; then
113- echo "Cache HIT: extracting ${tarball}"
114- mkdir -p "${HOME}/.conan2"
115- tar --zstd -xf "${tarball}" -C "${HOME}"
116- echo "CONAN_CACHE_HIT=1" >> "${GITHUB_ENV}"
117- else
118- echo "Cache MISS for ${tag} (cold start or first build of this conanfile)"
119- fi
113+
114+ for tag in "${exact_tag}" "${main_tag}"; do
115+ rm -f "${tarball}"
116+ echo "Trying Conan cache: ${tag}"
117+ (
118+ cd "${pull_dir}"
119+ oras pull "${tag}" 2>&1
120+ )
121+ pulled=$?
122+ if [ "${pulled}" -eq 0 ] && [ -f "${tarball}" ]; then
123+ echo "Cache HIT: extracting ${tarball}"
124+ mkdir -p "${HOME}/.conan2"
125+ tar --zstd -xf "${tarball}" -C "${HOME}"
126+ echo "CONAN_CACHE_HIT=1" >> "${GITHUB_ENV}"
127+ echo "CONAN_CACHE_HIT_TAG=${tag}" >> "${GITHUB_ENV}"
128+ if [ "${tag}" = "${exact_tag}" ]; then
129+ echo "CONAN_CACHE_EXACT_HIT=1" >> "${GITHUB_ENV}"
130+ fi
131+ exit 0
132+ fi
133+ echo "Cache MISS for ${tag}"
134+ done
120135 # Always exit 0 — a missing tag is not a CI failure.
121136 exit 0
122137
@@ -128,17 +143,18 @@ jobs:
128143 cache : ' true'
129144
130145 - name : Install system packages
131- run : sudo apt-get update && sudo apt-get install -y xvfb ccache zstd
146+ run : sudo apt-get update && sudo apt-get install -y xvfb ccache ninja-build zstd
132147
133148 - name : Configure ccache
134149 # Compiler-output cache for our own C++ — complementary to the Conan
135150 # cache (which holds prebuilt third-party packages, not our objects).
136151 uses : actions/cache@v4
137152 with :
138153 path : ~/.cache/ccache
139- key : ccache-linux-${{ github.ref_name }}-${{ github.sha }}
154+ key : ccache-linux-relwithdebinfo- ${{ steps.conan_cache.outputs.hash }}-${{ github.sha }}
140155 restore-keys : |
141- ccache-linux-${{ github.ref_name }}-
156+ ccache-linux-relwithdebinfo-${{ steps.conan_cache.outputs.hash }}-
157+ ccache-linux-relwithdebinfo-
142158 ccache-linux-
143159
144160 - name : Set ccache limits
@@ -147,15 +163,19 @@ jobs:
147163 ccache --set-config=compression=true
148164 ccache -z
149165
150- - name : Build
151- run : ./build.sh
166+ - name : Conan install
167+ run : >
168+ conan install . --output-folder=build --build=missing
169+ -s build_type=RelWithDebInfo -s compiler.cppstd=20
170+ -o "plotjuggler_core/*:with_tests=True"
171+ -o "plotjuggler_core/*:with_parquet_example=False"
152172
153173 - name : Save Conan cache to ghcr.io
154174 # Only push from the canonical repo on real pushes (forks lack write
155- # access to ghcr.io packages). Skip on cache HIT — the tag content is
156- # already up to date, no point re-uploading the same bytes. Skip if
175+ # access to ghcr.io packages). Skip on exact cache HIT — the tag content
176+ # is already up to date, no point re-uploading the same bytes. Skip if
157177 # neither oras install path succeeded (graceful degradation).
158- if : github.event_name == 'push' && github.repository == 'PlotJuggler/plotjuggler_core' && env.CONAN_CACHE_HIT != '1' && (steps.setup_oras.outcome == 'success' || steps.setup_oras_fallback.outcome == 'success')
178+ if : github.event_name == 'push' && github.repository == 'PlotJuggler/plotjuggler_core' && env.CONAN_CACHE_EXACT_HIT != '1' && (steps.setup_oras.outcome == 'success' || steps.setup_oras_fallback.outcome == 'success')
159179 shell : bash
160180 run : |
161181 set -euo pipefail
@@ -175,11 +195,26 @@ jobs:
175195 (
176196 cd "${RUNNER_TEMP}"
177197 oras push "${tag}" "conan-cache.tar.zst:application/vnd.oci.image.layer.v1.tar+zstd"
198+ if [ "${GITHUB_REF_NAME}" = "main" ]; then
199+ oras push "${{ steps.conan_cache.outputs.main_tag }}" "conan-cache.tar.zst:application/vnd.oci.image.layer.v1.tar+zstd"
200+ fi
178201 )
179202
203+ - name : Configure
204+ run : >
205+ cmake -S . -B build -G Ninja
206+ -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/build/conan_toolchain.cmake
207+ -DCMAKE_BUILD_TYPE=RelWithDebInfo
208+ -DCMAKE_C_COMPILER_LAUNCHER=ccache
209+ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
210+ -DPJ_BUILD_PARQUET_IMPORT_EXAMPLE=OFF
211+
212+ - name : Build
213+ run : cmake --build build
214+
180215 - name : ccache stats
181216 if : always()
182217 run : ccache -s
183218
184219 - name : Test
185- run : xvfb-run -a ./ test.sh
220+ run : xvfb-run -a ctest -- test-dir build --output-on-failure
0 commit comments