Skip to content

Commit eaa387f

Browse files
committed
add test-opencvsharp
1 parent 940fe83 commit eaa387f

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Test-OpenCvSharp
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths: [ '.github/workflows/test-opencvsharp.yml' ]
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
name: Test OpenCvSharp
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Download OpenCvSharp Artifacts
16+
env:
17+
GH_TOKEN: ${{ github.token }}
18+
run: |
19+
echo "Fetching lastest run of opencvsharp.yml on branch ${GITHUB_REF_NAME}"
20+
RUN_ID=$(gh run list --workflow=opencvsharp.yml --branch=${GITHUB_REF_NAME} --status=success --limit=1 --json databaseId | jq -r '.[0].databaseId')
21+
echo "Latest opencvsharp run ID: $RUN_ID"
22+
echo "Downloading artifact 'opencvsharp' from run ${RUN_ID}"
23+
gh run download $RUN_ID --name opencvsharp-linux-x64 --dir opencvsharp
24+
ls -lR opencvsharp
25+
26+
- name: Create test.c
27+
run: |
28+
mkdir test && cd test && echo '#include <stdio.h>
29+
int core_Mat_sizeof();
30+
int main()
31+
{
32+
int i = core_Mat_sizeof();
33+
printf("sizeof(Mat) = %d\n", i);
34+
return 0;
35+
}' > test.c
36+
37+
- name: Build Test
38+
run: |
39+
cd test
40+
gcc test.c -L../opencvsharp/lib -lOpenCvSharpExtern -o test
41+
42+
- name: Run Test
43+
run: |
44+
export LD_LIBRARY_PATH=${{ github.workspace }}/opencvsharp/lib:$LD_LIBRARY_PATH
45+
cd test && ./test
46+
47+
- name: Make artifacts
48+
run: |
49+
mkdir artifacts && cd artifacts
50+
cp -r ../test/* .
51+
ls -lR
52+
53+
- name: Upload Artifacts
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: test-linux-x64
57+
path: artifacts

0 commit comments

Comments
 (0)