Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(pre-commit): Add pre-commit CI job #1002

Merged
merged 3 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,15 @@ 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/[email protected]
# 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:
Expand Down
2 changes: 1 addition & 1 deletion .shellcheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ enable=quote-safe-variables
# Turn on warnings for unassigned uppercase variables
enable=check-unassigned-uppercase

#enable=require-variable-braces
#enable=require-variable-braces
1 change: 1 addition & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[default.extend-identifiers]
MODULEs = "MODULEs" # Else it becomes MODULEEs
HashiCorp = "HashiCorp"
12 changes: 8 additions & 4 deletions e2e/smoke/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
],
)
2 changes: 1 addition & 1 deletion e2e/smoke/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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")
14 changes: 7 additions & 7 deletions e2e/smoke/test_preserve_mtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,36 @@ 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...)
return filepath.Join(parts...), nil
}

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"},
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion lib/private/tar.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion lib/tests/expand_template/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<script src="index.ts"></script>
Expand Down
10 changes: 8 additions & 2 deletions lib/tests/transitions/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,21 @@ 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",
)

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",
)

Expand Down
2 changes: 1 addition & 1 deletion tools/lint/vale/config/vocabularies/engineering/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ rebase
mutex
hotfix
oncall
poisioning
alexeagle marked this conversation as resolved.
Show resolved Hide resolved
poisoning
statefulness
teardown
toolchain
Expand Down
2 changes: 1 addition & 1 deletion tools/lint/vale/config/vocabularies/engineering/reject.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
bar
bar
Loading