From d637cdc9c35146b911f39d405bfc4a19738d9f87 Mon Sep 17 00:00:00 2001 From: Fangjun Kuang Date: Mon, 15 Aug 2022 17:26:20 +0800 Subject: [PATCH] Build conda package for macos --- .github/workflows/build_conda_macos_cpu.yml | 114 +++++++++++++++++++ .github/workflows/build_conda_ubuntu_cpu.yml | 3 - 2 files changed, 114 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/build_conda_macos_cpu.yml diff --git a/.github/workflows/build_conda_macos_cpu.yml b/.github/workflows/build_conda_macos_cpu.yml new file mode 100644 index 0000000..9329ade --- /dev/null +++ b/.github/workflows/build_conda_macos_cpu.yml @@ -0,0 +1,114 @@ +# Copyright 2021 Xiaomi Corp. (author: Fangjun Kuang) + +# See ../../LICENSE for clarification regarding multiple authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# refer to https://github.com/actions/starter-workflows/pull/47/files + +name: build_conda_macos_cpu + +on: + push: + branches: + - master + - conda + tags: + - '*' + +env: + KALDIFEAT_BUILD_TYPE: Release + +jobs: + generate_build_matrix: + # see https://github.com/pytorch/pytorch/pull/50633 + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Generating build matrix + id: set-matrix + run: | + # outputting for debugging purposes + python scripts/github_actions/generate_build_matrix.py + MATRIX=$(python scripts/github_actions/generate_build_matrix.py) + echo "::set-output name=matrix::${MATRIX}" + + build_conda_macos_cpu: + needs: generate_build_matrix + runs-on: macos-10.15 + strategy: + fail-fast: false + matrix: + ${{ fromJson(needs.generate_build_matrix.outputs.matrix) }} + + steps: + # refer to https://github.com/actions/checkout + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Display clang version + run: | + clang --version + + - uses: conda-incubator/setup-miniconda@v2 + with: + auto-update-conda: true + python-version: ${{ matrix.python-version }} + activate-environment: kaldifeat + + - name: Display Python version + shell: bash -l {0} + run: | + python3 -c "import sys; print(sys.version)" + which python3 + + - name: Install conda dependencies + shell: bash -l {0} + run: | + conda install -y -q anaconda-client + conda install -y -q conda-build + conda install -y -q -c pytorch pytorch=${{ matrix.torch }} cpuonly + + - name: Display conda info + shell: bash -l {0} + run: | + which conda + conda env list + conda info + + - name: Build kaldifeat + shell: bash -l {0} + env: + KALDIFEAT_PYTHON_VERSION: ${{ matrix.python-version}} + KALDIFEAT_TORCH_VERSION: ${{ matrix.torch }} + # KALDIFEAT_CONDA_TOKEN: ${{ secrets.KALDIFEAT_CONDA_TOKEN}} + KALDIFEAT_IS_GITHUB_ACTIONS: 1 + KALDIFEAT_IS_FOR_CONDA: 1 + run: | + export KALDIFEAT_BUILD_TYPE=$KALDIFEAT_BUILD_TYPE + ./scripts/build_conda_cpu.sh + + - name: Display generated files + run: | + ls -lh /usr/local/miniconda/envs/kaldifeat/conda-bld/osx-64 + + - name: Upload generated files + uses: actions/upload-artifact@v2 + with: + name: cpu-torch-${{ matrix.torch }}-python-${{ matrix.python-version }}-${{ matrix.os }} + path: /usr/local/miniconda/envs/kaldifeat/conda-bld/osx-64/*.tar.bz2 diff --git a/.github/workflows/build_conda_ubuntu_cpu.yml b/.github/workflows/build_conda_ubuntu_cpu.yml index b19c3c2..3b48560 100644 --- a/.github/workflows/build_conda_ubuntu_cpu.yml +++ b/.github/workflows/build_conda_ubuntu_cpu.yml @@ -20,9 +20,6 @@ name: build_conda_ubuntu_cpu on: push: - branches: - - master - - conda tags: - '*'