Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docker-test-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
cache-from: |
type=gha,scope=${{ github.ref_name }}
type=gha,scope=main
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}
cache-to: type=gha,mode=min,scope=${{ github.ref_name }}
7 changes: 4 additions & 3 deletions .github/workflows/linux-arm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
env:
DEBIAN_FRONTEND: noninteractive
OPENCV_VERSION: 4.13.0
OPENCV_CACHE_VERSION: 1

jobs:
build:
Expand Down Expand Up @@ -54,7 +53,9 @@ jobs:
uses: actions/cache/restore@v5
with:
path: ${{ github.workspace }}/opencv_artifacts/
key: opencv-arm-${{ env.OPENCV_VERSION }}-rev${{ env.OPENCV_CACHE_VERSION }}
key: opencv-arm-${{ env.OPENCV_VERSION }}-${{ hashFiles('.github/workflows/linux-arm.yml') }}
restore-keys: |
opencv-arm-${{ env.OPENCV_VERSION }}-
Comment on lines +56 to +58
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

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.


- name: Checkout OpenCV
if: steps.opencv-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -125,7 +126,7 @@ jobs:
uses: actions/cache/save@v5
with:
path: ${{ github.workspace }}/opencv_artifacts/
key: opencv-arm-${{ env.OPENCV_VERSION }}-rev${{ env.OPENCV_CACHE_VERSION }}
key: opencv-arm-${{ env.OPENCV_VERSION }}

- name: Build OpenCvSharpExtern
run: |
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/ubuntu-slim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
env:
DEBIAN_FRONTEND: noninteractive
OPENCV_VERSION: 4.13.0
OPENCV_CACHE_VERSION: 1

jobs:
build_test:
Expand Down Expand Up @@ -50,8 +49,10 @@ jobs:
id: opencv-cache
uses: actions/cache/restore@v5
with:
path: ${{ github.workspace }}/opencv_artifacts_slim/
key: opencv-${{ env.OPENCV_VERSION }}-ubuntu-${{ matrix.ubuntu }}-slim-rev${{ env.OPENCV_CACHE_VERSION }}
path: |
${{ github.workspace }}/opencv_artifacts_slim/include
${{ github.workspace }}/opencv_artifacts_slim/lib
key: opencv-${{ env.OPENCV_VERSION }}-ubuntu-${{ matrix.ubuntu }}-slim

- name: Checkout OpenCV
if: steps.opencv-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -131,8 +132,10 @@ jobs:
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_slim/
key: opencv-${{ env.OPENCV_VERSION }}-ubuntu-${{ matrix.ubuntu }}-slim-rev${{ env.OPENCV_CACHE_VERSION }}
path: |
${{ github.workspace }}/opencv_artifacts_slim/include
${{ github.workspace }}/opencv_artifacts_slim/lib
key: opencv-${{ env.OPENCV_VERSION }}-ubuntu-${{ matrix.ubuntu }}-slim

- name: Build OpenCvSharpExtern (slim)
run: |
Expand Down
13 changes: 8 additions & 5 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
env:
DEBIAN_FRONTEND: noninteractive
OPENCV_VERSION: 4.13.0
OPENCV_CACHE_VERSION: 2

jobs:
build_test:
Expand Down Expand Up @@ -61,8 +60,10 @@ jobs:
id: opencv-cache
uses: actions/cache/restore@v5
with:
path: ${{ github.workspace }}/opencv_artifacts/
key: opencv-${{ env.OPENCV_VERSION }}-ubuntu-${{ matrix.ubuntu }}-rev${{ env.OPENCV_CACHE_VERSION }}
path: |
${{ github.workspace }}/opencv_artifacts/include
${{ github.workspace }}/opencv_artifacts/lib
key: opencv-${{ env.OPENCV_VERSION }}-ubuntu-${{ matrix.ubuntu }}

- name: Checkout OpenCV
if: steps.opencv-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -132,8 +133,10 @@ jobs:
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-${{ env.OPENCV_VERSION }}-ubuntu-${{ matrix.ubuntu }}-rev${{ env.OPENCV_CACHE_VERSION }}
path: |
${{ github.workspace }}/opencv_artifacts/include
${{ github.workspace }}/opencv_artifacts/lib
key: opencv-${{ env.OPENCV_VERSION }}-ubuntu-${{ matrix.ubuntu }}

- name: Build OpenCvSharpExtern
run: |
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
env:
DEBIAN_FRONTEND: noninteractive
OPENCV_VERSION: 4.13.0
OPENCV_CACHE_VERSION: 1
EM_VERSION: 4.0.23
EM_CACHE_FOLDER: 'emsdk-cache'

Expand Down Expand Up @@ -59,7 +58,7 @@ jobs:
uses: actions/cache/restore@v5
with:
path: ${{ github.workspace }}/opencv_wasm/
key: opencv-${{ env.OPENCV_VERSION }}-wasm-${{ env.EM_VERSION }}-rev${{ env.OPENCV_CACHE_VERSION }}
key: opencv-${{ env.OPENCV_VERSION }}-wasm-${{ env.EM_VERSION }}

- name: Setup Emscripten cache
id: cache-system-libraries
Expand Down Expand Up @@ -140,7 +139,7 @@ jobs:
uses: actions/cache/save@v5
with:
path: ${{ github.workspace }}/opencv_wasm/
key: opencv-${{ env.OPENCV_VERSION }}-wasm-${{ env.EM_VERSION }}-rev${{ env.OPENCV_CACHE_VERSION }}
key: opencv-${{ env.OPENCV_VERSION }}-wasm-${{ env.EM_VERSION }}

- name: Build OpenCvSharpExtern
run: |
Expand Down
Loading