try MSYS2_ARG_CONV_EXCL #23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test-OpenCvSharp | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: [ '.github/workflows/test-opencvsharp.yml' ] | |
| workflow_dispatch: | |
| jobs: | |
| ubuntu-test: | |
| name: Test OpenCvSharp | |
| runs-on: ${{ matrix.runs-on }} | |
| defaults: | |
| run: | |
| shell: bash | |
| strategy: | |
| matrix: | |
| include: | |
| - { os: linux, arch: x64, runs-on: ubuntu-22.04 } | |
| - { os: ubuntu.24.04, arch: x64, runs-on: ubuntu-24.04 } | |
| - { os: linux, arch: arm64, runs-on: ubuntu-22.04-arm } | |
| - { os: ubuntu.24.04, arch: arm64, runs-on: ubuntu-24.04-arm } | |
| - { os: win, arch: x64, runs-on: windows-2022 } | |
| - { os: win11, arch: x64, runs-on: windows-2025 } | |
| - { os: win, arch: arm64, runs-on: windows-11-arm } | |
| - { os: osx, arch: x64, runs-on: macos-13 } | |
| - { os: osx, arch: arm64, runs-on: macos-14 } | |
| - { os: osx.15, arch: arm64, runs-on: macos-15 } | |
| steps: | |
| - name: Download OpenCvSharp Artifacts | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| echo "Fetching lastest run of opencvsharp.yml on branch ${{ github.ref_name }}" | |
| 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') | |
| echo "Latest opencvsharp run ID: $RUN_ID" | |
| echo "Downloading artifact 'opencvsharp-${{ matrix.os }}-${{ matrix.arch }}' from run ${RUN_ID}" | |
| gh run download -R ${{ github.repository }} $RUN_ID --name opencvsharp-${{ matrix.os }}-${{ matrix.arch }} --dir opencvsharp | |
| echo "::group::OpenCvSharp Artifacts" | |
| ls -lR opencvsharp | |
| echo "::endgroup::" | |
| - name: Create test.c | |
| run: | | |
| mkdir test && cd test && echo '#include <stdio.h> | |
| int core_Mat_sizeof(); | |
| int main() | |
| { | |
| int i = core_Mat_sizeof(); | |
| printf("sizeof(Mat) = %d\n", i); | |
| return 0; | |
| }' > test.c | |
| cat test.c | |
| - name: Setup MSVC(Windows ARM64 only) | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| if: startsWith(matrix.os, 'win') && matrix.arch == 'arm64' | |
| with: | |
| arch: ${{ matrix.arch }} | |
| - name: Build Test | |
| run: | | |
| cd test | |
| if [[ "${{ matrix.arch }}" == "arm64" && "${{ matrix.os }}" == win* ]]; then | |
| export MSYS2_ARG_CONV_EXCL="*" | |
| cl /EHsc test.c ../opencvsharp/lib/OpenCvSharpExtern.lib /link /OUT:test.exe | |
| else | |
| # For x64 architecture | |
| gcc test.c -L../opencvsharp/lib -lOpenCvSharpExtern -o test.exe | |
| fi | |
| ls -lR | |
| - name: Run Test | |
| run: | | |
| if [[ "${{ matrix.os }}" == osx* ]]; then | |
| export DYLD_LIBRARY_PATH=${{ github.workspace }}/opencvsharp/lib:$DYLD_LIBRARY_PATH | |
| elif [[ "${{ matrix.os }}" == win* ]]; then | |
| export PATH="$(cygpath -u "${{ github.workspace }}/opencvsharp/lib")":$PATH | |
| echo "PATH=$PATH" | |
| else | |
| export LD_LIBRARY_PATH=${{ github.workspace }}/opencvsharp/lib:$LD_LIBRARY_PATH | |
| fi | |
| cd test && ./test.exe | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: test-${{ matrix.os }}-${{ matrix.arch }} | |
| path: test |