switch to pre_commit workflow

This commit is contained in:
Simon 2025-01-06 21:17:15 +07:00
parent bc74bf80f4
commit a7fb5d9939
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4
2 changed files with 42 additions and 42 deletions

View File

@ -1,42 +0,0 @@
name: lint_python
on:
push:
paths:
- '**/*.py'
pull_request:
paths:
- '**/*.py'
jobs:
lint_python:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y gcc libldap2-dev libsasl2-dev libssl-dev
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install -r backend/requirements-dev.txt
- name: Run Linter
run: ./deploy.sh validate

42
.github/workflows/pre_commit.yml vendored Normal file
View File

@ -0,0 +1,42 @@
name: Lint, Test, Build, and Push Docker Image
on:
push:
branches:
- '**'
tags:
- '**'
pull_request:
branches:
- '**'
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Cache pre-commit environment
uses: actions/cache@v3
with:
path: |
~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pre-commit-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Run pre-commit
run: |
pre-commit run --all-files