Conversation
📝 WalkthroughWalkthroughMultiple GitHub Actions workflows were changed: OPENCV_CACHE_VERSION was removed and cache keys simplified across several workflows; ubuntu and ubuntu-slim workflows now target Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.github/workflows/linux-arm.yml (1)
56-56: Add automatic cache invalidation to the OpenCV cache key.The cache key at lines 56 and 127 only varies by OpenCV version. Unlike other workflows in this repository (e.g.,
ubuntu.ymlincludesmatrix.ubuntu,wasm.ymlincludesenv.EM_VERSION), this workflow lacks additional differentiators. If build options or workflow logic change under the same OPENCV_VERSION, stale binaries will be restored.Consider using:
- key: opencv-arm-${{ env.OPENCV_VERSION }} + key: opencv-arm-${{ env.OPENCV_VERSION }}-${{ hashFiles('.github/workflows/linux-arm.yml') }} + restore-keys: | + opencv-arm-${{ env.OPENCV_VERSION }}-Apply the same change to both the restore step (line 56) and save step (line 127).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/linux-arm.yml at line 56, The cache key currently uses only "key: opencv-arm-${{ env.OPENCV_VERSION }}" which can restore stale artifacts when build options change; update both the restore and save cache steps that reference this key (the lines with key: opencv-arm-${{ env.OPENCV_VERSION }}) to include an additional differentiator such as a build-options hash or a workflow/environment variable (for example append env.BUILD_FLAGS, matrix entries, or GITHUB_SHA/GITHUB_RUN_NUMBER) so the cache key changes whenever relevant build settings or the commit change, ensuring automatic invalidation of stale OpenCV caches.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In @.github/workflows/linux-arm.yml:
- Line 56: The cache key currently uses only "key: opencv-arm-${{
env.OPENCV_VERSION }}" which can restore stale artifacts when build options
change; update both the restore and save cache steps that reference this key
(the lines with key: opencv-arm-${{ env.OPENCV_VERSION }}) to include an
additional differentiator such as a build-options hash or a workflow/environment
variable (for example append env.BUILD_FLAGS, matrix entries, or
GITHUB_SHA/GITHUB_RUN_NUMBER) so the cache key changes whenever relevant build
settings or the commit change, ensuring automatic invalidation of stale OpenCV
caches.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
.github/workflows/docker-test-ubuntu.yml.github/workflows/linux-arm.yml.github/workflows/ubuntu-slim.yml.github/workflows/ubuntu.yml.github/workflows/wasm.yml
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/linux-arm.yml:
- Around line 56-58: The cache restore/save keys are mismatched: align the
restore key prefix and saved key format so restore can hit the saved cache by
making the restore key use the same full pattern as the save key (opencv-arm-${{
env.OPENCV_VERSION }}-${{ hashFiles(...) }} and keep restore-keys prefix
opencv-arm-${{ env.OPENCV_VERSION }}-); also change the hashFiles argument to
point at the checked-out repo path used by checkout (use
opencvsharp/.github/workflows/linux-arm.yml instead of
.github/workflows/linux-arm.yml) so the calculated hash matches the saved key;
update both occurrences (the restore key block and the save cache key) to use
the identical pattern.
| key: opencv-arm-${{ env.OPENCV_VERSION }}-${{ hashFiles('.github/workflows/linux-arm.yml') }} | ||
| restore-keys: | | ||
| opencv-arm-${{ env.OPENCV_VERSION }}- |
There was a problem hiding this comment.
Align restore/save cache keys; current keys won’t produce cache hits.
Line 56/58 and Line 129 use incompatible key formats (...-<hash>/...- vs ...<version>), so the saved cache key won’t be restored. Also, because checkout uses path: opencvsharp (Line 22), hashFiles('.github/workflows/linux-arm.yml') is likely hashing the wrong path.
Suggested fix
- name: Restore OpenCV cache
id: opencv-cache
uses: actions/cache/restore@v5
with:
path: ${{ github.workspace }}/opencv_artifacts/
- key: opencv-arm-${{ env.OPENCV_VERSION }}-${{ hashFiles('.github/workflows/linux-arm.yml') }}
+ key: opencv-arm-${{ env.OPENCV_VERSION }}-${{ hashFiles('opencvsharp/.github/workflows/linux-arm.yml') }}
restore-keys: |
opencv-arm-${{ env.OPENCV_VERSION }}-
@@
- name: Save OpenCV cache
if: steps.opencv-cache.outputs.cache-hit != 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/cache/save@v5
with:
path: ${{ github.workspace }}/opencv_artifacts/
- key: opencv-arm-${{ env.OPENCV_VERSION }}
+ key: opencv-arm-${{ env.OPENCV_VERSION }}-${{ hashFiles('opencvsharp/.github/workflows/linux-arm.yml') }}#!/bin/bash
set -euo pipefail
file=".github/workflows/linux-arm.yml"
echo "Inspecting cache key lines..."
awk 'NR>=50 && NR<=132 {print NR ":" $0}' "$file"
echo
echo "Expected after fix:"
echo "- Restore key == Save key"
echo "- restore-keys prefix remains: opencv-arm-\${{ env.OPENCV_VERSION }}-"
echo "- hashFiles path points to: opencvsharp/.github/workflows/linux-arm.yml"Also applies to: 129-129
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/linux-arm.yml around lines 56 - 58, The cache restore/save
keys are mismatched: align the restore key prefix and saved key format so
restore can hit the saved cache by making the restore key use the same full
pattern as the save key (opencv-arm-${{ env.OPENCV_VERSION }}-${{ hashFiles(...)
}} and keep restore-keys prefix opencv-arm-${{ env.OPENCV_VERSION }}-); also
change the hashFiles argument to point at the checked-out repo path used by
checkout (use opencvsharp/.github/workflows/linux-arm.yml instead of
.github/workflows/linux-arm.yml) so the calculated hash matches the saved key;
update both occurrences (the restore key block and the save cache key) to use
the identical pattern.
Summary by CodeRabbit