Skip to content

Commit 6141299

Browse files
authored
Merge pull request #1845 from shimat/fix_linux_nuget
Fix manylinux NuGet publish date and remove deprecated ubuntu packages
2 parents 7732912 + 4237c5c commit 6141299

7 files changed

+82
-164
lines changed

.github/workflows/manylinux.yml

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,7 @@ jobs:
9696
id: opencv-cache
9797
uses: actions/cache/restore@v5
9898
with:
99-
path: |
100-
${{ github.workspace }}/opencv_artifacts/include
101-
${{ github.workspace }}/opencv_artifacts/lib64
99+
path: ${{ github.workspace }}/opencv_artifacts
102100
key: opencv-${{ env.OPENCV_VERSION }}-manylinux2_28-full-${{ hashFiles('vcpkg.json', 'cmake/opencv_build_options.cmake', 'docker/manylinux/build_static_deps.sh') }}
103101

104102
- name: Configure OpenCV (full)
@@ -150,14 +148,25 @@ jobs:
150148
run: |
151149
cmake --build opencv/build -j 3
152150
cmake --install opencv/build
151+
echo "=== opencv_artifacts layout ==="
152+
find ${GITHUB_WORKSPACE}/opencv_artifacts -name 'OpenCVConfig.cmake' -o -name '*.pc' | head -20
153+
du -sh ${GITHUB_WORKSPACE}/opencv_artifacts/*/
153154
155+
- name: Validate OpenCV install (full)
156+
if: steps.opencv-cache.outputs.cache-hit != 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main'
157+
run: |
158+
config=$(find ${GITHUB_WORKSPACE}/opencv_artifacts -name 'OpenCVConfig.cmake' | head -1)
159+
if [ -z "$config" ]; then
160+
echo "ERROR: OpenCVConfig.cmake not found under opencv_artifacts - install is incomplete."
161+
exit 1
162+
fi
163+
echo "Found: $config"
164+
shell: bash
154165
- name: Save OpenCV cache (full)
155166
if: steps.opencv-cache.outputs.cache-hit != 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main'
156167
uses: actions/cache/save@v5
157168
with:
158-
path: |
159-
${{ github.workspace }}/opencv_artifacts/include
160-
${{ github.workspace }}/opencv_artifacts/lib64
169+
path: ${{ github.workspace }}/opencv_artifacts
161170
key: opencv-${{ env.OPENCV_VERSION }}-manylinux2_28-full-${{ hashFiles('vcpkg.json', 'cmake/opencv_build_options.cmake', 'docker/manylinux/build_static_deps.sh') }}
162171

163172
# -- OpenCvSharpExtern ---------------------------------------------------
@@ -208,9 +217,7 @@ jobs:
208217
id: opencv-cache
209218
uses: actions/cache/restore@v5
210219
with:
211-
path: |
212-
${{ github.workspace }}/opencv_artifacts_slim/include
213-
${{ github.workspace }}/opencv_artifacts_slim/lib64
220+
path: ${{ github.workspace }}/opencv_artifacts_slim
214221
key: opencv-${{ env.OPENCV_VERSION }}-manylinux2_28-slim-${{ hashFiles('cmake/opencv_build_options_slim.cmake') }}
215222

216223
- name: Configure OpenCV (slim)
@@ -231,14 +238,25 @@ jobs:
231238
run: |
232239
cmake --build opencv/build -j 3
233240
cmake --install opencv/build
241+
echo "=== opencv_artifacts_slim layout ==="
242+
find ${GITHUB_WORKSPACE}/opencv_artifacts_slim -name 'OpenCVConfig.cmake' -o -name '*.pc' | head -20
243+
du -sh ${GITHUB_WORKSPACE}/opencv_artifacts_slim/*/
234244
235245
- name: Save OpenCV cache (slim)
246+
if: steps.opencv-cache.outputs.cache-hit != 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main'
247+
run: |
248+
config=$(find ${GITHUB_WORKSPACE}/opencv_artifacts_slim -name 'OpenCVConfig.cmake' | head -1)
249+
if [ -z "$config" ]; then
250+
echo "ERROR: OpenCVConfig.cmake not found under opencv_artifacts_slim - install is incomplete."
251+
exit 1
252+
fi
253+
echo "Found: $config"
254+
shell: bash
255+
- name: Save OpenCV cache (slim) - upload
236256
if: steps.opencv-cache.outputs.cache-hit != 'true' && github.event_name == 'push' && github.ref == 'refs/heads/main'
237257
uses: actions/cache/save@v5
238258
with:
239-
path: |
240-
${{ github.workspace }}/opencv_artifacts_slim/include
241-
${{ github.workspace }}/opencv_artifacts_slim/lib64
259+
path: ${{ github.workspace }}/opencv_artifacts_slim
242260
key: opencv-${{ env.OPENCV_VERSION }}-manylinux2_28-slim-${{ hashFiles('cmake/opencv_build_options_slim.cmake') }}
243261

244262
- name: Build OpenCvSharpExtern (slim)

.github/workflows/publish_nuget.yml

Lines changed: 48 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,6 @@ jobs:
1818
name: packages_windows
1919
branch: ${{ github.ref_name }}
2020

21-
- name: Download ubuntu 22 artifact
22-
uses: dawidd6/action-download-artifact@v14
23-
with:
24-
github_token: ${{secrets.GITHUB_TOKEN}}
25-
workflow: ubuntu.yml
26-
name: artifacts_ubuntu_22.04
27-
branch: ${{ github.ref_name }}
28-
29-
- name: Download ubuntu 24 artifact
30-
uses: dawidd6/action-download-artifact@v14
31-
with:
32-
github_token: ${{secrets.GITHUB_TOKEN}}
33-
workflow: ubuntu.yml
34-
name: artifacts_ubuntu_24.04
35-
branch: ${{ github.ref_name }}
36-
37-
- name: Download ubuntu 22 slim artifact
38-
uses: dawidd6/action-download-artifact@v14
39-
with:
40-
github_token: ${{secrets.GITHUB_TOKEN}}
41-
workflow: ubuntu-slim.yml
42-
name: artifacts_ubuntu_slim_22.04
43-
branch: ${{ github.ref_name }}
44-
45-
- name: Download ubuntu 24 slim artifact
46-
uses: dawidd6/action-download-artifact@v14
47-
with:
48-
github_token: ${{secrets.GITHUB_TOKEN}}
49-
workflow: ubuntu-slim.yml
50-
name: artifacts_ubuntu_slim_24.04
51-
branch: ${{ github.ref_name }}
52-
5321
- name: Download ubuntu arm artifact
5422
uses: dawidd6/action-download-artifact@v14
5523
with:
@@ -74,6 +42,14 @@ jobs:
7442
name: artifacts_wasm
7543
branch: ${{ github.ref_name }}
7644

45+
- name: Download manylinux artifact
46+
uses: dawidd6/action-download-artifact@v14
47+
with:
48+
github_token: ${{secrets.GITHUB_TOKEN}}
49+
workflow: manylinux.yml
50+
name: nuget-packages-manylinux
51+
branch: ${{ github.ref_name }}
52+
7753
- run: |
7854
ls -l
7955
@@ -154,5 +130,43 @@ jobs:
154130

155131
- name: Push to nuget.org
156132
run: |
157-
dotnet nuget push "*.nupkg" -k ${{secrets.NUGET_ORG_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate
158-
dotnet nuget push "*.snupkg" -k ${{secrets.NUGET_ORG_API_KEY}} -s https://api.nuget.org/v3/index.json --skip-duplicate
133+
set -euo pipefail
134+
135+
pushed=0
136+
failed=0
137+
138+
push_package() {
139+
local file="$1"
140+
local name
141+
name=$(basename "$file")
142+
local output
143+
if output=$(dotnet nuget push "$file" \
144+
-k ${{secrets.NUGET_ORG_API_KEY}} \
145+
-s https://api.nuget.org/v3/index.json 2>&1); then
146+
echo "PUSHED: $name"
147+
echo "| \`$name\` | ✅ Pushed |" >> $GITHUB_STEP_SUMMARY
148+
pushed=$((pushed + 1))
149+
else
150+
echo "FAILED: $name"
151+
echo "$output"
152+
echo "| \`$name\` | ❌ Failed |" >> $GITHUB_STEP_SUMMARY
153+
failed=$((failed + 1))
154+
fi
155+
}
156+
157+
echo "## Push Results" >> $GITHUB_STEP_SUMMARY
158+
echo "| Package | Status |" >> $GITHUB_STEP_SUMMARY
159+
echo "|---------|--------|" >> $GITHUB_STEP_SUMMARY
160+
161+
for f in *.nupkg *.snupkg; do
162+
[ -f "$f" ] || continue
163+
push_package "$f"
164+
done
165+
166+
echo "" >> $GITHUB_STEP_SUMMARY
167+
echo "**Pushed:** $pushed **Failed:** $failed" >> $GITHUB_STEP_SUMMARY
168+
169+
if [ "$failed" -gt 0 ]; then
170+
echo "ERROR: $failed package(s) failed to push."
171+
exit 1
172+
fi

docs/docfx/articles/intro.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ Install OpenCvSharp via NuGet Package Manager:
2424
dotnet add package OpenCvSharp4
2525

2626
# Native bindings (choose one based on your platform)
27-
dotnet add package OpenCvSharp4.runtime.win # Windows
28-
+# dotnet add package OpenCvSharp4.runtime.win.slim # Windows slim
29-
dotnet add package OpenCvSharp4.official.runtime.ubuntu.24.04-x64 # Ubuntu 24.04
30-
# dotnet add package OpenCvSharp4.official.runtime.ubuntu.24.04-x64.slim # Ubuntu 24.04 slim
27+
dotnet add package OpenCvSharp4.runtime.win # Windows
28+
# dotnet add package OpenCvSharp4.runtime.win.slim # Windows slim
29+
dotnet add package OpenCvSharp4.official.runtime.linux-x64 # Linux x64
30+
# dotnet add package OpenCvSharp4.official.runtime.linux-x64.slim # Linux x64 slim
3131
```
3232

3333
### Quick Example

nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.csproj

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

nuget/OpenCvSharp4.official.runtime.ubuntu.22.04-x64.slim.csproj

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

nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.csproj

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

nuget/OpenCvSharp4.official.runtime.ubuntu.24.04-x64.slim.csproj

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

0 commit comments

Comments
 (0)