Skip to content

feat: setup lint gh-actions #19

feat: setup lint gh-actions

feat: setup lint gh-actions #19

Workflow file for this run

name: Lint
on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
jobs:
planner:
name: Determine which jobs to run
runs-on: ubuntu-latest
outputs:
frontend: ${{ steps.check-frontend.outputs.should-run }}
backend: ${{ steps.check-backend.outputs.should-run }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get changed files in frontend
id: changed-files-frontend
uses: tj-actions/changed-files@v45
with:
files: 'frontend/**'
- name: Mark frontend job as 'to be run'
id: check-frontend
run: |
echo "Frontend files changed: ${{ steps.changed-files-frontend.outputs.changed }}"
echo "should-run=${{ steps.changed-files-frontend.outputs.changed }}" >> $GITHUB_OUTPUT
- name: Get changed files in backend
id: changed-files-backend
uses: tj-actions/changed-files@v45
with:
files: 'backend/**'
- name: Mark backend job as 'to be run'
id: check-backend
run: |
echo "Backend files changed: ${{ steps.changed-files-backend.outputs.changed }}"
echo "should-run=${{ steps.changed-files-backend.outputs.changed }}" >> $GITHUB_OUTPUT
frontend:
runs-on: ubuntu-latest
needs: planner
if: needs.planner.outputs.frontend == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
cache-dependency-path: ./frontend/package-lock.json
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run eslint
run: npm run lint
backend:
runs-on: ubuntu-latest
needs: planner
if: needs.planner.outputs.backend == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
virtualenvs-path: .venv
installer-parallel: true
- name: Install dependencies
run: poetry install --no-interaction
- name: Run isort and flake8
run: poetry run poe lint