Skip to content

Commit 70b2ba2

Browse files
committed
2 parents 19b4b56 + e3426d4 commit 70b2ba2

157 files changed

Lines changed: 686 additions & 470 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/docker-appengine.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Cleanup GitHub Actions Cache
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
branch:
7+
description: 'Branch name (leave empty for current branch)'
8+
required: false
9+
type: string
10+
key_pattern:
11+
description: 'Cache key pattern (e.g., buildx, gha, leave empty for all)'
12+
required: false
13+
type: string
14+
max_age_days:
15+
description: 'Delete caches older than N days (0 = all)'
16+
required: false
17+
default: '0'
18+
type: string
19+
20+
jobs:
21+
cleanup:
22+
runs-on: ubuntu-latest
23+
permissions:
24+
actions: write
25+
contents: read
26+
steps:
27+
- name: Cleanup caches
28+
shell: pwsh
29+
run: |
30+
Write-Host "Starting cache cleanup..."
31+
32+
$branch = "${{ github.event.inputs.branch }}"
33+
$keyPattern = "${{ github.event.inputs.key_pattern }}"
34+
$maxAgeDays = "${{ github.event.inputs.max_age_days }}"
35+
36+
# Get cache list
37+
if ($branch) {
38+
Write-Host "Filtering by branch: $branch"
39+
$cacheListJson = gh cache list --repo ${{ github.repository }} --branch $branch --json id,key,createdAt,sizeInBytes --limit 1000
40+
} else {
41+
Write-Host "Getting all caches..."
42+
$cacheListJson = gh cache list --repo ${{ github.repository }} --json id,key,createdAt,sizeInBytes --limit 1000
43+
}
44+
45+
$caches = $cacheListJson | ConvertFrom-Json
46+
47+
# Filter by key pattern if specified
48+
if ($keyPattern) {
49+
Write-Host "Filtering by key pattern: $keyPattern"
50+
$caches = $caches | Where-Object { $_.key -like "*$keyPattern*" }
51+
}
52+
53+
# Filter by age if specified
54+
if ($maxAgeDays -ne "0") {
55+
$cutoffDate = (Get-Date).AddDays(-[int]$maxAgeDays).ToUniversalTime()
56+
Write-Host "Filtering caches older than: $($cutoffDate.ToString('yyyy-MM-ddTHH:mm:ssZ'))"
57+
$caches = $caches | Where-Object { [DateTime]::Parse($_.createdAt) -lt $cutoffDate }
58+
}
59+
60+
$cacheCount = $caches.Count
61+
Write-Host "Found $cacheCount caches to delete"
62+
63+
if ($cacheCount -eq 0) {
64+
Write-Host "No caches to delete"
65+
exit 0
66+
}
67+
68+
# Calculate total size
69+
$totalBytes = ($caches | Measure-Object -Property sizeInBytes -Sum).Sum
70+
$totalSizeMB = [math]::Round($totalBytes / 1MB, 2)
71+
$totalSizeGB = [math]::Round($totalBytes / 1GB, 2)
72+
73+
# Display summary
74+
Write-Host "`n========== DELETION SUMMARY =========="
75+
Write-Host "Total caches to delete: $cacheCount"
76+
Write-Host "Total size: $totalSizeMB MB ($totalSizeGB GB)"
77+
Write-Host "======================================`n"
78+
79+
# Display cache details
80+
Write-Host "Caches to be deleted:"
81+
Write-Host ("{0,-60} {1,-20} {2,10}" -f "Key", "Last Updated", "Size (MB)")
82+
Write-Host ("{0,-60} {1,-20} {2,10}" -f "---", "------------", "---------")
83+
84+
$displayCount = [Math]::Min(20, $cacheCount)
85+
for ($i = 0; $i -lt $displayCount; $i++) {
86+
$cache = $caches[$i]
87+
$sizeMB = [math]::Round($cache.sizeInBytes / 1MB, 2)
88+
$lastUpdate = [DateTime]::Parse($cache.createdAt).ToString("yyyy-MM-dd HH:mm")
89+
$keyDisplay = if ($cache.key.Length -gt 57) { $cache.key.Substring(0, 54) + "..." } else { $cache.key }
90+
Write-Host ("{0,-60} {1,-20} {2,10}" -f $keyDisplay, $lastUpdate, $sizeMB)
91+
}
92+
93+
if ($cacheCount -gt 20) {
94+
Write-Host "... and $($cacheCount - 20) more caches"
95+
}
96+
97+
# Delete caches
98+
Write-Host "`nDeleting caches..."
99+
$deleted = 0
100+
$failed = 0
101+
$deletedSize = 0
102+
103+
foreach ($cache in $caches) {
104+
try {
105+
gh cache delete $cache.id --repo ${{ github.repository }} 2>&1 | Out-Null
106+
if ($LASTEXITCODE -eq 0) {
107+
$deleted++
108+
$deletedSize += $cache.sizeInBytes
109+
Write-Host "✓ Deleted: $($cache.key.Substring(0, [Math]::Min(50, $cache.key.Length)))"
110+
} else {
111+
$failed++
112+
Write-Host "✗ Failed: $($cache.key.Substring(0, [Math]::Min(50, $cache.key.Length)))"
113+
}
114+
} catch {
115+
$failed++
116+
Write-Host "✗ Failed: $($cache.key.Substring(0, [Math]::Min(50, $cache.key.Length)))"
117+
}
118+
}
119+
120+
# Final summary
121+
$deletedSizeMB = [math]::Round($deletedSize / 1MB, 2)
122+
$deletedSizeGB = [math]::Round($deletedSize / 1GB, 2)
123+
124+
Write-Host "`n========== CLEANUP COMPLETE =========="
125+
Write-Host "Successfully deleted: $deleted caches"
126+
Write-Host "Failed: $failed caches"
127+
Write-Host "Total freed space: $deletedSizeMB MB ($deletedSizeGB GB)"
128+
Write-Host "======================================"
129+
env:
130+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/docfx.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ jobs:
1313

1414
steps:
1515
- name: Checkout
16-
uses: actions/checkout@v4
16+
uses: actions/checkout@v6
1717
with:
1818
fetch-depth: 1
1919

2020
- name: Install .NET
21-
uses: actions/setup-dotnet@v3
21+
uses: actions/setup-dotnet@v5
2222
with:
2323
dotnet-version: 8.0.x
2424

.github/workflows/docker-deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
env:
1111
DEBIAN_FRONTEND: noninteractive
12-
DOCKER_IMAGE_NAME1: "ubuntu24-dotnet8-opencv4.12.0"
12+
DOCKER_IMAGE_NAME1: "ubuntu24-dotnet10-opencv4.13.0"
1313

1414
jobs:
1515
build:
@@ -27,7 +27,7 @@ jobs:
2727
exit 1
2828
fi
2929
30-
- uses: actions/checkout@v4
30+
- uses: actions/checkout@v6
3131
with:
3232
fetch-depth: 1
3333

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Docker Test
2+
3+
on:
4+
pull_request:
5+
types: [synchronize, opened]
6+
7+
env:
8+
DEBIAN_FRONTEND: noninteractive
9+
OPENCV_VERSION: 4.13.0
10+
DOCKER_BUILD_CONTEXT: ./docker/ubuntu24-dotnet10-opencv4.13.0
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
timeout-minutes: 60
16+
17+
steps:
18+
- uses: actions/checkout@v6
19+
20+
- uses: docker/setup-buildx-action@v3
21+
22+
- name: Build with Docker
23+
uses: docker/build-push-action@v6
24+
with:
25+
context: ${{ env.DOCKER_BUILD_CONTEXT }}
26+
build-args: |
27+
OPENCV_VERSION=${{ env.OPENCV_VERSION }}
28+
OPENCVSHARP_REF=${{ github.head_ref || github.ref_name }}
29+
outputs: type=docker,name=shimat/ubuntu24-dotnet10-opencv4.13.0:latest
30+
cache-from: |
31+
type=gha,scope=${{ github.ref_name }}
32+
type=gha,scope=main
33+
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}

.github/workflows/docker-ubuntu.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/workflows/linux-arm.yml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Linux ARM (Docker)
1+
name: Linux ARM
22

33
on:
44
pull_request:
@@ -9,36 +9,36 @@ on:
99

1010
env:
1111
DEBIAN_FRONTEND: noninteractive
12-
OPENCV_VERSION: 4.12.0
12+
OPENCV_VERSION: 4.13.0
13+
DOCKER_BUILD_CONTEXT: ./docker/ubuntu24-dotnet10-opencv4.13.0
1314

1415
jobs:
1516
build:
16-
runs-on: ubuntu-latest
17+
runs-on: ubuntu-24.04-arm
1718
steps:
18-
- uses: actions/checkout@v4
19-
20-
- uses: docker/setup-qemu-action@v3
19+
- uses: actions/checkout@v6
2120

2221
- uses: docker/setup-buildx-action@v3
23-
with:
24-
install: true
2522

2623
# Build with Buildx and cache Docker layers in GitHub Actions cache
27-
- name: Build with Docker (cached)
24+
- name: Build with Docker (native ARM64)
2825
uses: docker/build-push-action@v6
2926
with:
30-
context: ./docker/ubuntu24-dotnet8-opencv4.12.0
31-
platforms: linux/arm64
27+
context: ${{ env.DOCKER_BUILD_CONTEXT }}
3228
build-args: |
3329
OPENCV_VERSION=${{ env.OPENCV_VERSION }}
34-
# Load the built image to local Docker for later docker create/cp
30+
OPENCVSHARP_REF=${{ github.head_ref || github.ref_name }}
3531
outputs: type=docker,name=opencvsharp-linux-arm:latest
36-
cache-from: type=gha
37-
cache-to: type=gha,mode=max
32+
# Use branch-specific cache keys to avoid using stale code from other branches
33+
cache-from: |
34+
type=gha,scope=${{ github.ref_name }}
35+
type=gha,scope=main
36+
# Save cache with branch-specific scope
37+
cache-to: type=gha,mode=max,scope=${{ github.ref_name }}
3838

3939
- name: Extract build files from Docker instance
4040
run: |
41-
docker create -ti --name opencvsharp-linux-arm-tmp opencvsharp-linux-arm bash
41+
docker create -ti --name opencvsharp-linux-arm-tmp opencvsharp-linux-arm:latest bash
4242
docker cp opencvsharp-linux-arm-tmp:/artifacts .
4343
4444
- name: Patch nuspec with version and build NuGet package

.github/workflows/macos10.yml.disabled

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: macos-11
1818

1919
steps:
20-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v6
2121
with:
2222
fetch-depth: 1
2323

@@ -27,7 +27,7 @@ jobs:
2727

2828
# - name: Cache OpenCV
2929
# id: opencv-cache
30-
# uses: actions/cache@v3
30+
# uses: actions/cache@v5
3131
# with:
3232
# path: ${{ github.workspace }}/opencv_macos/
3333
# key: opencv-${{ env.OPENCV_VERSION }}-macos-rev1
@@ -104,7 +104,7 @@ jobs:
104104
LD_LIBRARY_PATH=. ./test
105105

106106
- name: Install .NET
107-
uses: actions/setup-dotnet@v3
107+
uses: actions/setup-dotnet@v5
108108
with:
109109
dotnet-version: '6.0.x'
110110

@@ -128,14 +128,14 @@ jobs:
128128
run: |
129129
cd ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests
130130
# ls
131-
dotnet build -c Release -f net6.0
132-
cp ${GITHUB_WORKSPACE}/nuget/libOpenCvSharpExtern.dylib ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests/bin/Release/net6.0/
131+
dotnet build -c Release -f net8.0
132+
cp ${GITHUB_WORKSPACE}/nuget/libOpenCvSharpExtern.dylib ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests/bin/Release/net8.0/
133133
cp ${GITHUB_WORKSPACE}/nuget/libOpenCvSharpExtern.dylib ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests/
134-
# ls ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests/bin/Release/net6.0/
134+
# ls ${GITHUB_WORKSPACE}/test/OpenCvSharp.Tests/bin/Release/net8.0/
135135
# ls
136136
sudo cp ${GITHUB_WORKSPACE}/nuget/libOpenCvSharpExtern.dylib /usr/local/lib/
137137
LD_LIBRARY_PATH=.
138-
dotnet test OpenCvSharp.Tests.csproj -c Release -f net6.0 --runtime osx-x64 --logger "trx;LogFileName=test-results.trx" < /dev/null
138+
dotnet test OpenCvSharp.Tests.csproj -c Release -f net8.0 --runtime osx-x64 --logger "trx;LogFileName=test-results.trx" < /dev/null
139139
ls
140140
ls TestResults
141141

.github/workflows/publish_nuget.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ on:
55

66
jobs:
77
Publish:
8-
runs-on: ubuntu-22.04
8+
runs-on: ubuntu-24.04
99

1010
steps:
11-
- uses: actions/checkout@v4
11+
- uses: actions/checkout@v6
1212

1313
- name: Download windows artifact
1414
uses: dawidd6/action-download-artifact@v6
@@ -49,7 +49,7 @@ jobs:
4949
ls -l
5050
5151
- name: Install .NET
52-
uses: actions/setup-dotnet@v4
52+
uses: actions/setup-dotnet@v5
5353
with:
5454
dotnet-version: 8.0.x
5555

0 commit comments

Comments
 (0)