diff --git a/template/.github/workflows/pr_pre-commit.yaml b/.github/workflows/pr_pre-commit.yml similarity index 51% rename from template/.github/workflows/pr_pre-commit.yaml rename to .github/workflows/pr_pre-commit.yml index c4be523c..a5436bd9 100644 --- a/template/.github/workflows/pr_pre-commit.yaml +++ b/.github/workflows/pr_pre-commit.yml @@ -4,14 +4,24 @@ name: pre-commit on: pull_request: +env: + CARGO_TERM_COLOR: always + RUST_TOOLCHAIN_VERSION: "1.80.1" + jobs: pre-commit: runs-on: ubuntu-latest steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + fetch-depth: 0 - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 with: python-version: '3.12' + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} + components: rustfmt,clippy - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 with: - extra_args: "" # Disable --all-files until we have time to fix druid/stackable/bin/run-druid + extra_args: "--from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}" diff --git a/.github/workflows/pr_reviewdog.yaml b/.github/workflows/pr_reviewdog.yaml deleted file mode 100644 index c08d8eef..00000000 --- a/.github/workflows/pr_reviewdog.yaml +++ /dev/null @@ -1,83 +0,0 @@ ---- -name: Pull Request Reviewdog - -on: - pull_request - -permissions: - contents: read - checks: write - pull-requests: write - issues: write - -jobs: - actionlint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: reviewdog/action-actionlint@fd627997c9688c2f39e13917aed23873c031b834 # v1.48.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - - flake8: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # tag=v5.1.0 - with: - python-version: "3.12" - - uses: reviewdog/action-flake8@99c2cfecdbc9111ec223b85b08af0e13a9a098dc # v3.10.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - - hadolint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: reviewdog/action-hadolint@66dae8a08183f1075386da9fff19a32512ddd31f # v1.42.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - - markdownlint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: reviewdog/action-markdownlint@8a1ef8f946e74c4d7119ec2489069a870b2a4e8f # v0.20.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - markdownlint_flags: '**/*(*.md|*.md.j2)' - - shellcheck: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: reviewdog/action-shellcheck@6e3a862f231c6895fbd335b70adef8f9243d5762 # v1.21.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - - yamllint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: reviewdog/action-yamllint@bc37f456f657881f4a007caa6e243cef03ec8a84 # v1.15.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - - misspell: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: reviewdog/action-misspell@8cd4a880dd86b1b175092c18c23cdec31283d654 # v1.19.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - locale: "US" - - languagetool: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: reviewdog/action-languagetool@52192aae941a664d2c51025fd113c95311ae7b65 # v1.15.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - level: info - patterns: "**/*.md **/*.txt **/*.adoc" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d31e4cb5..2365b0f4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,9 +1,9 @@ --- -# See https://pre-commit.com for more information -# See https://pre-commit.com/hooks.html for more hooks +fail_fast: false + repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: 2c9f875913ee60ca25ce70243dc24d5b6415598c # 4.6.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -11,30 +11,22 @@ repos: args: ["--allow-missing-credentials"] - id: detect-private-key - - repo: https://github.com/doublify/pre-commit-rust - rev: v1.0 - hooks: - - id: fmt - args: ["--all", "--", "--check"] - - id: clippy - args: ["--all-targets", "--", "-D", "warnings"] - - repo: https://github.com/adrienverge/yamllint - rev: v1.35.1 + rev: 81e9f98ffd059efe8aa9c1b1a42e5cce61b640c6 # 1.35.1 hooks: - id: yamllint types: [text] files: \.(yml|yaml)(\.j2)*$ - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.40.0 + rev: f295829140d25717bc79368d3f966fc1f67a824f # 0.41.0 hooks: - id: markdownlint types: [text] files: \.md(\.j2)*$ - repo: https://github.com/koalaman/shellcheck-precommit - rev: v0.10.0 + rev: 2491238703a5d3415bb2b7ff11388bf775372f29 # 0.10.0 hooks: - id: shellcheck args: ["--severity=info"] @@ -43,9 +35,19 @@ repos: # If you do not, you will need to delete the cached ruff binary shown in the # error message - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.1 + rev: f1ebc5730d98440041cc43e4d69829ad598ae1e7 # 0.6.3 hooks: # Run the linter. - id: ruff # Run the formatter. - id: ruff-format + + - repo: https://github.com/rhysd/actionlint + rev: 62dc61a45fc95efe8c800af7a557ab0b9165d63b # 1.7.1 + hooks: + - id: actionlint + + - repo: https://github.com/hadolint/hadolint + rev: b3555ba9c2bfd9401e79f2f0da68dd1ae38e10c7 # 2.12.0 + hooks: + - id: hadolint diff --git a/template/.github/workflows/pr_pre-commit.yaml.j2 b/template/.github/workflows/pr_pre-commit.yaml.j2 new file mode 100644 index 00000000..43194627 --- /dev/null +++ b/template/.github/workflows/pr_pre-commit.yaml.j2 @@ -0,0 +1,27 @@ +--- +name: pre-commit + +on: + pull_request: + +env: + CARGO_TERM_COLOR: always + RUST_TOOLCHAIN_VERSION: "{[ rust_version }]" + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + fetch-depth: 0 + - uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 + with: + python-version: '3.12' + - uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }} + components: rustfmt,clippy + - uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 + with: + extra_args: "--from-ref ${{ github.event.pull_request.base.sha }} --to-ref ${{ github.event.pull_request.head.sha }}" diff --git a/template/.github/workflows/pr_reviewdog.yaml b/template/.github/workflows/pr_reviewdog.yaml deleted file mode 100644 index 9b51e37a..00000000 --- a/template/.github/workflows/pr_reviewdog.yaml +++ /dev/null @@ -1,79 +0,0 @@ -# ============= -# This file is automatically generated from the templates in stackabletech/operator-templating -# DON'T MANUALLY EDIT THIS FILE -# ============= ---- -name: Pull Request Reviewdog - -on: - pull_request - -permissions: - contents: read - checks: write - pull-requests: write - issues: write - -jobs: - actionlint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: reviewdog/action-actionlint@fd627997c9688c2f39e13917aed23873c031b834 # v1.48.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - - hadolint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: reviewdog/action-hadolint@66dae8a08183f1075386da9fff19a32512ddd31f # v1.42.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - - markdownlint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: reviewdog/action-markdownlint@8a1ef8f946e74c4d7119ec2489069a870b2a4e8f # v0.20.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - markdownlint_flags: '**/*(*.md|*.md.j2)' - - shellcheck: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: reviewdog/action-shellcheck@6e3a862f231c6895fbd335b70adef8f9243d5762 # v1.21.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - - yamllint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: reviewdog/action-yamllint@bc37f456f657881f4a007caa6e243cef03ec8a84 # v1.15.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - - misspell: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: reviewdog/action-misspell@8cd4a880dd86b1b175092c18c23cdec31283d654 # v1.19.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - locale: "US" - # Ignore spellchecking generated files - exclude: | - ./Cargo.nix - - languagetool: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 - - uses: reviewdog/action-languagetool@52192aae941a664d2c51025fd113c95311ae7b65 # v1.15.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - level: info - patterns: "**/*.md **/*.txt **/*.adoc" diff --git a/template/.pre-commit-config.yaml.j2 b/template/.pre-commit-config.yaml.j2 index 9ededdf9..5a782f41 100644 --- a/template/.pre-commit-config.yaml.j2 +++ b/template/.pre-commit-config.yaml.j2 @@ -1,11 +1,9 @@ --- exclude: ^(Cargo\.nix|crate-hashes\.json|nix/.*)$ -# See https://pre-commit.com for more information -# See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: 2c9f875913ee60ca25ce70243dc24d5b6415598c # 4.6.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -14,7 +12,7 @@ repos: - id: detect-private-key - repo: https://github.com/doublify/pre-commit-rust - rev: v1.0 + rev: eeee35a89e69d5772bdee97db1a6a898467b686e # 1.0 hooks: - id: fmt args: ["--all", "--", "--check"] @@ -22,19 +20,19 @@ repos: args: ["--all-targets", "--", "-D", "warnings"] - repo: https://github.com/adrienverge/yamllint - rev: v1.35.1 + rev: 81e9f98ffd059efe8aa9c1b1a42e5cce61b640c6 # 1.35.1 hooks: - id: yamllint - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.40.0 + rev: f295829140d25717bc79368d3f966fc1f67a824f # 0.41.0 hooks: - id: markdownlint types: [text] files: \.md(\.j2)*$ - repo: https://github.com/koalaman/shellcheck-precommit - rev: v0.10.0 + rev: 2491238703a5d3415bb2b7ff11388bf775372f29 # 0.10.0 hooks: - id: shellcheck args: ["--severity=info"] @@ -43,13 +41,23 @@ repos: # If you do not, you will need to delete the cached ruff binary shown in the # error message - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.1 + rev: f1ebc5730d98440041cc43e4d69829ad598ae1e7 # 0.6.3 hooks: # Run the linter. - id: ruff # Run the formatter. - id: ruff-format + - repo: https://github.com/rhysd/actionlint + rev: 62dc61a45fc95efe8c800af7a557ab0b9165d63b # 1.7.1 + hooks: + - id: actionlint + + - repo: https://github.com/hadolint/hadolint + rev: b3555ba9c2bfd9401e79f2f0da68dd1ae38e10c7 # 2.12.0 + hooks: + - id: hadolint + - repo: local hooks: - id: regenerate-charts