Skip to content

Commit

Permalink
Fix building nuget packages (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj authored May 4, 2023
1 parent 3c3109a commit a2cb232
Show file tree
Hide file tree
Showing 16 changed files with 318 additions and 430 deletions.
76 changes: 0 additions & 76 deletions .github/workflows/dot-net-linux.yaml

This file was deleted.

77 changes: 0 additions & 77 deletions .github/workflows/dot-net-macos.yaml

This file was deleted.

82 changes: 0 additions & 82 deletions .github/workflows/dot-net-windows-x64.yaml

This file was deleted.

136 changes: 136 additions & 0 deletions .github/workflows/dot-net.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
name: dot-net

on:
push:
branches:
- dot-net
tags:
- '*'

concurrency:
group: dot-net-${{ github.ref }}
cancel-in-progress: true

jobs:
build-libs:
name: dot-net for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v2
# see https://cibuildwheel.readthedocs.io/en/stable/changelog/
# for a list of versions
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BEFORE_BUILD: "pip install -U cmake numpy"
CIBW_BUILD: "cp38-*64"
CIBW_SKIP: "cp27-* cp35-* *-win32 pp* *-musllinux*"
CIBW_BUILD_VERBOSITY: 3

- name: Display wheels
shell: bash
run: |
ls -lh ./wheelhouse/*.whl
unzip -l ./wheelhouse/*.whl
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}-wheels
path: ./wheelhouse/*.whl

build-nuget-packages:
name: build-nuget-packages
runs-on: ubuntu-latest
needs: build-libs

steps:
- uses: actions/checkout@v2

- name: Retrieve artifact from ubuntu-latest
uses: actions/download-artifact@v2
with:
name: ubuntu-latest-wheels
path: ./linux

- name: Retrieve artifact from macos-latest
uses: actions/download-artifact@v2
with:
name: macos-latest-wheels
path: ./macos

- name: Retrieve artifact from windows-latest
uses: actions/download-artifact@v2
with:
name: windows-latest-wheels
path: ./windows

- name: Display wheels
shell: bash
run: |
tree .
- name: Unzip Ubuntu wheels
shell: bash
run: |
cd linux
unzip ./*.whl
tree .
cp -v sherpa_ncnn.libs/libgomp-a34b3233.so.1.0.0 sherpa_ncnn/lib
- name: Unzip macOS wheels
shell: bash
run: |
cd macos
unzip ./*.whl
tree .
- name: Unzip Windows wheels
shell: bash
run: |
cd windows
unzip ./*.whl
cp -v ./ncnn.dll sherpa_ncnn/lib/
cp -v ./sherpa-ncnn-core.dll sherpa_ncnn/lib/
tree .
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x

- name: Setup .NET 6.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x

- name: Check dotnet
run: dotnet --info

- name: build nuget packages
shell: bash
run: |
cd scripts/dotnet
./run.sh
ls -lh packages
- uses: actions/upload-artifact@v2
name: upload nuget packages
with:
name: nuget-packages
path: scripts/dotnet/packages/*.nupkg

- name: publish .Net packages to nuget.org
if: github.repository == 'csukuangfj/sherpa-ncnn' || github.repository == 'k2-fsa/sherpa-ncnn'
shell: bash
env:
API_KEY: ${{ secrets.NUGET_API_KEY }}
run: |
# API_KEY is valid until 2024.05.02
cd scripts/dotnet/packages
dotnet nuget push ./org.k2fsa.sherpa.ncnn.*.nupkg --skip-duplicate --api-key $API_KEY --source https://api.nuget.org/v3/index.json
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.13 FATAL_ERROR)
project(sherpa-ncnn)

set(SHERPA_NCNN_VERSION "1.8.6")
set(SHERPA_NCNN_VERSION "1.9.0")

# Disable warning about
#
Expand Down Expand Up @@ -40,7 +40,6 @@ option(SHERPA_NCNN_ENABLE_JNI "Whether to build JNI internface" OFF)
option(SHERPA_NCNN_ENABLE_BINARY "Whether to build the binary sherpa-ncnn" ON)
option(SHERPA_NCNN_ENABLE_TEST "Whether to build tests" OFF)
option(SHERPA_NCNN_ENABLE_C_API "Whether to build C API" ON)
option(SHERPA_NCNN_ENABLE_DOT_NET_API "Whether to build .Net API" OFF)
option(SHERPA_NCNN_ENABLE_GENERATE_INT8_SCALE_TABLE "Whether to generate-int8-scale-table" ON)
option(SHERPA_NCNN_ENABLE_FFMPEG_EXAMPLES "Whether to enable ffmpeg-examples" OFF)

Expand All @@ -62,7 +61,6 @@ message(STATUS "SHERPA_NCNN_ENABLE_JNI ${SHERPA_NCNN_ENABLE_JNI}")
message(STATUS "SHERPA_NCNN_ENABLE_BINARY ${SHERPA_NCNN_ENABLE_BINARY}")
message(STATUS "SHERPA_NCNN_ENABLE_TEST ${SHERPA_NCNN_ENABLE_TEST}")
message(STATUS "SHERPA_NCNN_ENABLE_C_API ${SHERPA_NCNN_ENABLE_C_API}")
message(STATUS "SHERPA_NCNN_ENABLE_DOT_NET_API ${SHERPA_NCNN_ENABLE_DOT_NET_API}")
message(STATUS "SHERPA_NCNN_ENABLE_GENERATE_INT8_SCALE_TABLE ${SHERPA_NCNN_ENABLE_GENERATE_INT8_SCALE_TABLE}")
message(STATUS "SHERPA_NCNN_ENABLE_FFMPEG_EXAMPLES ${SHERPA_NCNN_ENABLE_FFMPEG_EXAMPLES}")

Expand Down
Loading

0 comments on commit a2cb232

Please sign in to comment.