-
Notifications
You must be signed in to change notification settings - Fork 130
69 lines (57 loc) · 2.42 KB
/
lint.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: CI lint
on: [push, pull_request, workflow_dispatch]
jobs:
check:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
node-version: ["21.x"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Set up pipx
run: |
python -m pip install --upgrade pip
python -m pip install pipx
- 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: |
npx 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 "pipx run black --exclude='env|packages' ."
echo "pipx run isort --profile black --skip env --skip venv --skip worker/packages ."
echo "npx prettier --write 'server/fishtest/static/{css/*.css,html/*.html,js/*.js}'"