|
| 1 | +name: Lint |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - '*' |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - '*' |
| 10 | + |
| 11 | +jobs: |
| 12 | + frontend: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout code |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - name: Changed files in frontend |
| 19 | + id: changed-files-frontend |
| 20 | + uses: tj-actions/changed-files@v45 |
| 21 | + with: |
| 22 | + files: 'frontend/**' |
| 23 | + |
| 24 | + - name: Check if frontend files changed |
| 25 | + run: | |
| 26 | + if [[ "${{ steps.changed-files-frontend.outputs.changed }}" == "true" ]]; then |
| 27 | + echo "Frontend files changed. Proceeding with linting." |
| 28 | + else |
| 29 | + echo "No frontend files changed. Skipping frontend lint." |
| 30 | + exit 0 |
| 31 | + fi |
| 32 | +
|
| 33 | + - name: Setup node.js |
| 34 | + uses: actions/setup-node@v4 |
| 35 | + with: |
| 36 | + node-version: 22.x |
| 37 | + cache-dependency-path: ./frontend/package-lock.json |
| 38 | + cache: 'npm' |
| 39 | + |
| 40 | + - name: Install dependencies |
| 41 | + run: npm ci |
| 42 | + |
| 43 | + - name: Run eslint |
| 44 | + run: npm run lint |
| 45 | + |
| 46 | + backend: |
| 47 | + runs-on: ubuntu-latest |
| 48 | + steps: |
| 49 | + - name: Checkout code |
| 50 | + uses: actions/checkout@v4 |
| 51 | + |
| 52 | + - name: Changed files in backend |
| 53 | + id: changed-files-backend |
| 54 | + uses: tj-actions/changed-files@v45 |
| 55 | + with: |
| 56 | + files: 'backend/**' |
| 57 | + |
| 58 | + - name: Check if backend files changed |
| 59 | + run: | |
| 60 | + if [[ "${{ steps.changed-files-backend.outputs.changed }}" == "true" ]]; then |
| 61 | + echo "Backend files changed. Proceeding with linting." |
| 62 | + else |
| 63 | + echo "No backend files changed. Skipping backend lint." |
| 64 | + exit 0 |
| 65 | + fi |
| 66 | +
|
| 67 | + - name: Setup python |
| 68 | + uses: actions/setup-python@v5 |
| 69 | + with: |
| 70 | + python-version: '3.12' |
| 71 | + |
| 72 | + - name: Install Poetry |
| 73 | + uses: snok/install-poetry@v1 |
| 74 | + with: |
| 75 | + virtualenvs-create: true |
| 76 | + virtualenvs-in-project: true |
| 77 | + virtualenvs-path: .venv |
| 78 | + installer-parallel: true |
| 79 | + |
| 80 | + - name: Install dependencies |
| 81 | + run: poetry install --no-interaction |
| 82 | + |
| 83 | + - name: Run isort and flake8 |
| 84 | + run: poetry run poe lint |
0 commit comments