-
Notifications
You must be signed in to change notification settings - Fork 414
156 lines (132 loc) · 3.91 KB
/
dot-net.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: dot-net
on:
push:
branches:
- dot-net
tags:
- '*'
release:
types:
- published
workflow_dispatch:
inputs:
release:
description: "Whether to release"
type: boolean
env:
RELEASE:
|- # Release if there is a release tag name or a release flag in workflow_dispatch
${{ github.event.release.tag_name != '' || github.event.inputs.release == 'true' }}
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-* cp36-* *-win32 pp* *-musllinux* *-manylinux_i686"
CIBW_BUILD_VERBOSITY: 3
CIBW_ENVIRONMENT_LINUX: LD_LIBRARY_PATH='/project/build/bdist.linux-x86_64/wheel/sherpa_onnx/lib'
CIBW_REPAIR_WHEEL_COMMAND_MACOS: ""
- 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 .
- name: Unzip macOS wheels
shell: bash
run: |
cd macos
unzip ./*.whl
tree .
- name: Unzip Windows wheels
shell: bash
run: |
cd windows
unzip ./*.whl
tree .
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
- name: Setup .NET 7.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 7.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-onnx' || github.repository == 'k2-fsa/sherpa-onnx'
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.onnx.*.nupkg --skip-duplicate --api-key $API_KEY --source https://api.nuget.org/v3/index.json
- name: Release nuget packages
if: env.RELEASE == 'true'
uses: svenstaro/upload-release-action@v2
with:
file_glob: true
overwrite: true
file: scripts/dotnet/packages/*.nupkg