Skip to content
This repository was archived by the owner on Jun 19, 2025. It is now read-only.

Commit 6af0ce8

Browse files
authored
Merge pull request #3585 from lissyx/github-actions-py-node-tests
Fix #3578: Re-instate Python TF/TFLite tests on GitHub Actions / macOS
2 parents e0e775a + e6f3b8e commit 6af0ce8

22 files changed

+441
-14
lines changed

.github/actions/node-build/action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,17 @@ runs:
2929
- run: |
3030
npm update
3131
shell: bash
32+
- run: |
33+
mkdir -p tmp/headers/nodejs tmp/headers/electronjs
34+
shell: bash
3235
- run: |
3336
for node in ${{ inputs.nodejs_versions }}; do
3437
EXTRA_CFLAGS=${{ inputs.local_cflags }} \
3538
EXTRA_LDFLAGS=${{ inputs.local_ldflags }} \
3639
EXTRA_LIBS=${{ inputs.local_libs }} \
3740
make -C native_client/javascript \
3841
NODE_ABI_TARGET=--target=${node} \
42+
NODE_DEVDIR=--devdir=tmp/headers/nodejs/${node} \
3943
clean node-wrapper
4044
done;
4145
shell: bash
@@ -48,6 +52,7 @@ runs:
4852
NODE_ABI_TARGET=--target=${electron} \
4953
NODE_DIST_URL=--disturl=https://electronjs.org/headers \
5054
NODE_RUNTIME=--runtime=electron \
55+
NODE_DEVDIR=--devdir=tmp/headers/electronjs/${electron} \
5156
clean node-wrapper
5257
done;
5358
shell: bash
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
name: "C++ tests"
2-
description: "Running C++ binary tests"
1+
name: "Tests execution"
2+
description: "Running DeepSpeech tests"
33
inputs:
4+
runtime:
5+
description: "Runtime to use for running test"
6+
required: true
47
build-flavor:
58
description: "Running against TF or TFLite"
69
required: true
@@ -23,5 +26,6 @@ runs:
2326
if [ "${{ inputs.model-kind }}" = "prod" ]; then
2427
model_kind="-prod"
2528
fi
26-
./ci_scripts/cpp${build}-ds-tests${model_kind}.sh ${{ inputs.bitrate }}
29+
30+
./ci_scripts/${{ inputs.runtime }}${build}-tests${model_kind}.sh ${{ inputs.bitrate }}
2731
shell: bash

.github/workflows/macOS-amd64.yml

Lines changed: 146 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ jobs:
8989
runs-on: macos-10.15
9090
strategy:
9191
matrix:
92-
build-flavor: ["tf", "tflite"]
9392
bitrate: ["8k", "16k"]
9493
steps:
9594
- uses: actions/checkout@v2
@@ -124,14 +123,11 @@ jobs:
124123
mv data/smoke_test/LDC93S1_pcms16le_1_${bits}.wav data/smoke_test/LDC93S1.wav
125124
126125
./bin/run-tc-ldc93s1_new.sh 249 ${bits}
127-
if [ "${{ matrix.build-flavor }}" = "tflite" ]; then
128-
./bin/run-tc-ldc93s1_tflite.sh ${bits}
129-
fi
126+
./bin/run-tc-ldc93s1_tflite.sh ${bits}
130127
- run: |
131128
curl -vsSL https://github.com/mozilla/DeepSpeech/releases/download/v0.9.3/macOS.amd64.convert_graphdef_memmapped_format.xz | xz -d > /tmp/convert_graphdef_memmapped_format
132129
chmod +x /tmp/convert_graphdef_memmapped_format
133130
/tmp/convert_graphdef_memmapped_format --in_graph=/tmp/train/output_graph.pb --out_graph=/tmp/train/output_graph.pbmm
134-
if: matrix.build-flavor == 'tf'
135131
- run: |
136132
tar -cf - \
137133
-C /tmp/ckpt/ . \
@@ -143,11 +139,15 @@ jobs:
143139
ls -hal /tmp/ ${{ github.workspace }}/tmp/
144140
- uses: actions/upload-artifact@v2
145141
with:
146-
name: "test-model.${{ matrix.build-flavor }}-${{ matrix.bitrate }}.zip"
147-
path: ${{ github.workspace }}/tmp/output_graph.*
142+
name: "test-model.tf-${{ matrix.bitrate }}.zip"
143+
path: ${{ github.workspace }}/tmp/output_graph.pb*
144+
- uses: actions/upload-artifact@v2
145+
with:
146+
name: "test-model.tflite-${{ matrix.bitrate }}.zip"
147+
path: ${{ github.workspace }}/tmp/output_graph.tflite
148148
- uses: actions/upload-artifact@v2
149149
with:
150-
name: "test-checkpoint.${{ matrix.build-flavor }}-${{ matrix.bitrate }}.zip"
150+
name: "test-checkpoint.${{ matrix.bitrate }}.zip"
151151
path: ${{ github.workspace }}/tmp/checkpoint.tar.xz
152152
tensorflow_opt-macOS:
153153
name: "Check cache for TensorFlow"
@@ -322,7 +322,7 @@ jobs:
322322
path: ${{ github.workspace }}/native_client/javascript/wrapper.tar.gz
323323
- uses: actions/upload-artifact@v2
324324
with:
325-
name: "deepspeech-${{ matrix.build-flavor }}.tar.gz"
325+
name: "deepspeech-${{ matrix.build-flavor }}.tgz"
326326
path: ${{ github.workspace }}/native_client/javascript/deepspeech-*.tgz
327327
test-cpp-macOS:
328328
name: "Test C++ binary on macOS"
@@ -358,8 +358,144 @@ jobs:
358358
- run: |
359359
ls -hal ${{ env.TASKCLUSTER_TMP_DIR }}/
360360
if: matrix.models == 'test'
361-
- uses: ./.github/actions/cpp-tests
361+
- uses: ./.github/actions/run-tests
362+
with:
363+
runtime: "cpp"
364+
build-flavor: ${{ matrix.build-flavor }}
365+
bitrate: ${{ matrix.bitrate }}
366+
model-kind: ${{ matrix.models }}
367+
test-py-macOS:
368+
name: "Test Python bindings on macOS"
369+
runs-on: macos-10.15
370+
needs: [ build-python-macOS, train-test-model ]
371+
strategy:
372+
matrix:
373+
python-version: [3.6.8, 3.7.9, 3.8.8, 3.9.2]
374+
build-flavor: ["tf", "tflite"]
375+
models: ["test", "prod"]
376+
bitrate: ["8k", "16k"]
377+
env:
378+
TASKCLUSTER_TMP_DIR: ${{ github.workspace }}/tmp/
379+
DEEPSPEECH_PROD_MODEL: https://github.com/reuben/DeepSpeech/releases/download/v0.7.0-alpha.3/output_graph.pb
380+
DEEPSPEECH_PROD_MODEL_MMAP: https://github.com/reuben/DeepSpeech/releases/download/v0.7.0-alpha.3/output_graph.pbmm
381+
DEEPSPEECH_TEST_MODEL: ${{ github.workspace }}/tmp/output_graph.pb
382+
EXPECTED_TENSORFLOW_VERSION: "TensorFlow: v2.3.0-6-g23ad988"
383+
steps:
384+
- uses: actions/checkout@v2
385+
with:
386+
fetch-depth: 1
387+
- uses: actions/setup-python@v2
388+
with:
389+
python-version: ${{ matrix.python-version }}
390+
- uses: actions/download-artifact@v2
391+
with:
392+
name: "deepspeech-${{ matrix.build-flavor }}-${{ matrix.python-version }}.whl"
393+
path: ${{ env.TASKCLUSTER_TMP_DIR }}
394+
- uses: actions/download-artifact@v2
395+
with:
396+
name: "test-model.${{ matrix.build-flavor }}-${{ matrix.bitrate }}.zip"
397+
path: ${{ env.TASKCLUSTER_TMP_DIR }}
398+
if: matrix.models == 'test'
399+
- run: |
400+
ls -hal ${{ env.TASKCLUSTER_TMP_DIR }}/
401+
if: matrix.models == 'test'
402+
- run: |
403+
ls -hal ${{ env.TASKCLUSTER_TMP_DIR }}/
404+
pip3 install --only-binary :all: --upgrade ${{ env.TASKCLUSTER_TMP_DIR }}/deepspeech*.whl
405+
- uses: ./.github/actions/run-tests
406+
with:
407+
runtime: "python"
408+
build-flavor: ${{ matrix.build-flavor }}
409+
bitrate: ${{ matrix.bitrate }}
410+
model-kind: ${{ matrix.models }}
411+
test-nodejs-macOS:
412+
name: "Test NodeJS bindings on macOS"
413+
runs-on: macos-10.15
414+
needs: [ build-nodejs-macOS, train-test-model ]
415+
strategy:
416+
matrix:
417+
nodejs-version: [10, 11, 12, 13, 14, 15]
418+
build-flavor: ["tf", "tflite"]
419+
models: ["test", "prod"]
420+
bitrate: ["8k", "16k"]
421+
env:
422+
TASKCLUSTER_TMP_DIR: ${{ github.workspace }}/tmp/
423+
DEEPSPEECH_PROD_MODEL: https://github.com/reuben/DeepSpeech/releases/download/v0.7.0-alpha.3/output_graph.pb
424+
DEEPSPEECH_PROD_MODEL_MMAP: https://github.com/reuben/DeepSpeech/releases/download/v0.7.0-alpha.3/output_graph.pbmm
425+
DEEPSPEECH_TEST_MODEL: ${{ github.workspace }}/tmp/output_graph.pb
426+
EXPECTED_TENSORFLOW_VERSION: "TensorFlow: v2.3.0-6-g23ad988"
427+
steps:
428+
- uses: actions/checkout@v2
429+
with:
430+
fetch-depth: 1
431+
- uses: actions/setup-node@v2
432+
with:
433+
node-version: ${{ matrix.nodejs-version }}
434+
- uses: actions/download-artifact@v2
435+
with:
436+
name: "deepspeech-${{ matrix.build-flavor }}.tgz"
437+
path: ${{ env.TASKCLUSTER_TMP_DIR }}
438+
- uses: actions/download-artifact@v2
439+
with:
440+
name: "test-model.${{ matrix.build-flavor }}-${{ matrix.bitrate }}.zip"
441+
path: ${{ env.TASKCLUSTER_TMP_DIR }}
442+
if: matrix.models == 'test'
443+
- run: |
444+
ls -hal ${{ env.TASKCLUSTER_TMP_DIR }}/
445+
if: matrix.models == 'test'
446+
- run: |
447+
ls -hal ${{ env.TASKCLUSTER_TMP_DIR }}/
448+
npm install ${{ env.TASKCLUSTER_TMP_DIR }}/deepspeech*.tgz
449+
- uses: ./.github/actions/run-tests
450+
with:
451+
runtime: "node"
452+
build-flavor: ${{ matrix.build-flavor }}
453+
bitrate: ${{ matrix.bitrate }}
454+
model-kind: ${{ matrix.models }}
455+
test-electronjs-macOS:
456+
name: "Test ElectronJS bindings on macOS"
457+
runs-on: macos-10.15
458+
needs: [ build-nodejs-macOS, train-test-model ]
459+
strategy:
460+
matrix:
461+
electronjs-version: [5.0.13, 6.0.12, 6.1.7, 7.0.1, 7.1.8, 8.0.1, 9.0.1, 9.1.0, 9.2.0, 10.0.0, 10.1.0, 11.0.0, 12.0.0]
462+
build-flavor: ["tf", "tflite"]
463+
models: ["test"]
464+
bitrate: ["8k", "16k"]
465+
env:
466+
TASKCLUSTER_TMP_DIR: ${{ github.workspace }}/tmp/
467+
DEEPSPEECH_PROD_MODEL: https://github.com/reuben/DeepSpeech/releases/download/v0.7.0-alpha.3/output_graph.pb
468+
DEEPSPEECH_PROD_MODEL_MMAP: https://github.com/reuben/DeepSpeech/releases/download/v0.7.0-alpha.3/output_graph.pbmm
469+
DEEPSPEECH_TEST_MODEL: ${{ github.workspace }}/tmp/output_graph.pb
470+
EXPECTED_TENSORFLOW_VERSION: "TensorFlow: v2.3.0-6-g23ad988"
471+
steps:
472+
- uses: actions/checkout@v2
473+
with:
474+
fetch-depth: 1
475+
- uses: actions/setup-node@v2
476+
with:
477+
node-version: 12
478+
- uses: actions/download-artifact@v2
479+
with:
480+
name: "deepspeech-${{ matrix.build-flavor }}.tgz"
481+
path: ${{ env.TASKCLUSTER_TMP_DIR }}
482+
- uses: actions/download-artifact@v2
483+
with:
484+
name: "test-model.${{ matrix.build-flavor }}-${{ matrix.bitrate }}.zip"
485+
path: ${{ env.TASKCLUSTER_TMP_DIR }}
486+
if: matrix.models == 'test'
487+
- run: |
488+
ls -hal ${{ env.TASKCLUSTER_TMP_DIR }}/
489+
if: matrix.models == 'test'
490+
- run: |
491+
ls -hal ${{ env.TASKCLUSTER_TMP_DIR }}/
492+
npm install ${{ env.TASKCLUSTER_TMP_DIR }}/deepspeech*.tgz
493+
- run: |
494+
npm install electron@${{ matrix.electronjs-version }}
495+
- uses: ./.github/actions/run-tests
362496
with:
497+
runtime: "electronjs"
363498
build-flavor: ${{ matrix.build-flavor }}
364499
bitrate: ${{ matrix.bitrate }}
365500
model-kind: ${{ matrix.models }}
501+
timeout-minutes: 5

ci_scripts/all-utils.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,13 @@ verify_bazel_rebuild()
106106
exit 1
107107
fi;
108108
}
109+
110+
symlink_electron()
111+
{
112+
ln -s Electron.app/Contents/MacOS/Electron node_modules/electron/dist/node
113+
}
114+
115+
export_node_bin_path()
116+
{
117+
export PATH=$(pwd)/node_modules/.bin/:$(pwd)/node_modules/electron/dist/:$PATH
118+
}

ci_scripts/asserts.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ run_prod_concurrent_stream_tests()
432432
local _bitrate=$1
433433

434434
set +e
435-
output=$(python ${TASKCLUSTER_TMP_DIR}/test_sources/concurrent_streams.py \
435+
output=$(python3 ${TASKCLUSTER_TMP_DIR}/test_sources/concurrent_streams.py \
436436
--model ${TASKCLUSTER_TMP_DIR}/${model_name_mmap} \
437437
--scorer ${TASKCLUSTER_TMP_DIR}/kenlm.scorer \
438438
--audio1 ${TASKCLUSTER_TMP_DIR}/LDC93S1_pcms16le_1_16000.wav \

0 commit comments

Comments
 (0)