Add tetris pre-processing example. #82
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pylint and Flake8 | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.12"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install pylint flake8 | |
# Run Pylint and Flake8 simultaneously using background tasks and redirect output to files. | |
- name: Run Pylint and Flake8 | |
run: | | |
python_files=$(git ls-files '*.py') | |
if [[ -n "$python_files" ]]; then | |
echo "$python_files" | xargs pylint --disable=E0401 --disable=R0801 --disable=E0611 --disable=W0106 --disable=R0903 --disable=R0914 --disable=C0103 --disable=C3001 --disable=E1121 > pylint.out & | |
flake8 --max-line-length=100 --max-complexity=10 --ignore=E731,W503,E226,W504 $python_files > flake8.out & | |
wait | |
fi | |
# Check the output files for errors and fail the pipeline if either of them is not empty. | |
- name: Check for errors | |
run: | | |
if ! grep -q "10.00/10" pylint.out && [ -s flake8.out ]; then | |
echo "Pylint Errors:" | |
cat pylint.out | |
echo "Flake8 Errors:" | |
cat flake8.out | |
exit 1 | |
elif ! grep -q "10.00/10" pylint.out; then | |
echo "Pylint Errors:" | |
cat pylint.out | |
exit 1 | |
elif [ -s flake8.out ]; then | |
echo "Flake8 Errors:" | |
cat flake8.out | |
exit 1 | |
fi |