diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml deleted file mode 100644 index 539c00a9..00000000 --- a/.github/workflows/lint_python.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/pre_commit.yml b/.github/workflows/pre_commit.yml new file mode 100644 index 00000000..4956ab9e --- /dev/null +++ b/.github/workflows/pre_commit.yml @@ -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