Skip to content

Commit

Permalink
format code (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leonz5288 authored May 28, 2021
1 parent e11e965 commit 2a0178b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gardener.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Taichi Gardener
on:
pull_request:
types: [review_requested, synchronize]
types: [review_requested]

jobs:
format:
Expand Down
23 changes: 22 additions & 1 deletion .github/workflows/persubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,30 @@ jobs:
name: Code Format
runs-on: ubuntu-latest
# This job will be required to pass before merging to master branch.
steps:
- uses: actions/checkout@v2
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Check code format
run: |
python3 -m pip install yapf gitpython colorama isort
python3 python/taichi/code_format.py
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Auto Code Format
commit_user_name: Taichi Gardener
commit_user_email: [email protected]
commit_author: taichigardener <[email protected]>
# - name: Commit changes
#run: |
#git config --local user.email "[email protected]"
#git config --local user.name "Taichi Gardener"
#git add -A
#git commit -m "Auto Code Format"
#- name: Push changes
#uses: ad-m/github-push-action@master
#with:
#GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#branch: ${{ steps.pr_data.outputs.branch }}
9 changes: 4 additions & 5 deletions python/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ def get_os_name():
name = platform.platform()
# in python 3.8, platform.platform() uses mac_ver() on macOS
# it will return 'macOS-XXXX' instead of 'Darwin-XXXX'
if name.lower().startswith('darwin') or name.lower().startswith('macos'):

if name.lower( ).startswith('darwin') or name.lower().startswith('macos'):
return 'osx'
elif name.lower().startswith('windows'):
return 'win'
Expand All @@ -27,10 +28,8 @@ def get_python_executable():
def build():
"""Build and package the wheel file in `python/dist`"""
if platform.system() == 'Linux':
if os.environ.get(
'CXX', 'clang++') not in ['clang++-8', 'clang++-7', 'clang++']:
raise RuntimeError(
'Only the wheel with clang will be released to PyPI')
if os.environ.get('CXX', 'clang++') not in ['clang++-8', 'clang++-7', 'clang++']:
raise RuntimeError( 'Only the wheel with clang will be released to PyPI')

version = ti.core.get_version_string()
with open('../setup.py') as fin:
Expand Down

0 comments on commit 2a0178b

Please sign in to comment.