Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix nightly windows CPU build #948

Merged
merged 12 commits into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions .github/workflows/nightly-cpu-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,31 @@ on:
# day of the month (1-31)
# month (1-12)
# day of the week (0-6)
# nightly build at 14:00 UTC time every day
- cron: "0 14 * * *"
# nightly build at 23:50 UTC time every day
- cron: "50 23 * * *"

env:
BUILD_TYPE: Release

jobs:
enable_nightly_build:
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'
# see https://github.com/pytorch/pytorch/pull/50633
runs-on: ubuntu-latest
outputs:
Expand Down Expand Up @@ -102,6 +119,7 @@ jobs:
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 }}
Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/nightly-cpu-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,31 @@ on:
# day of the month (1-31)
# month (1-12)
# day of the week (0-6)
# nightly build at 14:00 UTC time every day
- cron: "0 14 * * *"
# nightly build at 23:50 UTC time every day
- cron: "50 23 * * *"

env:
BUILD_TYPE: Release

jobs:
enable_nightly_build:
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'
# see https://github.com/pytorch/pytorch/pull/50633
runs-on: ubuntu-latest
outputs:
Expand Down Expand Up @@ -107,6 +124,7 @@ jobs:
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 }}
Expand Down
75 changes: 51 additions & 24 deletions .github/workflows/nightly-cpu-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,31 @@ on:
# day of the month (1-31)
# month (1-12)
# day of the week (0-6)
# nightly build at 14:00 UTC time every day
- cron: "0 14 * * *"
# nightly build at 23:50 UTC time every day
- cron: "50 23 * * *"

env:
BUILD_TYPE: Release

jobs:
enable_nightly_build:
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'
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
Expand Down Expand Up @@ -83,6 +100,31 @@ jobs:
cmake --version
cmake --help

- name: Build wheel
shell: bash
run: |
export K2_CMAKE_ARGS="-DK2_WITH_CUDA=OFF -DCMAKE_BUILD_TYPE=Release"
python3 setup.py bdist_wheel
ls -lh dist/
pip install ./dist/*.whl

- name: Upload Wheel
uses: actions/upload-artifact@v2
with:
name: torch-${{ matrix.torch }}-python-${{ matrix.python-version }}-windows-cpu
path: dist/*.whl

- name: Copy wheels to k2-fsa.org
if: ${{ github.repository_owner == 'k2-fsa' }}
shell: bash
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

- name: Configure CMake
shell: bash
run: |
Expand All @@ -94,37 +136,22 @@ jobs:
cat CMakeCache.txt

- name: Build k2
shell: bash
run: |
cd build_release
cmake --build . --target _k2 --config Release -- -m
ls -lh lib/*/*
ls -lh bin/*/*
cmake --build . --target ALL_BUILD --config Release

- name: Display generated files
shell: bash
run: |
cd build_release
ls -lh lib/*/*
ls -lh bin/*/*

- name: Build wheel
shell: bash
run: |
export K2_CMAKE_ARGS="-DK2_WITH_CUDA=OFF -DCMAKE_BUILD_TYPE=Release"
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 }}-windows-cpu
path: dist/*.whl

- name: Copy wheels to k2-fsa.org
- name: Run tests
shell: bash
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
cd build_release
# disable python tests for k2host
ctest -C Release --output-on-failure -E host
22 changes: 20 additions & 2 deletions .github/workflows/nightly-cuda-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,31 @@ on:
# day of the month (1-31)
# month (1-12)
# day of the week (0-6)
# nightly build at 14:00 UTC time every day
- cron: "0 14 * * *"
# nightly build at 23:50 UTC time every day
- cron: "50 23 * * *"

env:
BUILD_TYPE: Release

jobs:
enable_nightly_build:
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}"

nightly:
needs: enable_nightly_build
if: needs.enable_nightly_build.outputs.enabled == 'true'
runs-on: ubuntu-18.04
strategy:
fail-fast: false
Expand Down Expand Up @@ -98,6 +115,7 @@ jobs:
ls -lh dist/

- name: Copy wheels to k2-fsa.org
if: ${{ github.repository_owner == 'k2-fsa' }}
uses: horochx/deploy-via-scp@v1.0.1
with:
host: ${{ secrets.K2_HOST }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/wheel-cpu-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ jobs:
path: dist/*.whl

- name: Publish wheels to PyPI
if: ${{ github.repository_owner == 'k2-fsa' }}
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/wheel-cpu-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ jobs:
path: dist/*.whl

- name: Publish wheels to PyPI
if: ${{ github.repository_owner == 'k2-fsa' }}
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/wheel-cuda-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ jobs:
ls -lh dist/

- name: Publish wheels to PyPI
if: ${{ github.repository_owner == 'k2-fsa' }}
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
Expand Down
35 changes: 35 additions & 0 deletions scripts/github_actions/run-nightly-build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/usr/bin/env python3
# Copyright 2022 Xiaomi Corp. (authors: Fangjun Kuang)

import subprocess
from datetime import datetime, timedelta


def get_last_commit_date() -> datetime:
date = (
subprocess.check_output(
[
"git",
"log",
"-1",
"--format=%ad",
"--date=unix",
]
)
.decode("ascii")
.strip()
)
return datetime.utcfromtimestamp(int(date))


def main():
last_commit_date_utc = get_last_commit_date()
now_utc = datetime.utcnow()
if last_commit_date_utc + timedelta(days=1) > now_utc:
print("true")
else:
print("false")


if __name__ == "__main__":
main()