nightly_cpu_macos #472
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2021 Fangjun Kuang ([email protected]) | |
# 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. | |
name: nightly_cpu_macos | |
on: | |
push: | |
branches: | |
- nightly | |
paths: | |
- '.github/workflows/nightly-cpu-macos.yml' | |
- 'CMakeLists.txt' | |
- 'cmake/**' | |
- 'k2/csrc/**' | |
- 'k2/python/**' | |
schedule: | |
# minute (0-59) | |
# hour (0-23) | |
# day of the month (1-31) | |
# month (1-12) | |
# day of the week (0-6) | |
# nightly build at 23:50 UTC time every day | |
- cron: "50 23 * * *" | |
concurrency: | |
group: nightly_cpu_macos-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
BUILD_TYPE: Release | |
jobs: | |
enable_nightly_build: | |
if: github.repository == 'k2-fsa/k2' | |
runs-on: ubuntu-latest | |
outputs: | |
enabled: ${{ steps.set-enabled.outputs.enabled }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set enabled | |
id: set-enabled | |
run: | | |
enabled=$(python scripts/github_actions/run-nightly-build.py) | |
echo "enabled: $enabled" | |
echo "::set-output name=enabled::${enabled}" | |
generate_build_matrix: | |
needs: enable_nightly_build | |
if: needs.enable_nightly_build.outputs.enabled == 'true' || github.event_name == 'push' | |
# 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}" | |
nightly_cpu_macos: | |
needs: generate_build_matrix | |
runs-on: macos-10.15 | |
strategy: | |
fail-fast: false | |
matrix: | |
${{ fromJson(needs.generate_build_matrix.outputs.matrix) }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Display date and time | |
run: date | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Display Python version | |
run: python -c "import sys; print(sys.version)" | |
- name: Display GCC version | |
run: | | |
gcc --version | |
- name: Display clang version | |
run: | | |
clang --version | |
- name: Install PyTorch ${{ matrix.torch }} | |
shell: bash | |
run: | | |
python3 -m pip install -qq --upgrade pip | |
python3 -m pip install -qq wheel twine | |
python3 -m pip install -qq torch==${{ matrix.torch }} | |
python3 -m pip install --upgrade numpy | |
- name: Build pip packages | |
shell: bash | |
run: | | |
export K2_CMAKE_ARGS="-DCMAKE_BUILD_TYPE=$BUILD_TYPE -DK2_WITH_CUDA=OFF" | |
export K2_MAKE_ARGS="-j2" | |
python3 setup.py bdist_wheel | |
ls -lh dist/ | |
- name: Upload Wheel | |
uses: actions/upload-artifact@v2 | |
with: | |
name: torch-${{ matrix.torch }}-python-${{ matrix.python-version }}-macos-10.15 | |
path: dist/*.whl | |
- name: Copy wheels to k2-fsa.org | |
if: ${{ github.repository_owner == 'k2-fsa' }} | |
run: | | |
user=${{ secrets.K2_USERNAME }} | |
server=${{ secrets.K2_HOST }} | |
port=${{ secrets.K2_PORT }} | |
echo "${{ secrets.K2_KEY }}" > id_rsa && chmod 600 id_rsa | |
scp -P $port -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i id_rsa dist/*.whl $user@$server:~/nightly/whl | |
rm id_rsa |