Skip to content

Commit 05ea890

Browse files
authored
Merge pull request #133 from sdcb/feature/linux
Feature/linux
2 parents ba5f6d0 + 6fd3b0e commit 05ea890

Some content is hidden

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

42 files changed

+603
-703
lines changed

.github/workflows/build-native-nuget.yml

Lines changed: 8 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ env:
1616

1717
jobs:
1818
build-all:
19-
runs-on: ${{ startsWith(matrix.rid, 'osx') && 'macos-13' || 'ubuntu-22.04' }}
19+
runs-on: ubuntu-22.04
2020
strategy:
2121
matrix:
2222
include:
@@ -36,12 +36,12 @@ jobs:
3636
- { title: win64.cu129_cudnn910_sm86, rid: win-x64, action: paddle-build.yml, artifact: windows-2022_c_cu129_cudnn910_sm86 }
3737
- { title: win64.cu129_cudnn910_sm89, rid: win-x64, action: paddle-build.yml, artifact: windows-2022_c_cu129_cudnn910_sm89 }
3838
- { title: win64.cu129_cudnn910_sm120, rid: win-x64, action: paddle-build.yml, artifact: windows-2022_c_cu129_cudnn910_sm120 }
39-
- { title: linux64.openblas, rid: linux-x64, action: paddle-build.yml, artifact: ubuntu-22.04_c_openblas }
40-
- { title: linux64.mkl, rid: linux-x64, action: paddle-build.yml, artifact: ubuntu-22.04_c_mkldnn }
41-
- { title: linux64.openvino, rid: linux-x64, action: paddle-build.yml, artifact: ubuntu-22.04_c_openvino }
42-
- { title: linux-arm64.openblas, rid: linux-arm64, action: paddle-build.yml, artifact: ubuntu-22.04-arm_c_openblas }
43-
- { title: osx-x64.openblas, rid: osx-x64, action: paddle-build.yml, artifact: macos-13_c_openblas }
44-
- { title: osx-arm64.openblas, rid: osx-arm64, action: paddle-build.yml, artifact: macos-15_c_openblas }
39+
- { title: linux-x64.openblas, rid: linux-x64, action: paddle-build.yml, artifact: ubuntu-22.04_c_openblas }
40+
- { title: linux-x64.mkl, rid: linux-x64, action: paddle-build.yml, artifact: ubuntu-22.04_c_mkldnn }
41+
- { title: linux-x64, rid: linux-x64, action: paddle-build.yml, artifact: ubuntu-22.04_c_openvino }
42+
- { title: linux-arm64, rid: linux-arm64, action: paddle-build.yml, artifact: ubuntu-22.04-arm_c_openblas }
43+
- { title: osx-x64, rid: osx-x64, action: paddle-build.yml, artifact: macos-13_c_openblas }
44+
- { title: osx-arm64, rid: osx-arm64, action: paddle-build.yml, artifact: macos-15_c_openblas }
4545

4646

4747
steps:
@@ -81,46 +81,6 @@ jobs:
8181
fi
8282
8383
ls -l nuget
84-
85-
- name: Patch RPATH / install-name for Paddle
86-
shell: bash
87-
run: |
88-
set -e
89-
echo "RID=${{ matrix.rid }}"
90-
91-
case "${{ matrix.rid }}" in
92-
93-
# ---------- Linux (x86_64 / aarch64) ----------
94-
linux-*)
95-
echo "Before:"
96-
patchelf --print-rpath nuget/libpaddle_inference_c.so || true
97-
98-
patchelf --set-rpath '$ORIGIN' nuget/libpaddle_inference_c.so
99-
100-
echo "After :"
101-
patchelf --print-rpath nuget/libpaddle_inference_c.so
102-
;;
103-
104-
# ---------- macOS (x86_64 / arm64) ----------
105-
osx-*)
106-
dylib=nuget/libpaddle_inference_c.dylib
107-
108-
echo "Before:"
109-
otool -l "$dylib" | grep -A2 LC_RPATH || true
110-
111-
install_name_tool -id @rpath/$(basename "$dylib") "$dylib"
112-
install_name_tool -add_rpath @loader_path "$dylib" 2>/dev/null || true
113-
114-
echo "After :"
115-
otool -l "$dylib" | grep -A2 LC_RPATH
116-
;;
117-
118-
*)
119-
echo "no rpath patch needed for ${{ matrix.rid }}"
120-
;;
121-
esac
122-
123-
echo "RPATH / LC_RPATH patched successfully."
12484
12585
- name: Build NuGet package
12686
run: |
@@ -138,16 +98,7 @@ jobs:
13898
NUGET_LIB_DIR="${{ github.workspace }}/nuget"
13999
140100
LIB_PATHS=()
141-
142-
if command -v mapfile >/dev/null 2>&1; then
143-
# Bash ≥4(Linux runner)
144-
mapfile -t LIB_PATHS < <(find "$NUGET_LIB_DIR" -type f -print)
145-
else
146-
# Bash 3.x(macOS runner)
147-
while IFS= read -r -d '' f; do
148-
LIB_PATHS+=("$f")
149-
done < <(find "$NUGET_LIB_DIR" -type f -print0)
150-
fi
101+
mapfile -t LIB_PATHS < <(find "$NUGET_LIB_DIR" -type f -print)
151102
152103
if [ ${#LIB_PATHS[@]} -eq 0 ]; then
153104
echo "Error: no native libs found in $NUGET_LIB_DIR"

.github/workflows/main.yml

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
1-
name: main
1+
name: main
22
on:
33
push:
44
branches:
55
- master
6+
- feature/linux
67
paths:
7-
- 'src/**'
8+
- src/**
9+
- tests/**
810
- .github/workflows/main.yml
911
workflow_dispatch:
1012

11-
1213
jobs:
13-
windows:
14-
runs-on: windows-latest
14+
run:
15+
runs-on: ${{ matrix.runs-on }}
16+
strategy:
17+
matrix:
18+
runs-on: [windows-2022, ubuntu-22.04, ubuntu-22.04-arm, macos-13, macos-15]
1519
steps:
16-
- uses: actions/checkout@v4
17-
- name: Build code
18-
run: dotnet build -c Release
19-
- name: Test
20-
run: dotnet test -c Release --no-build --verbosity normal
21-
# linux-ubuntu:
22-
# runs-on: ubuntu-latest
23-
# container: sdflysha/dotnet6sdk-paddle:2.5.0-ubuntu22
24-
# steps:
25-
# - uses: actions/checkout@v3
26-
# - name: Build code
27-
# run: dotnet build -c Release
28-
# - name: Test
29-
# run: dotnet test -c Release --no-build --verbosity normal --filter "Category!=LinuxExclude"
20+
- uses: actions/checkout@v4
21+
- name: Setup NuGet Source
22+
run: |
23+
dotnet nuget add source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" --name github --username ${{ github.repository_owner }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text
24+
dotnet nuget list source
25+
26+
- name: Build code
27+
run: dotnet build -c Debug -p:Optimize=true
28+
29+
- name: Test
30+
shell: bash
31+
run: |
32+
dotnet test -c Debug --no-build --verbosity normal -p:Optimize=true --filter 'Category!=WindowsOnly'
33+
# dotnet test ./tests/Sdcb.PaddleOCR.Tests/Sdcb.PaddleOCR.Tests.csproj -c Debug --no-build --verbosity normal --filter 'FullyQualifiedName~OnlineModelsTest'

0 commit comments

Comments
 (0)