From 4510e3a2f08f07b3196ec30450184ad53c7b82bb Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Thu, 14 Nov 2024 09:46:27 +0100 Subject: [PATCH] Run a lint check for bump version --- .github/workflows/lint.yml | 36 +++++++++++-------- templates/bootstrap/.bumpversion.cfg.j2 | 2 +- .../github/.github/workflows/lint.yml.j2 | 36 +++++++++++-------- templates/github/lint_requirements.txt.j2 | 1 + 4 files changed, 46 insertions(+), 29 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index f0c5bb5e..f095c16c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -16,7 +16,7 @@ defaults: jobs: lint: - runs-on: ubuntu-latest + runs-on: "ubuntu-latest" steps: - uses: "actions/checkout@v4" @@ -47,29 +47,37 @@ jobs: pip install -r lint_requirements.txt echo ::endgroup:: - - name: Lint workflow files + - name: "Lint workflow files" run: | yamllint -s -d '{extends: relaxed, rules: {line-length: disable}}' .github/workflows + - name: "Verify bump version config" + run: | + bump2version --dry-run --list release + # run black separately from flake8 to get a diff - - name: Run black + - name: "Run black" run: | black --version black --check --diff . # Lint code. - - name: Run flake8 - run: flake8 + - name: "Run flake8" + run: | + flake8 - - name: Run extra lint checks - run: "[ ! -x .ci/scripts/extra_linting.sh ] || .ci/scripts/extra_linting.sh" + - name: "Run extra lint checks" + run: | + [ ! -x .ci/scripts/extra_linting.sh ] || .ci/scripts/extra_linting.sh - # check for any files unintentionally left out of MANIFEST.in - - name: Check manifest - run: check-manifest + - name: "Check for any files unintentionally left out of MANIFEST.in" + run: | + check-manifest - - name: Check for pulpcore imports outside of pulpcore.plugin - run: sh .ci/scripts/check_pulpcore_imports.sh + - name: "Check for pulpcore imports outside of pulpcore.plugin" + run: | + sh .ci/scripts/check_pulpcore_imports.sh - - name: Check for gettext problems - run: sh .ci/scripts/check_gettext.sh + - name: "Check for common gettext problems" + run: | + sh .ci/scripts/check_gettext.sh diff --git a/templates/bootstrap/.bumpversion.cfg.j2 b/templates/bootstrap/.bumpversion.cfg.j2 index a034cb4c..267debd0 100644 --- a/templates/bootstrap/.bumpversion.cfg.j2 +++ b/templates/bootstrap/.bumpversion.cfg.j2 @@ -14,7 +14,7 @@ values = dev prod -"[bumpversion:file:./{{ plugin_name | snake }}/app/__init__.py]" +[bumpversion:file:./{{ plugin_name | snake }}/app/__init__.py] [bumpversion:file:./setup.py] diff --git a/templates/github/.github/workflows/lint.yml.j2 b/templates/github/.github/workflows/lint.yml.j2 index 6b0ab75e..dd88d444 100644 --- a/templates/github/.github/workflows/lint.yml.j2 +++ b/templates/github/.github/workflows/lint.yml.j2 @@ -15,7 +15,7 @@ defaults: jobs: lint: - runs-on: ubuntu-latest + runs-on: "ubuntu-latest" steps: {{ checkout(path=plugin_name) | indent(6) }} @@ -24,13 +24,17 @@ jobs: {{ install_python_deps(["-r", "lint_requirements.txt"]) | indent(6) }} - - name: Lint workflow files + - name: "Lint workflow files" run: | yamllint -s -d '{extends: relaxed, rules: {line-length: disable}}' .github/workflows + + - name: "Verify bump version config" + run: | + bump2version --dry-run --list release {%- if black %} # run black separately from flake8 to get a diff - - name: Run black + - name: "Run black" run: | black --version black --check --diff . @@ -38,25 +42,29 @@ jobs: {%- if flake8 %} # Lint code. - - name: Run flake8 - run: flake8 + - name: "Run flake8" + run: | + flake8 {%- endif %} - - name: Run extra lint checks - run: "[ ! -x .ci/scripts/extra_linting.sh ] || .ci/scripts/extra_linting.sh" + - name: "Run extra lint checks" + run: | + [ ! -x .ci/scripts/extra_linting.sh ] || .ci/scripts/extra_linting.sh {%- if check_manifest %} - # check for any files unintentionally left out of MANIFEST.in - - name: Check manifest - run: check-manifest + - name: "Check for any files unintentionally left out of MANIFEST.in" + run: | + check-manifest {%- endif %} {%- if check_stray_pulpcore_imports %} - - name: Check for pulpcore imports outside of pulpcore.plugin - run: sh .ci/scripts/check_pulpcore_imports.sh + - name: "Check for pulpcore imports outside of pulpcore.plugin" + run: | + sh .ci/scripts/check_pulpcore_imports.sh {%- endif %} {%- if check_gettext %} - - name: Check for gettext problems - run: sh .ci/scripts/check_gettext.sh + - name: "Check for common gettext problems" + run: | + sh .ci/scripts/check_gettext.sh {%- endif %} diff --git a/templates/github/lint_requirements.txt.j2 b/templates/github/lint_requirements.txt.j2 index 53bbd687..251bcf8f 100644 --- a/templates/github/lint_requirements.txt.j2 +++ b/templates/github/lint_requirements.txt.j2 @@ -4,6 +4,7 @@ {% if black -%} black==24.3.0 {% endif -%} +bump2version check-manifest flake8 {% if black -%}