Skip to content

Commit

Permalink
[ci] Fix mac release and integrate windows release into github (#2641)
Browse files Browse the repository at this point in the history
* [ci] Fix mac release and integrate windows release into github

* Auto Format

* Update python/build.py

Co-authored-by: Ye Kuang <[email protected]>

Co-authored-by: Taichi Gardener <[email protected]>
Co-authored-by: Ye Kuang <[email protected]>
  • Loading branch information
3 people authored Aug 6, 2021
1 parent 0df7941 commit b71fb81
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,6 @@ jobs:
python -c "import taichi"
python examples/algorithm/laplace.py
python bin/taichi diagnose
python bin/taichi test -Cvr2 -t2
python bin/taichi test -cvr2 -t2
env:
PYTHON: C:\hostedtoolcache\windows\Python\3.7.9\x64\python.exe
103 changes: 79 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on:
types: [published]

jobs:
build_and_test_cpu:
name: Build and Test (macOS only)
build_and_upload_mac:
name: Build and Upload (macOS only)
strategy:
matrix:
include:
Expand All @@ -25,6 +25,9 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'

- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
Expand All @@ -45,38 +48,90 @@ jobs:
export CXX=clang++
# TODO: making changelog shouldn't depend on taichi.
# We currently install taichi to make changelog when building the wheel.
python misc/ci_setup.py ci
cd python
python build.py build
# Uninstall taichi to make sure we test the wheel.
pip uninstall taichi -y
python -m pip install --user numpy pybind11 gitpython pytest
python setup.py develop
- name: Install Wheel and Test
- name: Test
run: |
TAICHI_REPO_DIR=`pwd`
export PATH=$TAICHI_REPO_DIR/taichi-llvm/bin/:$PATH
NUM_WHL=`ls dist/*.whl | wc -l`
if [ $NUM_WHL -ne 1 ]; then echo 'ERROR: created more than 1 whl.' && exit 1 ; fi
pip install dist/*.whl
python examples/algorithm/laplace.py
ti diagnose
ti test -vr2 -t2
ti test -cvr2 -t2
- name: Upload PyPI
env:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets#using-encrypted-secrets-in-a-workflow
PYPI_PWD: ${{ secrets.PYPI_PWD }}
run: |
cd python
python build.py upload
- name: Archive Wheel Artifacts
# https://docs.github.com/en/actions/guides/storing-workflow-data-as-artifacts#uploading-build-and-test-artifacts
uses: actions/upload-artifact@v2
build_and_upload_windows:
name: Build and Upload (Windows only)
strategy:
matrix:
include:
- os: windows-latest
python: 3.6
with_cc: OFF
- os: windows-latest
python: 3.7
with_cc: OFF
- os: windows-latest
python: 3.8
with_cc: OFF
- os: windows-latest
python: 3.9
with_cc: OFF
runs-on: ${{ matrix.os }}
steps:
- name: Install 7Zip PowerShell
shell: powershell
run: Install-Module 7Zip4PowerShell -Force -Verbose

- uses: actions/checkout@v2
with:
# While ${{ github.ref }} does provide the release tag, it is of
# format `refs/tags/<tag_name>`, which isn't a valid file path.
name: taichi-py${{ matrix.python }}-${{ matrix.os }}.whl
path: dist/*.whl
submodules: 'recursive'

- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}

- name: Add msbuild to PATH
uses: microsoft/[email protected]

- name: Build Python Wheel
shell: powershell
run: |
cd C:\
Remove-item alias:curl
curl --retry 10 --retry-delay 5 https://github.com/taichi-dev/taichi_assets/releases/download/llvm10/taichi-llvm-10.0.0-msvc2019.zip -LO
7z x taichi-llvm-10.0.0-msvc2019.zip -otaichi_llvm
curl --retry 10 --retry-delay 5 https://github.com/taichi-dev/taichi_assets/releases/download/llvm10/clang-10.0.0-win.zip -LO
7z x clang-10.0.0-win.zip -otaichi_clang
$env:PATH += ";C:\taichi_llvm\bin"
$env:PATH += ";C:\taichi_clang\bin"
clang --version
cd D:\a\taichi\taichi
python -m pip install --user numpy pybind11 gitpython pytest
python setup.py develop
env:
CI_SETUP_CMAKE_ARGS: -G "Visual Studio 16 2019" -A x64 -DLLVM_DIR=C:\taichi_llvm\lib\cmake\llvm

- name: Test
shell: powershell
run: |
$env:PATH += ";C:\taichi_llvm\bin"
$env:PATH += ";C:\taichi_clang\bin"
python -c "import taichi"
python examples/algorithm/laplace.py
python bin/taichi diagnose
python bin/taichi test -cvr2 -t2
- name: Upload PyPI
shell: powershell
env:
# https://docs.github.com/en/free-pro-team@latest/actions/reference/encrypted-secrets#using-encrypted-secrets-in-a-workflow
PYPI_PWD: ${{ secrets.PYPI_PWD }}
run: |
TAICHI_REPO_DIR=`pwd`
export PATH=$TAICHI_REPO_DIR/taichi-llvm/bin/:$PATH
cd python
python build.py try_upload --skip_build && bash <(curl -s https://codecov.io/bash)
python build.py upload
5 changes: 2 additions & 3 deletions python/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,8 @@ def build(project_name):
f'cd ..; PROJECT_NAME={project_name} {get_python_executable()} setup.py bdist_wheel -p manylinux1_x86_64'
)
else:
os.system(
f'cd ..; PROJECT_NAME={project_name} {get_python_executable()} setup.py bdist_wheel'
)
os.environ['PROJECT_NAME'] = project_name
os.system(f'cd .. && {get_python_executable()} setup.py bdist_wheel')

try:
os.remove('taichi/CHANGELOG.md')
Expand Down

0 comments on commit b71fb81

Please sign in to comment.