From 8eba8b8877d854ae3d3fa8e3e07af07230d56f15 Mon Sep 17 00:00:00 2001 From: Markus Hofauer Date: Sun, 8 Dec 2024 18:22:15 +0100 Subject: [PATCH 1/2] ci(pre-commit): Add pre-commit job --- .github/workflows/ci.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4d9f6017f..4ca72a46d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -138,11 +138,16 @@ jobs: - name: Verify bcr patches if: matrix.folder == '.' && matrix.bzlmod == '1' && matrix.os == 'ubuntu' && matrix.bazel-version.major != '6' run: patch --dry-run -p1 < .bcr/patches/*.patch + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pre-commit/action@v3.0.1 # For branch protection settings, this job provides a "stable" name that can be used to gate PR merges # on "all matrix jobs were successful". conclusion: - needs: test + needs: [test, pre-commit] runs-on: ubuntu-latest if: always() steps: From ad6d72d9baa0b2104e5619b6a76ea2722906e962 Mon Sep 17 00:00:00 2001 From: Markus Hofauer Date: Sun, 8 Dec 2024 18:31:28 +0100 Subject: [PATCH 2/2] fix all pre-commit errors --- .github/workflows/ci.yaml | 3 --- .shellcheckrc | 2 +- .typos.toml | 1 + e2e/smoke/BUILD.bazel | 12 ++++++++---- e2e/smoke/MODULE.bazel | 2 +- e2e/smoke/test_preserve_mtime.go | 14 +++++++------- lib/private/tar.bzl | 2 +- lib/tests/expand_template/index.html | 2 +- lib/tests/transitions/BUILD.bazel | 10 ++++++++-- .../config/vocabularies/engineering/accept.txt | 2 +- .../config/vocabularies/engineering/reject.txt | 2 +- 11 files changed, 30 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4ca72a46d..9d1a5dc39 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -143,7 +143,6 @@ jobs: steps: - uses: actions/checkout@v4 - uses: pre-commit/action@v3.0.1 - # For branch protection settings, this job provides a "stable" name that can be used to gate PR merges # on "all matrix jobs were successful". conclusion: @@ -152,14 +151,12 @@ jobs: if: always() steps: - uses: technote-space/workflow-conclusion-action@45ce8e0eb155657ab8ccf346ade734257fd196a5 # v3.0.3 - # Note: possible conclusion values: # https://github.com/technote-space/workflow-conclusion-action/blob/main/src/constant.ts - name: report success if: ${{ env.WORKFLOW_CONCLUSION == 'success' }} working-directory: /tmp run: echo ${{ env.WORKFLOW_CONCLUSION }} && exit 0 - - name: report failure if: ${{ env.WORKFLOW_CONCLUSION == 'failure' }} working-directory: /tmp diff --git a/.shellcheckrc b/.shellcheckrc index aade3f932..2b520be00 100644 --- a/.shellcheckrc +++ b/.shellcheckrc @@ -3,4 +3,4 @@ enable=quote-safe-variables # Turn on warnings for unassigned uppercase variables enable=check-unassigned-uppercase -#enable=require-variable-braces \ No newline at end of file +#enable=require-variable-braces diff --git a/.typos.toml b/.typos.toml index b14a95245..b13744aeb 100644 --- a/.typos.toml +++ b/.typos.toml @@ -1,2 +1,3 @@ [default.extend-identifiers] MODULEs = "MODULEs" # Else it becomes MODULEEs +HashiCorp = "HashiCorp" diff --git a/e2e/smoke/BUILD.bazel b/e2e/smoke/BUILD.bazel index a2d83caf1..3339485aa 100644 --- a/e2e/smoke/BUILD.bazel +++ b/e2e/smoke/BUILD.bazel @@ -121,9 +121,6 @@ go_test( name = "test_preserve_mtime", size = "small", srcs = ["test_preserve_mtime.go"], - deps = [ - "@io_bazel_rules_go//go/tools/bazel:go_default_library", - ], data = [ "d", ":copy_directory_mtime_case", @@ -135,5 +132,12 @@ go_test( # bazel test :test_preserve_mtime # This test should pass # touch d/1 # Update the mtime, in the CI environment this is done with the SCM integration. # bazel test :test_preserve_mtime # This test now fails - tags = ["no-remote", "external", "manual"], + tags = [ + "external", + "manual", + "no-remote", + ], + deps = [ + "@io_bazel_rules_go//go/tools/bazel:go_default_library", + ], ) diff --git a/e2e/smoke/MODULE.bazel b/e2e/smoke/MODULE.bazel index 9149c6bf6..88cfbc721 100644 --- a/e2e/smoke/MODULE.bazel +++ b/e2e/smoke/MODULE.bazel @@ -5,4 +5,4 @@ local_path_override( ) bazel_dep(name = "bazel_skylib", version = "1.7.1", dev_dependency = True) -bazel_dep(name = "rules_go", version = "0.50.1", repo_name = "io_bazel_rules_go", dev_dependency = True) +bazel_dep(name = "rules_go", version = "0.50.1", dev_dependency = True, repo_name = "io_bazel_rules_go") diff --git a/e2e/smoke/test_preserve_mtime.go b/e2e/smoke/test_preserve_mtime.go index 7c1bb1b7e..cf334aff6 100644 --- a/e2e/smoke/test_preserve_mtime.go +++ b/e2e/smoke/test_preserve_mtime.go @@ -26,7 +26,7 @@ func mtime(path string) (time.Time, error) { func (r runfilePath) osPath() (string, error) { dirPath, err := bazel.Runfile(r.runfileDir) - if err != nil{ + if err != nil { return "", err } parts := append([]string{dirPath}, r.subPaths...) @@ -34,28 +34,28 @@ func (r runfilePath) osPath() (string, error) { } func TestPreserveMTime(t *testing.T) { - cases := map[string]struct{ + cases := map[string]struct { original runfilePath - copied runfilePath + copied runfilePath }{ "copy_directory": { original: runfilePath{ runfileDir: "d", - subPaths: []string{"1"}, + subPaths: []string{"1"}, }, copied: runfilePath{ runfileDir: "copy_directory_mtime_out", - subPaths: []string{"1"}, + subPaths: []string{"1"}, }, }, "copy_to_directory": { original: runfilePath{ runfileDir: "d", - subPaths: []string{"1"}, + subPaths: []string{"1"}, }, copied: runfilePath{ runfileDir: "copy_to_directory_mtime_out", - subPaths: []string{"d", "1"}, + subPaths: []string{"d", "1"}, }, }, } diff --git a/lib/private/tar.bzl b/lib/private/tar.bzl index 9e201c949..21958fe2d 100644 --- a/lib/private/tar.bzl +++ b/lib/private/tar.bzl @@ -175,7 +175,7 @@ def _is_unused_inputs_enabled(attr): return False if attr.compute_unused_inputs == -1: return attr._compute_unused_inputs_flag[BuildSettingInfo].value - + fail("Unexpected `compute_unused_inputs` value: {}".format(attr.compute_unused_inputs)) def _is_unprunable(file): diff --git a/lib/tests/expand_template/index.html b/lib/tests/expand_template/index.html index 328c71080..ec2cc0dc0 100644 --- a/lib/tests/expand_template/index.html +++ b/lib/tests/expand_template/index.html @@ -1,4 +1,4 @@ - + diff --git a/lib/tests/transitions/BUILD.bazel b/lib/tests/transitions/BUILD.bazel index 48abfc89c..a7876edd1 100644 --- a/lib/tests/transitions/BUILD.bazel +++ b/lib/tests/transitions/BUILD.bazel @@ -137,7 +137,10 @@ platform_transition_test( name = "transitioned_go_test_x86_64", binary = ":test_transition_test", # only run this test on an x86_64 host - target_compatible_with = [] if sorted(HOST_CONSTRAINTS) == ["@platforms//cpu:x86_64", "@platforms//os:linux"] else ["@platforms//:incompatible"], + target_compatible_with = [] if sorted(HOST_CONSTRAINTS) == [ + "@platforms//cpu:x86_64", + "@platforms//os:linux", + ] else ["@platforms//:incompatible"], target_platform = "x86_64_linux", ) @@ -145,7 +148,10 @@ platform_transition_test( name = "transitioned_go_test_arm64", binary = ":test_transition_test", # only run this test on an x86_64 host - target_compatible_with = [] if sorted(HOST_CONSTRAINTS) == ["@platforms//cpu:aarch64", "@platforms//os:linux"] else ["@platforms//:incompatible"], + target_compatible_with = [] if sorted(HOST_CONSTRAINTS) == [ + "@platforms//cpu:aarch64", + "@platforms//os:linux", + ] else ["@platforms//:incompatible"], target_platform = "arm64_linux", ) diff --git a/tools/lint/vale/config/vocabularies/engineering/accept.txt b/tools/lint/vale/config/vocabularies/engineering/accept.txt index 39935fc48..c65201944 100644 --- a/tools/lint/vale/config/vocabularies/engineering/accept.txt +++ b/tools/lint/vale/config/vocabularies/engineering/accept.txt @@ -62,7 +62,7 @@ rebase mutex hotfix oncall -poisioning +poisoning statefulness teardown toolchain diff --git a/tools/lint/vale/config/vocabularies/engineering/reject.txt b/tools/lint/vale/config/vocabularies/engineering/reject.txt index ba0e162e1..5716ca598 100644 --- a/tools/lint/vale/config/vocabularies/engineering/reject.txt +++ b/tools/lint/vale/config/vocabularies/engineering/reject.txt @@ -1 +1 @@ -bar \ No newline at end of file +bar