Skip to content

Commit 68e6fbe

Browse files
committed
add centos7 test
1 parent c6c38a2 commit 68e6fbe

File tree

1 file changed

+45
-2
lines changed

1 file changed

+45
-2
lines changed

.github/workflows/test-opencvsharp.yml

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
workflow_dispatch:
88

99
jobs:
10-
build:
10+
ubuntu-test:
1111
name: Test OpenCvSharp
1212
runs-on: ${{ matrix.os }}
1313

@@ -53,4 +53,47 @@ jobs:
5353
uses: actions/upload-artifact@v4
5454
with:
5555
name: test-linux-x64-${{ matrix.os }}
56-
path: test
56+
path: test
57+
58+
centos7-test:
59+
name: Test OpenCvSharp on CentOS7
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/checkout@v3
63+
64+
- name: Download OpenCvSharp Artifact
65+
env:
66+
GH_TOKEN: ${{ github.token }}
67+
run: |
68+
echo "Fetching latest run of opencvsharp.yml on branch ${{ github.ref_name }}"
69+
RUN_ID=$(gh run list -R ${{ github.repository }} --workflow=opencvsharp.yml --branch=${{ github.ref_name }} --status=success --limit=1 --json databaseId | jq -r '.[0].databaseId')
70+
echo "Latest opencvsharp run ID: $RUN_ID"
71+
echo "Downloading artifact 'opencvsharp-linux-x64-ubuntu-20.04' from run ${RUN_ID}"
72+
gh run download -R ${{ github.repository }} $RUN_ID --name opencvsharp-linux-x64-ubuntu-20.04 --dir opencvsharp
73+
ls -lR opencvsharp
74+
75+
- name: Create test.c
76+
run: |
77+
mkdir -p test && cd test && echo '#include <stdio.h>
78+
int core_Mat_sizeof();
79+
int main()
80+
{
81+
int i = core_Mat_sizeof();
82+
printf("sizeof(Mat) = %d\n", i);
83+
return 0;
84+
}' > test.c
85+
cat test.c
86+
87+
- name: Build and Run Test in CentOS7 Docker Container
88+
run: |
89+
docker run --rm \
90+
-v ${{ github.workspace }}/opencvsharp:/opencvsharp \
91+
-v ${{ github.workspace }}/test:/test \
92+
centos:7 \
93+
bash -c "yum install -y gcc && cd /test && gcc test.c -L/opencvsharp/lib -lOpenCvSharpExtern -o test && export LD_LIBRARY_PATH=/opencvsharp/lib && ./test"
94+
95+
- name: Upload Artifacts
96+
uses: actions/upload-artifact@v4
97+
with:
98+
name: test-linux-x64-centos7
99+
path: test

0 commit comments

Comments
 (0)