mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 18:51:59 +00:00
Due to an issue with Autogold and Bazel, we have to migrate all `autogold` tests to use the `v2`. This draft PR loses some annotations describing the test cases, but I'll update that after once I have validate that we can get those to work with Bazel. Why is this a huge PR and not a couple of smaller ones: Because this PR needed a few manual fixes, it was simpler to grind through the changes after running comby locally. I have attached the config below so you can review what I used instead. @chwarwick the code insights tests were heavily relying on the attached description on `autogold.Want` to provide context, I manually ported them by adding a new `name string` field on the test cases. Comby config I used: ``` [update-imports] match="\"github.com/hexops/autogold\"" rewrite="\"github.com/hexops/autogold/v2\"" [update-api-want] match="autogold.Want(:[desc], :[v])" rewrite="autogold.Expect(:[v])" [update-api-equal] match="autogold.Equal(:[v])" rewrite="autogold.ExpectFile(:[v])" ``` ``` $ comby -config ../autogold-comby.toml -matcher .go -exclude-dir vendor,node_modules -in-place ``` I then followed up with some manual fixes for the test cases that were making the assumption that `want.Name()` exists. ## Test plan <!-- All pull requests REQUIRE a test plan: https://docs.sourcegraph.com/dev/background-information/testing_principles --> Green go tests. --------- Co-authored-by: davejrt <davetry@gmail.com>
175 lines
5.4 KiB
Python
175 lines
5.4 KiB
Python
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
|
|
|
http_archive(
|
|
name = "bazel_skylib",
|
|
sha256 = "74d544d96f4a5bb630d465ca8bbcfe231e3594e5aae57e1edbf17a6eb3ca2506",
|
|
urls = [
|
|
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
|
|
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.3.0/bazel-skylib-1.3.0.tar.gz",
|
|
],
|
|
)
|
|
|
|
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
|
|
|
|
bazel_skylib_workspace()
|
|
|
|
http_archive(
|
|
name = "aspect_bazel_lib",
|
|
sha256 = "dce068f085e9eabfec6d795caaabdbbe4a73550810f3cae3035aff7162e42b3c",
|
|
strip_prefix = "bazel-lib-1.26.2",
|
|
url = "https://github.com/aspect-build/bazel-lib/releases/download/v1.26.2/bazel-lib-v1.26.2.tar.gz",
|
|
)
|
|
|
|
http_archive(
|
|
name = "aspect_rules_js",
|
|
sha256 = "9fadde0ae6e0101755b8aedabf7d80b166491a8de297c60f6a5179cd0d0fea58",
|
|
strip_prefix = "rules_js-1.20.0",
|
|
url = "https://github.com/aspect-build/rules_js/releases/download/v1.20.0/rules_js-v1.20.0.tar.gz",
|
|
)
|
|
|
|
http_archive(
|
|
name = "rules_nodejs",
|
|
sha256 = "08337d4fffc78f7fe648a93be12ea2fc4e8eb9795a4e6aa48595b66b34555626",
|
|
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.0/rules_nodejs-core-5.8.0.tar.gz"],
|
|
)
|
|
|
|
http_archive(
|
|
name = "aspect_rules_ts",
|
|
sha256 = "db77d904284d21121ae63dbaaadfd8c75ff6d21ad229f92038b415c1ad5019cc",
|
|
strip_prefix = "rules_ts-1.3.0",
|
|
url = "https://github.com/aspect-build/rules_ts/releases/download/v1.3.0/rules_ts-v1.3.0.tar.gz",
|
|
)
|
|
|
|
http_archive(
|
|
name = "aspect_rules_jest",
|
|
sha256 = "fa103b278137738ef08fd23d3c8c9157897a7159af2aa22714bc71680da58583",
|
|
strip_prefix = "rules_jest-0.16.1",
|
|
url = "https://github.com/aspect-build/rules_jest/archive/refs/tags/v0.16.1.tar.gz",
|
|
)
|
|
|
|
http_archive(
|
|
name = "io_bazel_rules_go",
|
|
sha256 = "56d8c5a5c91e1af73eca71a6fab2ced959b67c86d12ba37feedb0a2dfea441a6",
|
|
urls = [
|
|
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.37.0/rules_go-v0.37.0.zip",
|
|
"https://github.com/bazelbuild/rules_go/releases/download/v0.37.0/rules_go-v0.37.0.zip",
|
|
],
|
|
)
|
|
|
|
http_archive(
|
|
name = "rules_buf",
|
|
sha256 = "523a4e06f0746661e092d083757263a249fedca535bd6dd819a8c50de074731a",
|
|
strip_prefix = "rules_buf-0.1.1",
|
|
urls = [
|
|
"https://github.com/bufbuild/rules_buf/archive/refs/tags/v0.1.1.zip",
|
|
],
|
|
)
|
|
|
|
http_archive(
|
|
name = "bazel_gazelle",
|
|
sha256 = "ecba0f04f96b4960a5b250c8e8eeec42281035970aa8852dda73098274d14a1d",
|
|
urls = [
|
|
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz",
|
|
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz",
|
|
],
|
|
)
|
|
|
|
http_archive(
|
|
name = "com_google_protobuf",
|
|
sha256 = "6aff9834fd7c540875e1836967c8d14c6897e3785a2efac629f69860fb7834ff",
|
|
strip_prefix = "protobuf-3.15.0",
|
|
urls = [
|
|
"https://github.com/protocolbuffers/protobuf/archive/v3.15.0.tar.gz",
|
|
],
|
|
)
|
|
|
|
# Node toolchain setup ==========================
|
|
load("@rules_nodejs//nodejs:repositories.bzl", "DEFAULT_NODE_VERSION", "nodejs_register_toolchains")
|
|
|
|
nodejs_register_toolchains(
|
|
name = "nodejs",
|
|
node_version = DEFAULT_NODE_VERSION,
|
|
)
|
|
|
|
# rules_js setup ================================
|
|
load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
|
|
|
|
rules_js_dependencies()
|
|
|
|
# rules_js npm setup ============================
|
|
load("@aspect_rules_js//npm:npm_import.bzl", "npm_translate_lock")
|
|
|
|
npm_translate_lock(
|
|
name = "npm",
|
|
npmrc = "//:.npmrc",
|
|
pnpm_lock = "//:pnpm-lock.yaml",
|
|
verify_node_modules_ignored = "//:.bazelignore",
|
|
)
|
|
|
|
# rules_ts npm setup ============================
|
|
load("@npm//:repositories.bzl", "npm_repositories")
|
|
|
|
npm_repositories()
|
|
|
|
load("@aspect_rules_ts//ts:repositories.bzl", "rules_ts_dependencies")
|
|
|
|
rules_ts_dependencies(ts_version = "4.9.5")
|
|
|
|
# rules_jest setup ==============================
|
|
load("@aspect_rules_jest//jest:dependencies.bzl", "rules_jest_dependencies")
|
|
|
|
rules_jest_dependencies()
|
|
|
|
load("@aspect_rules_jest//jest:repositories.bzl", "jest_repositories")
|
|
|
|
jest_repositories(
|
|
name = "jest",
|
|
jest_version = "v28.1.0",
|
|
)
|
|
|
|
load("@jest//:npm_repositories.bzl", jest_npm_repositories = "npm_repositories")
|
|
|
|
jest_npm_repositories()
|
|
|
|
# Go toolchain setup
|
|
|
|
load("@rules_buf//buf:repositories.bzl", "rules_buf_dependencies", "rules_buf_toolchains")
|
|
|
|
rules_buf_dependencies()
|
|
|
|
rules_buf_toolchains(version = "v1.11.0")
|
|
|
|
load("@rules_buf//gazelle/buf:repositories.bzl", "gazelle_buf_dependencies")
|
|
|
|
gazelle_buf_dependencies()
|
|
|
|
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
|
|
|
|
rules_proto_dependencies()
|
|
|
|
rules_proto_toolchains()
|
|
|
|
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
|
|
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
|
|
load("//:deps.bzl", "go_dependencies")
|
|
|
|
go_repository(
|
|
name = "com_github_aws_aws_sdk_go_v2_service_ssooidc",
|
|
importpath = "github.com/aws/aws-sdk-go-v2/service/ssooidc",
|
|
sum = "h1:0bLhH6DRAqox+g0LatcjGKjjhU6Eudyys6HB6DJVPj8=",
|
|
version = "v1.14.1",
|
|
)
|
|
|
|
# gazelle:repository_macro deps.bzl%go_dependencies
|
|
go_dependencies()
|
|
|
|
go_rules_dependencies()
|
|
|
|
go_register_toolchains(version = "1.19.3")
|
|
|
|
gazelle_dependencies()
|
|
|
|
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
|
|
|
|
protobuf_deps()
|