DeepSpeech/.github/workflows/macOS-amd64.yml
2021-03-25 11:01:29 +01:00

246 lines
9.0 KiB
YAML

name: "macOS amd64"
on:
pull_request:
push:
branches:
- master
env:
TASKCLUSTER_TASK_DIR: ${{ github.workspace }}
TASKCLUSTER_ARTIFACTS: ${{ github.workspace }}/artifacts
MACOSX_DEPLOYMENT_TARGET: "10.10"
jobs:
swig_macOS:
name: "Build SWIG for macOS"
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
with:
repository: "swig/swig"
ref: "90cdbee6a69d13b39d734083b9f91069533b0d7b"
- run: |
brew install automake
- run: |
mkdir -p build-static/
- run: |
curl -sSL https://ftp.pcre.org/pub/pcre/pcre-8.43.tar.gz > pcre-8.43.tar.gz
- run: |
./Tools/pcre-build.sh
- run: |
sh autogen.sh
./configure \
--prefix=${{ github.workspace }}/build-static/ \
--program-prefix=ds-
- run: |
make -j
- run: |
make install
- uses: actions/upload-artifact@v2
with:
name: ${{ github.job }}
path: ${{ github.workspace }}/build-static/
tensorflow_opt-macOS:
name: "Check cache for TensorFlow"
runs-on: ubuntu-20.04
outputs:
status: ${{ steps.check_artifact_exists.outputs.status }}
cache_key: ${{ steps.get_cache_key.outputs.key }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- id: get_cache_key
uses: ./.github/actions/get_cache_key
with:
extras: "2"
- id: check_artifact_exists
uses: ./.github/actions/check_artifact_exists
with:
name: ${{ steps.get_cache_key.outputs.key }}
build-tensorflow-macOS:
name: "Build TensorFlow (opt) for macOS"
needs: tensorflow_opt-macOS
runs-on: macos-10.15
steps:
- run: true
if: needs.tensorflow_opt-macOS.outputs.status == 'found'
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'
if: needs.tensorflow_opt-macOS.outputs.status == 'missing'
- uses: ./.github/actions/select-xcode
with:
version: "12.1.1"
if: needs.tensorflow_opt-macOS.outputs.status == 'missing'
- uses: ./.github/actions/setup-tensorflow
if: needs.tensorflow_opt-macOS.outputs.status == 'missing'
- uses: ./.github/actions/build-tensorflow
with:
flavor: "--darwin-cpu"
if: needs.tensorflow_opt-macOS.outputs.status == 'missing'
- uses: ./.github/actions/package-tensorflow
if: needs.tensorflow_opt-macOS.outputs.status == 'missing'
- uses: actions/upload-artifact@v2
with:
name: ${{ needs.tensorflow_opt-macOS.outputs.cache_key }}
path: ${{ github.workspace }}/artifacts/home.tar.xz
if: needs.tensorflow_opt-macOS.outputs.status == 'missing'
build-lib_macOS:
name: "Build libdeepspeech.so and deepspeech C++ binary"
runs-on: macos-10.15
needs: [ build-tensorflow-macOS, tensorflow_opt-macOS ]
strategy:
matrix:
build-flavor: ["tf", "tflite"]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/download-artifact@v2
with:
name: ${{ needs.tensorflow_opt-macOS.outputs.cache_key }}
path: ${{ github.workspace }}/
if: needs.tensorflow_opt-macOS.outputs.status == 'missing'
- uses: ./.github/actions/check_artifact_exists
with:
name: ${{ needs.tensorflow_opt-macOS.outputs.cache_key }}
path: ${{ github.workspace }}/
download: true
if: needs.tensorflow_opt-macOS.outputs.status == 'found'
- run: |
tar xkf ${{ github.workspace }}/home.tar.xz
rm ${{ github.workspace }}/home.tar.xz
- run: |
git status
- uses: ./.github/actions/select-xcode
with:
version: "12.1.1"
- uses: ./.github/actions/host-build
with:
flavor: ${{ matrix.build-flavor }}
- uses: ./.github/actions/package
- uses: actions/upload-artifact@v2
with:
name: "native_client.${{ matrix.build-flavor }}.tar.xz"
path: ${{ github.workspace }}/artifacts/native_client.tar.xz
- uses: actions/upload-artifact@v2
with:
name: "libdeepspeech.${{ matrix.build-flavor }}.zip"
path: ${{ github.workspace }}/artifacts/libdeepspeech.zip
build-python-macOS:
name: "Build python bindings for macOS"
runs-on: macos-10.15
needs: [ build-lib_macOS, swig_macOS ]
strategy:
matrix:
build-flavor: ["tf", "tflite"]
python-version: [3.6.8, 3.7.9, 3.8.8, 3.9.2]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- uses: actions/download-artifact@v2
with:
name: "native_client.${{ matrix.build-flavor }}.tar.xz"
path: ${{ github.workspace }}/tensorflow/bazel-bin/native_client/
- run: |
cd ${{ github.workspace }}/tensorflow/bazel-bin/native_client/
tar xf native_client.tar.xz
ls -hal
cd ${{ github.workspace }}/
- uses: actions/download-artifact@v2
with:
name: "swig_macOS"
path: ${{ github.workspace }}/native_client/ds-swig/
- run: |
ls -hal ${{ github.workspace }}/native_client/ds-swig/bin
ln -s ds-swig ${{ github.workspace }}/native_client/ds-swig/bin/swig
chmod +x ${{ github.workspace }}/native_client/ds-swig/bin/ds-swig ${{ github.workspace }}/native_client/ds-swig/bin/swig
- uses: ./.github/actions/install-python-upstream
with:
version: ${{ matrix.python-version }}
# GitHub packaged version are limited to macOS deployment target 10.14
#- uses: actions/setup-python@v2
# with:
# python-version: ${{ matrix.python-version }}
- uses: ./.github/actions/python-build
with:
build_flavor: ${{ matrix.build-flavor }}
- uses: actions/upload-artifact@v2
with:
name: "deepspeech-${{ matrix.build-flavor }}-${{ matrix.python-version }}.whl"
path: ${{ github.workspace }}/wheels/*.whl
build-nodejs-macOS:
name: "Build NodeJS and ElectronJS for macOS"
runs-on: macos-10.15
needs: [ build-lib_macOS, swig_macOS ]
strategy:
matrix:
build-flavor: ["tf", "tflite"]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- uses: actions/download-artifact@v2
with:
name: "native_client.${{ matrix.build-flavor }}.tar.xz"
path: ${{ github.workspace }}/tensorflow/bazel-bin/native_client/
- run: |
cd ${{ github.workspace }}/tensorflow/bazel-bin/native_client/
tar xf native_client.tar.xz
ls -hal
cd ${{ github.workspace }}/
- uses: actions/download-artifact@v2
with:
name: "swig_macOS"
path: ${{ github.workspace }}/native_client/ds-swig/
- run: |
ls -hal ${{ github.workspace }}/native_client/ds-swig/bin
ln -s ds-swig ${{ github.workspace }}/native_client/ds-swig/bin/swig
chmod +x ${{ github.workspace }}/native_client/ds-swig/bin/ds-swig ${{ github.workspace }}/native_client/ds-swig/bin/swig
- uses: actions/setup-node@v2
with:
node-version: 12
- uses: ./.github/actions/node-build
with:
nodejs_versions: "10.0.0 11.0.0 12.7.0 13.0.0 14.0.0 15.0.0"
electronjs_versions: "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"
- uses: actions/upload-artifact@v2
with:
name: "nodewrapper-${{ matrix.build-flavor }}.tar.gz"
path: ${{ github.workspace }}/native_client/javascript/wrapper.tar.gz
- uses: actions/upload-artifact@v2
with:
name: "deepspeech-${{ matrix.build-flavor }}.tar.gz"
path: ${{ github.workspace }}/native_client/javascript/deepspeech-*.tgz
test-cpp-macOS:
name: "Test C++ binary on macOS"
runs-on: macos-10.15
needs: build-lib_macOS
strategy:
matrix:
build-flavor: ["tf", "tflite"]
models: ["-prod"]
bitrate: ["8k", "16k"]
env:
TASKCLUSTER_TMP_DIR: ${{ github.workspace }}/tmp/
DEEPSPEECH_PROD_MODEL: https://github.com/reuben/DeepSpeech/releases/download/v0.7.0-alpha.3/output_graph.pb
DEEPSPEECH_PROD_MODEL_MMAP: https://github.com/reuben/DeepSpeech/releases/download/v0.7.0-alpha.3/output_graph.pbmm
EXPECTED_TENSORFLOW_VERSION: "TensorFlow: v2.3.0-6-g23ad988"
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- uses: actions/download-artifact@v2
with:
name: "native_client.${{ matrix.build-flavor }}.tar.xz"
path: ${{ env.TASKCLUSTER_TMP_DIR }}
- run: |
cd ${{ env.TASKCLUSTER_TMP_DIR }}
mkdir ds && cd ds && tar xf ../native_client.tar.xz
- uses: ./.github/actions/cpp-tests
with:
build-flavor: ${{ matrix.build-flavor }}
bitrate: ${{ matrix.bitrate }}
model-kind: ${{ matrix.models }}