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

[CI] Recovered format check, add dependancy #2394

Merged
merged 15 commits into from
Jun 3, 2021
Merged
28 changes: 28 additions & 0 deletions .github/workflows/persubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,35 @@ on:
types: [opened, synchronize, reopened]

jobs:
check_code_format:
name: Check Code Format
runs-on: ubuntu-latest
# This job will be required to pass before merging to master branch.
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Check code format
run: |
git config user.email "[email protected]"
git config user.name "Taichi Gardener"
git checkout -b _fake_squash
git remote add upstream https://github.com/taichi-dev/taichi.git
git fetch upstream master
sudo apt-get install clang-format
python3 -m pip install --user yapf gitpython colorama isort
python3 python/taichi/code_format.py
git checkout -b _enforced_format
git commit -am "enforce code format" || true
# exit with 1 if there were differences:
git diff _fake_squash _enforced_format --exit-code

build_and_test_cpu_required:
# This job will be required to pass before merging to master branch.
name: Required Build and Test (CPU)
needs: check_code_format
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip ci') }}
strategy:
matrix:
Expand Down Expand Up @@ -51,6 +77,7 @@ jobs:

build_and_test_cpu:
name: Build and Test (CPU)
needs: check_code_format
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip ci') && github.event.sender.login != 'taichi-gardener' }}
strategy:
matrix:
Expand Down Expand Up @@ -107,6 +134,7 @@ jobs:

build_and_test_gpu_linux:
name: Build and Test (GPU)
needs: check_code_format
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip ci') && github.event.sender.login != 'taichi-gardener' }}
runs-on: [self-hosted, cuda, cn]
steps:
Expand Down
2 changes: 1 addition & 1 deletion python/taichi/code_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ def format_file(fn):
format_plain_text(fn)
return True
elif has_suffix(fn, [
'txt', 'md', 'rst', 'cfg', 'yml', 'ini', 'map', 'cmake'
'txt', 'md', 'rst', 'cfg', 'ini', 'map', 'cmake'
]) or (os.path.basename(fn)[0].isupper()
and fn.endswith('file')): # E.g., Dockerfile and Jenkinsfile
format_plain_text(fn)
Expand Down