csharp-api-test.yaml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. name: swift-api-test
  2. on:
  3. push:
  4. branches:
  5. - master
  6. - csharp-api
  7. paths:
  8. - '.github/workflows/csharp-api-test.yaml'
  9. - '.github/scripts/csharp-api-test.sh'
  10. - 'CMakeLists.txt'
  11. - 'cmake/**'
  12. - 'sherpa-ncnn/csrc/*'
  13. - 'sherpa-ncnn/csharp-api/*'
  14. - 'sherpa-ncnn/c-api/*'
  15. - 'sherpa-ncnn/csharp-api-examples/*'
  16. pull_request:
  17. branches:
  18. - master
  19. paths:
  20. - '.github/workflows/swift-api-test.yaml'
  21. - '.github/scripts/swift-api-test.sh'
  22. - 'CMakeLists.txt'
  23. - 'cmake/**'
  24. - 'sherpa-ncnn/csrc/*'
  25. - 'sherpa-ncnn/csharp-api/*'
  26. - 'sherpa-ncnn/c-api/*'
  27. - 'sherpa-ncnn/csharp-api-examples/*'
  28. concurrency:
  29. group: csharp-api-test-${{ github.ref }}
  30. cancel-in-progress: true
  31. permissions:
  32. contents: read
  33. jobs:
  34. csharp-api-test:
  35. runs-on: ${{ matrix.os }}
  36. name: ${{ matrix.vs-version }}
  37. strategy:
  38. fail-fast: false
  39. matrix:
  40. include:
  41. - vs-version: vs2015
  42. toolset-version: v140
  43. os: windows-2019
  44. - vs-version: vs2017
  45. toolset-version: v141
  46. os: windows-2019
  47. - vs-version: vs2019
  48. toolset-version: v142
  49. os: windows-2022
  50. - vs-version: vs2022
  51. toolset-version: v143
  52. os: windows-2022
  53. steps:
  54. - uses: actions/checkout@v2
  55. with:
  56. fetch-depth: 0
  57. - name: Set up .NET Core
  58. uses: actions/setup-dotnet@v1
  59. with:
  60. dotnet-version: '6.0.x'
  61. include-prerelease: true
  62. - name: Configure CMake
  63. shell: bash
  64. run: |
  65. mkdir build
  66. cd build
  67. cmake \
  68. -T ${{ matrix.toolset-version}},host=x64 \
  69. -A x64 \
  70. -D CMAKE_BUILD_TYPE=Release \
  71. -D BUILD_SHARED_LIBS=ON \
  72. ..
  73. - name: Build sherpa-ncnn for windows
  74. shell: bash
  75. run: |
  76. cd build
  77. cmake --build . --config Release --target sherpa-ncnn-c-api -v
  78. - name: Build C# exe
  79. shell: bash
  80. run: |
  81. export PATH=$PWD/build/bin/Release:$PATH
  82. csc ./csharp-api-examples/WaveReader.cs ./csharp-api-examples/DecodeFile.cs ./sherpa-ncnn/csharp-api/SherpaNcnn.cs
  83. ls -lh ./DecodeFile.exe
  84. ./DecodeFile.exe