New default book for tests #44
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: CI lint | |
on: [push, pull_request, workflow_dispatch] | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.11"] | |
node-version: ["18.x"] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Set up Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Set up linters and formatters | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pipx | |
npm install --global prettier | |
- name: Run flake8 | |
id: flake8 | |
continue-on-error: true | |
run: | | |
pipx run flake8 --count --statistics --max-line-length=88 --exclude worker/packages . | |
- name: Run black | |
id: black | |
continue-on-error: true | |
run: | | |
pipx run black --check --exclude="packages" . | |
- name: Run isort | |
id: isort | |
continue-on-error: true | |
run: | | |
pipx run isort --check --profile black --skip worker/packages . | |
- name: Run prettier | |
id: prettier | |
continue-on-error: true | |
run: | | |
prettier --check "server/fishtest/static/{css/*.css,html/*.html,js/*.js}" | |
- name: Check linters and formatters status | |
run: | | |
if [[ "${{ steps.flake8.outcome }}" == "success" ]]; then echo "✔️ flake8"; else echo "❌ flake8"; fi | |
if [[ "${{ steps.black.outcome }}" == "success" ]]; then echo "✔️ black"; else echo "❌ black"; fi | |
if [[ "${{ steps.isort.outcome }}" == "success" ]]; then echo "✔️ isort"; else echo "❌ isort"; fi | |
if [[ "${{ steps.prettier.outcome }}" == "success" ]]; then echo "✔️ prettier"; else echo "❌ prettier"; fi | |
if [[ "${{ steps.black.outcome }}" == "failure" || "${{ steps.isort.outcome }}" == "failure" || "${{ steps.prettier.outcome }}" == "failure" ]]; then exit 1; fi | |
- name: Print formatting instructions | |
if: ${{ failure() }} | |
run: | | |
echo "Run the following commands to format the code:" | |
echo "black --exclude='env|packages' ." | |
echo "isort --profile black --skip env --skip venv --skip worker/packages ." | |
echo "npx prettier --write 'server/fishtest/static/{css/*.css,html/*.html,js/*.js}'" |