-
-
Notifications
You must be signed in to change notification settings - Fork 50
214 lines (209 loc) · 9.65 KB
/
build.yml
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
name: Build
on:
push:
branches: [ build ]
pull_request:
branches: [ build ]
workflow_dispatch:
# gh api repos/:owner/:repo/actions/workflows/build.yml/dispatches -F ref=master
jobs:
build-macos:
runs-on: macos-10.15
if: true
env:
MACOSX_DEPLOYMENT_TARGET: 10.9
# MKL_URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/tec/17172/m_mkl_2020.4.301.dmg
steps:
- uses: actions/checkout@v2
- name: Get KALDI_BRANCH (kag-$TAG tag if commit is tagged; current branch name if not)
run: |
export TAG=$(git tag --points-at HEAD)
if [[ $TAG ]]; then
echo "KALDI_BRANCH=kag-$TAG" >> $GITHUB_ENV
else
echo "KALDI_BRANCH=${GITHUB_REF/refs\/heads\//}" >> $GITHUB_ENV
fi
- name: Dependencies
run: |
python3 -m pip install --upgrade setuptools wheel scikit-build cmake ninja
brew install automake
brew install autoconf
brew install sox
brew install libtool
brew reinstall gfortran # for openblas
- name: MKL
if: ${{ env.MKL_URL != 0 }}
run: |
echo "Installing MKL from: $MKL_URL"
export MKL_FILE=${MKL_URL##*/}
export MKL_FILE=${MKL_FILE%\.dmg}
wget --no-verbose $MKL_URL
hdiutil attach ${MKL_FILE}.dmg
cp /Volumes/${MKL_FILE}/${MKL_FILE}.app/Contents/MacOS/silent.cfg .
sed -i.bak -e 's/decline/accept/g' silent.cfg
sudo /Volumes/${MKL_FILE}/${MKL_FILE}.app/Contents/MacOS/install.sh --silent silent.cfg
- run: |
python3 setup.py bdist_wheel
ls -al dist/
- uses: actions/upload-artifact@v2
with:
name: wheels
path: dist/*
build-linux:
runs-on: ubuntu-18.04
if: true
# env:
# MKL_URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/tec/16917/l_mkl_2020.4.304.tgz
steps:
- uses: actions/checkout@v2
- name: Get KALDI_BRANCH (kag-$TAG tag if commit is tagged; current branch name if not)
run: |
export TAG=$(git tag --points-at HEAD)
echo "TAG: $TAG"
if [[ $TAG ]]; then
echo "KALDI_BRANCH=kag-$TAG" >> $GITHUB_ENV
else
echo "KALDI_BRANCH=${GITHUB_REF/refs\/heads\//}" >> $GITHUB_ENV
fi
- name: Setup just
run: |
ls -al $HOME
mkdir $HOME/bin
curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to $HOME/bin/
echo "$HOME/bin" >> $GITHUB_PATH
- run: |
echo "KALDI_BRANCH: $KALDI_BRANCH"
echo "MKL_URL: $MKL_URL"
just build-dockcross $KALDI_BRANCH $MKL_URL
# cp dist/* wheelhouse/
ls -al wheelhouse/
- uses: actions/upload-artifact@v2
with:
name: wheels
path: wheelhouse/*
build-windows:
runs-on: windows-2019
if: true
env:
MKL_URL: https://registrationcenter-download.intel.com/akdlm/irc_nas/tec/17173/w_mkl_2020.4.311.exe
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v2
with:
path: main
- name: Get KALDI_BRANCH (kag-$TAG tag if commit is tagged; current branch name if not)
run: |
export TAG=$(git tag --points-at HEAD)
if [[ $TAG ]]; then
echo "KALDI_BRANCH=kag-$TAG" >> $GITHUB_ENV
else
echo "KALDI_BRANCH=${GITHUB_REF/refs\/heads\//}" >> $GITHUB_ENV
fi
- uses: actions/checkout@v2
with:
repository: daanzu/openfst
path: openfst
- uses: actions/checkout@v2
with:
repository: daanzu/kaldi-fork-active-grammar
path: kaldi
ref: ${{ env.KALDI_BRANCH }}
- name: Gather information
run: |
echo $GITHUB_WORKSPACE
df -h
ls -al '/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Redist/MSVC/'
# ls -al '/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Redist/MSVC/14.26.28720'
ls -al '/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Redist/MSVC/v142'
# ls -al '/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Redist/MSVC/14.16.27012/x64/Microsoft.VC141.CRT'
ls -al '/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Redist/MSVC/'*/x64/Microsoft.*.CRT
# ls -alR /c/Program\ Files\ \(x86\)/Microsoft Visual Studio/2019/Enterprise/VC/Redist/MSVC/
# ls -alR '/c/Program Files (x86)/Microsoft Visual Studio/'2019/Enterprise/VC/Redist/MSVC/
vswhere
vswhere -find 'VC\Redist\**\VC_redist.x64.exe'
- name: Setup Kaldi build configuration
run: |
cd kaldi/windows
cp kaldiwin_mkl.props kaldiwin.props
# Add MKL static libraries to build
perl -pi -e 's/<AdditionalDependencies>.*<\/AdditionalDependencies>/<AdditionalDependencies>mkl_sequential.lib;mkl_intel_thread.lib;mkl_core.lib;mkl_intel_lp64.lib;%(AdditionalDependencies)<\/AdditionalDependencies>/g' kaldiwin.props
cp variables.props.dev variables.props
# Add openfst location
perl -pi -e 's/<OPENFST>.*<\/OPENFST>/<OPENFST>$ENV{GITHUB_WORKSPACE}\\openfst<\/OPENFST>/g' variables.props
perl -pi -e 's/<OPENFSTLIB>.*<\/OPENFSTLIB>/<OPENFSTLIB>$ENV{GITHUB_WORKSPACE}\\openfst\\build_output<\/OPENFSTLIB>/g' variables.props
perl generate_solution.pl --vsver vs2019 --enable-mkl --noportaudio
# Add additional libfstscript library to dragonfly build file
sed -i.bak '$i\
<ItemDefinitionGroup>\
<Link>\
<AdditionalDependencies>libfstscript.lib;%(AdditionalDependencies)</AdditionalDependencies>\
</Link>\
</ItemDefinitionGroup>' ../kaldiwin_vs2019_MKL/kaldiwin/kaldi-dragonfly/kaldi-dragonfly.vcxproj
perl get_version.pl
- name: Add msbuild to PATH
uses: microsoft/[email protected]
# - run: |
# setx VCTargetsPath "C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140" /M
# shell: cmd
# find /c -name 'MSBuild.exe'
# - run: |
# rem dir "C:\Program Files (x86)\"
# vswhere.exe -find VC\Redist\**\VC_redist.x64.exe
# zzzzz
# shell: cmd
- name: Install MKL
if: ${{ env.MKL_URL != 0 }}
run: |
echo "MKL_URL: $MKL_URL"
mkdir -p mkl
cd mkl
curl -s $MKL_URL > mkl.exe
ls -al
./mkl.exe --s --a install --output=$GITHUB_WORKSPACE/mkl/output.txt --eula=accept
cat output.txt
# continue-on-error: true
# installdir=
- name: Build OpenFST
run: msbuild -t:Build -p:Configuration=Release -p:Platform=x64 -p:PlatformToolset=v141 -maxCpuCount -verbosity:minimal openfst/openfst.sln
shell: cmd
- name: Build Kaldi
run: |
msbuild -t:Build -p:Configuration=Release -p:Platform=x64 -p:PlatformToolset=v141 -p:WindowsTargetPlatformVersion=10.0.16299.0 -maxCpuCount -verbosity:minimal kaldi/kaldiwin_vs2019_MKL/kaldiwin/kaldi-dragonfly/kaldi-dragonfly.vcxproj
msbuild -t:Build -p:Configuration=Release -p:Platform=x64 -p:PlatformToolset=v141 -p:WindowsTargetPlatformVersion=10.0.16299.0 -maxCpuCount -verbosity:minimal kaldi/kaldiwin_vs2019_MKL/kaldiwin/compile-graph-agf/compile-graph-agf.vcxproj
msbuild -t:Build -p:Configuration=Release -p:Platform=x64 -p:PlatformToolset=v141 -p:WindowsTargetPlatformVersion=10.0.16299.0 -maxCpuCount -verbosity:minimal kaldi/kaldiwin_vs2019_MKL/kaldiwin/fstaddselfloops/fstaddselfloops.vcxproj
shell: cmd
# msbuild -t:Build -p:Configuration=Release -p:Platform=x64 -p:PlatformToolset=v141 -p:WindowsTargetPlatformVersion=10.0.16299.0 -maxCpuCount -verbosity:minimal kaldi/kaldiwin_vs2019_MKL/kaldiwin_vs2019.sln
# set
# call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64
# which msbuild.exe
# set VCTargetsPath=C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\v140
# set
# "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\amd64\MSBuild.exe"
# dotenv openfst/openfst.sln /build "Release|x64"
# dotenv kaldi/kaldiwin_vs2019_MKL/kaldiwin_vs2019.sln /build "Release|x64"
- name: Build Python wheel
run: |
cd main
python -m pip -V
python -m pip install --upgrade setuptools wheel scikit-build cmake ninja
# ls -alR ../
mkdir -p kaldi_active_grammar/exec/windows
cp ../kaldi/kaldiwin_vs2019_MKL/kaldiwin/kaldi-dragonfly/x64/Release/kaldi-dragonfly.dll kaldi_active_grammar/exec/windows/
# ../openfst/build_output/x64/Release/bin/{fstarcsort,fstcompile,fstinfo}.exe ../kaldi/kaldiwin_vs2019_MKL/kaldiwin/compile-graph-agf/x64/Release/compile-graph-agf.exe ../kaldi/kaldiwin_vs2019_MKL/kaldiwin/fstaddselfloops/x64/Release/fstaddselfloops.exe
env KALDIAG_SETUP_RAW=1 python setup.py bdist_wheel
ls -al dist/
- uses: actions/upload-artifact@v2
with:
name: wheels
path: main/dist/*
# - name: Copy Windows vc_redist
# run: |
# mkdir -p vc_redist
# cp '/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Redist/MSVC/14.26.28720'/vc_redist.x64.exe vc_redist/
# cp '/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Redist/MSVC/14.26.28720'/x64/Microsoft.*.CRT/* vc_redist/
# - uses: actions/upload-artifact@v2
# with:
# name: vc_redist
# path: vc_redist/*