Skip to content

Optimize the workflow and unit test #213

Optimize the workflow and unit test

Optimize the workflow and unit test #213

Workflow file for this run

name: Code Formatting Check
on:
pull_request:
push:
branches:
- main
tags:
- r[0-9]+.[0-9]+
jobs:
format_check:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- run: pip install yapf==0.30.0
- name: Run yapf
shell: bash
run: |
git_status=$(git status --porcelain)
if [[ $git_status ]]; then
echo "Checkout code is not clean"
echo "${git_status}"
exit 1
fi
yapf -i -r *.py tests/ torchacc/ benchmarks/
git_status=$(git status --porcelain)
if [[ $git_status ]]; then
git diff
echo "Python format failed."
echo "Running `yapf -i -r *.py tests/ torchacc/ benchmarks/`"
exit 1
else
echo "Python format passed."
fi