From 57c13b57bc594e6b1aa27860dd0b55bbf7e8c7c7 Mon Sep 17 00:00:00 2001 From: moshemorad Date: Wed, 8 Jan 2025 11:57:13 +0200 Subject: [PATCH] Run poetry check as part of pre-commit (#1684) --- .github/workflows/test-poetry-lock.yaml | 18 -------- .github/workflows/test_robusta.yaml | 9 ++++ .pre-commit-config.yaml | 58 +++++++++++++++---------- poetry.lock | 4 +- pyproject.toml | 2 +- 5 files changed, 46 insertions(+), 45 deletions(-) delete mode 100644 .github/workflows/test-poetry-lock.yaml diff --git a/.github/workflows/test-poetry-lock.yaml b/.github/workflows/test-poetry-lock.yaml deleted file mode 100644 index 005e48478..000000000 --- a/.github/workflows/test-poetry-lock.yaml +++ /dev/null @@ -1,18 +0,0 @@ -name: Test Poetry lock file -on: - - push - - pull_request -jobs: - run_tests: - name: Test lock file - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - name: Run poetry lock - run: | - curl -sSL https://install.python-poetry.org | python3 - - poetry lock --check diff --git a/.github/workflows/test_robusta.yaml b/.github/workflows/test_robusta.yaml index 5e9bb2d3c..9e0506c4e 100644 --- a/.github/workflows/test_robusta.yaml +++ b/.github/workflows/test_robusta.yaml @@ -3,7 +3,16 @@ name: Test robusta with pytest on: [push, pull_request, workflow_dispatch] jobs: + check: + name: Pre-commit checks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + - uses: pre-commit/action@v3.0.1 + run_tests: + needs: check runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 68f7e2da4..e393800f6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,33 +1,43 @@ repos: - - repo: https://github.com/ambv/black - rev: 22.3.0 - hooks: - - id: black - language_version: python3 - args: [--config=pyproject.toml] - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.3.0 + - repo: https://github.com/python-poetry/poetry + rev: 1.8.5 hooks: - - id: trailing-whitespace - - id: end-of-file-fixer + - id: poetry-check + - id: poetry-lock + pass_filenames: false + args: + - --no-update + + # - repo: https://github.com/ambv/black + # rev: 22.3.0 + # hooks: + # - id: black + # language_version: python3 + # args: [--config=pyproject.toml] - - repo: https://github.com/MarcoGorelli/absolufy-imports - rev: v0.3.1 - hooks: - - id: absolufy-imports + # - repo: https://github.com/pre-commit/pre-commit-hooks + # rev: v3.3.0 + # hooks: + # - id: trailing-whitespace + # - id: end-of-file-fixer - - repo: https://github.com/pycqa/flake8 - rev: 5.0.4 - hooks: - - id: flake8 - args: [--config=.flake8] + # - repo: https://github.com/MarcoGorelli/absolufy-imports + # rev: v0.3.1 + # hooks: + # - id: absolufy-imports - - repo: https://github.com/pycqa/isort - rev: 5.12.0 - hooks: - - id: isort - args: [--settings-path=pyproject.toml] + # - repo: https://github.com/pycqa/flake8 + # rev: 5.0.4 + # hooks: + # - id: flake8 + # args: [--config=.flake8] + + # - repo: https://github.com/pycqa/isort + # rev: 5.12.0 + # hooks: + # - id: isort + # args: [--settings-path=pyproject.toml] # - repo: https://github.com/pre-commit/mirrors-mypy # rev: v0.790 diff --git a/poetry.lock b/poetry.lock index a35e8741d..2650c3823 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.3 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.5 and should not be changed by hand. [[package]] name = "absolufy-imports" @@ -3686,4 +3686,4 @@ all = ["CairoSVG", "Flask", "better-exceptions", "datadog-api-client", "grafana- [metadata] lock-version = "2.0" python-versions = "^3.8, <3.12" -content-hash = "115718693371bcfa64d9277501864032c2c9b5f65cd509f16eb40ec2bbeb3dbf" +content-hash = "7a1c463e2651218a2a101582a599c6adc3c808ea9c6fc6af8a570a8d832b4fa6" diff --git a/pyproject.toml b/pyproject.toml index c828ed1ee..6f7c990f8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -112,7 +112,7 @@ types-toml = "^0.10.2" types-tabulate = "^0.8.10" [tool.poetry.extras] -all = ["Flask", "grafana-api", "watchdog", "dulwich", "better-exceptions", "CairoSVG", "tabulate", "kafka-python", "prometheus-api-client", "supabase", "datadog-api-client", "tinycss", "cssselect", "rsa", "sentry-sdk", "poetry-core"] +all = ["Flask", "grafana-api", "watchdog", "better-exceptions", "CairoSVG", "tabulate", "kafka-python", "prometheus-api-client", "supabase", "datadog-api-client", "sentry-sdk", "poetry-core"] [tool.poetry.group.dev.dependencies] sphinx-jinja = { git = "https://github.com/robusta-dev/sphinx-jinja.git" }