205 lines
4.7 KiB
YAML
205 lines
4.7 KiB
YAML
name: test-dot-net
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- '.github/workflows/test-dot-net.yaml'
|
|
- 'cmake/**'
|
|
- 'sherpa-onnx/csrc/*'
|
|
- 'dotnet-examples/**'
|
|
- 'scripts/dotnet/**'
|
|
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- '.github/workflows/test-dot-net.yaml'
|
|
- 'cmake/**'
|
|
- 'sherpa-onnx/csrc/*'
|
|
- 'dotnet-examples/**'
|
|
- 'scripts/dotnet/**'
|
|
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: test-dot-net-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
build-libs:
|
|
name: ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
python-version: ["3.8"]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: ccache
|
|
uses: hendrikmuhs/ccache-action@v1.2
|
|
with:
|
|
key: ${{ matrix.os }}-dotnet-release-shared
|
|
|
|
- name: Build sherpa-onnx
|
|
shell: bash
|
|
run: |
|
|
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
|
|
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH"
|
|
cmake --version
|
|
|
|
mkdir build
|
|
cd build
|
|
cmake \
|
|
-DBUILD_SHARED_LIBS=ON \
|
|
-DCMAKE_INSTALL_PREFIX=./install \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
-DSHERPA_ONNX_ENABLE_WEBSOCKET=OFF \
|
|
-DBUILD_ESPEAK_NG_EXE=OFF \
|
|
-DSHERPA_ONNX_ENABLE_BINARY=OFF \
|
|
..
|
|
|
|
cmake --build . --target install --config Release
|
|
|
|
rm -rf install/share
|
|
rm -rf install/lib/pkg*
|
|
|
|
ls -lh ./install/lib
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.os }}
|
|
path: ./build/install/lib/
|
|
|
|
test-dot-net:
|
|
runs-on: ${{ matrix.os }}
|
|
needs: [build-libs]
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest]
|
|
python-version: ["3.8"]
|
|
|
|
steps:
|
|
- name: Check space
|
|
shell: bash
|
|
run: |
|
|
df -h
|
|
|
|
- name: Free space
|
|
shell: bash
|
|
run: |
|
|
df -h
|
|
rm -rf /opt/hostedtoolcache
|
|
df -h
|
|
|
|
- name: Free more space
|
|
shell: bash
|
|
run: |
|
|
# https://github.com/orgs/community/discussions/25678
|
|
cd /opt
|
|
find . -maxdepth 1 -mindepth 1 '!' -path ./containerd '!' -path ./actionarchivecache '!' -path ./runner '!' -path ./runner-cache -exec rm -rf '{}' ';'
|
|
|
|
sudo rm -rf /usr/share/dotnet
|
|
sudo rm -rf "/usr/local/share/boost"
|
|
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
|
|
|
|
- name: Free Disk Space (Ubuntu)
|
|
uses: jlumbroso/free-disk-space@main
|
|
with:
|
|
# this might remove tools that are actually needed,
|
|
# if set to "true" but frees about 6 GB
|
|
tool-cache: false
|
|
|
|
# all of these default to true, but feel free to set to
|
|
# "false" if necessary for your workflow
|
|
android: true
|
|
dotnet: false
|
|
haskell: true
|
|
large-packages: true
|
|
docker-images: false
|
|
swap-storage: true
|
|
|
|
- name: Check space
|
|
shell: bash
|
|
run: |
|
|
df -h
|
|
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Install Python dependencies
|
|
shell: bash
|
|
run: |
|
|
python3 -m pip install --upgrade pip Jinja2
|
|
|
|
- name: Retrieve artifact from ubuntu-latest
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: ubuntu-latest
|
|
path: /tmp/linux-x64
|
|
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: 8.0.x
|
|
|
|
- name: Check dotnet
|
|
run: dotnet --info
|
|
|
|
- name: Display files
|
|
shell: bash
|
|
run: |
|
|
echo "----------/tmp----------"
|
|
ls -lh /tmp
|
|
|
|
echo "----------/tmp/linux-x64----------"
|
|
ls -lh /tmp/linux-x64
|
|
df -h
|
|
|
|
- name: Build
|
|
shell: bash
|
|
run: |
|
|
cd scripts/dotnet
|
|
./run.sh
|
|
df -h
|
|
|
|
ls -lh /tmp/packages
|
|
|
|
- name: Copy files
|
|
shell: bash
|
|
run: |
|
|
cp -v scripts/dotnet/examples/Common.csproj dotnet-examples/Common/
|
|
|
|
ls -lh /tmp
|
|
|
|
df -h
|
|
|
|
- name: Run tests
|
|
shell: bash
|
|
run: |
|
|
dotnet nuget locals all --clear
|
|
df -h
|
|
|
|
.github/scripts/test-dot-net.sh
|
|
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: dot-net-tts-generated-test-files-${{ matrix.os }}
|
|
path: tts
|