-
Notifications
You must be signed in to change notification settings - Fork 204
feature/issue-345-bazel-build-go #511
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
Open
njlr
wants to merge
13
commits into
GoogleContainerTools:main
Choose a base branch
from
njlr:feature/issue-345-bazel-build-go
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
8594bf3
Adds BUILD files generated by Gazelle
njlr 7c6237a
Revert WORKSPACE
njlr 318bdd2
Mark Gazelle as dev dep
njlr 13d0ae4
Remove comments
njlr e6b3339
Update cmd/container-structure-test/app/BUILD.bazel
njlr a8db82e
Update cmd/container-structure-test/app/cmd/BUILD.bazel
njlr 81c5b69
Update cmd/container-structure-test/app/cmd/test/BUILD.bazel
njlr c53c0a9
Update pkg/types/v2/BUILD.bazel
njlr 8870ca3
Update cmd/container-structure-test/app/flags/BUILD.bazel
njlr 014d655
Update pkg/types/BUILD.bazel
njlr 68ed6f5
Switch gazelle from dev_dependency
njlr b1f9f19
Merge branch 'feature/issue-345-bazel-build-go' of https://github.com…
njlr ed3885b
Update Bazel versions
njlr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 8.3.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,7 +11,7 @@ concurrency: | |
| # More info: https://stackoverflow.com/a/70972844/1261287 | ||
| group: ${{ github.ref }} | ||
| cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} | ||
|
|
||
| jobs: | ||
| build: | ||
| name: PR unit tests | ||
|
|
@@ -20,21 +20,21 @@ jobs: | |
| os: [ubuntu-latest, macos-12] | ||
| fail-fast: false | ||
| runs-on: ${{ matrix.os }} | ||
|
|
||
| steps: | ||
| - name: start docker | ||
| if: ${{ matrix.os == 'macos-12' }} | ||
| run: | | ||
| brew install docker | ||
| colima start | ||
| echo "DOCKER_HOST=unix:///Users/runner/.colima/default/docker.sock" >> $GITHUB_ENV | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v5 | ||
| with: | ||
| go-version: ^1.22 | ||
| id: go | ||
|
|
||
| - uses: imjasonh/[email protected] | ||
|
|
||
| - name: Check out code into the Go module directory | ||
|
|
@@ -45,3 +45,9 @@ jobs: | |
| - name: Run tests | ||
| run: | | ||
| make test | ||
|
|
||
| # Ensure that Bazel build is maintained | ||
| - name: Bazel | ||
| run: | | ||
| bazel build //... | ||
| bazel test //... | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,11 +1,14 @@ | ||
| load("@bazel_skylib//:bzl_library.bzl", "bzl_library") | ||
| load("@gazelle//:def.bzl", "gazelle") | ||
|
|
||
| # For stardoc to reference the file directly | ||
| exports_files(["defs.bzl"]) | ||
|
|
||
| bzl_library( | ||
| name = "defs", | ||
| srcs = ["defs.bzl"], | ||
| deps = ["//bazel:container_structure_test"], | ||
| visibility = ["//visibility:public"], | ||
| deps = ["//bazel:container_structure_test"], | ||
| ) | ||
|
|
||
| gazelle(name = "gazelle") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| load("@rules_go//go:def.bzl", "go_binary", "go_library") | ||
|
|
||
| go_library( | ||
| name = "container-structure-test_lib", | ||
| srcs = ["container-structure-test.go"], | ||
| importpath = "github.com/GoogleContainerTools/container-structure-test/cmd/container-structure-test", | ||
| visibility = ["//visibility:private"], | ||
| deps = [ | ||
| "//cmd/container-structure-test/app", | ||
| "@com_github_sirupsen_logrus//:go_default_library", | ||
| ], | ||
| ) | ||
|
|
||
| go_binary( | ||
| name = "container-structure-test", | ||
| embed = [":container-structure-test_lib"], | ||
| visibility = ["//visibility:public"], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "app", | ||
| srcs = ["container-structure-test.go"], | ||
| importpath = "github.com/GoogleContainerTools/container-structure-test/cmd/container-structure-test/app", | ||
| visibility = ["//visibility:public"], | ||
| deps = ["//cmd/container-structure-test/app/cmd"], | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "cmd", | ||
| srcs = [ | ||
| "cmd.go", | ||
| "test.go", | ||
| "version.go", | ||
| ], | ||
| importpath = "github.com/GoogleContainerTools/container-structure-test/cmd/container-structure-test/app/cmd", | ||
| visibility = ["//visibility:public"], | ||
njlr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| deps = [ | ||
| "//cmd/container-structure-test/app/cmd/test", | ||
| "//cmd/container-structure-test/app/flags", | ||
| "//pkg/color", | ||
| "//pkg/config", | ||
| "//pkg/drivers", | ||
| "//pkg/output", | ||
| "//pkg/types/unversioned", | ||
| "//pkg/utils", | ||
| "//pkg/version", | ||
| "@com_github_fsouza_go_dockerclient//:go_default_library", | ||
| "@com_github_google_go_containerregistry//pkg/name:go_default_library", | ||
| "@com_github_google_go_containerregistry//pkg/v1/daemon:go_default_library", | ||
| "@com_github_google_go_containerregistry//pkg/v1/layout:go_default_library", | ||
| "@com_github_opencontainers_image_spec//specs-go/v1:go_default_library", | ||
| "@com_github_pkg_errors//:go_default_library", | ||
| "@com_github_sirupsen_logrus//:go_default_library", | ||
| "@com_github_spf13_cobra//:go_default_library", | ||
| ], | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "test", | ||
| srcs = ["util.go"], | ||
| importpath = "github.com/GoogleContainerTools/container-structure-test/cmd/container-structure-test/app/cmd/test", | ||
| visibility = ["//visibility:public"], | ||
njlr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| deps = [ | ||
| "//pkg/config", | ||
| "//pkg/drivers", | ||
| "//pkg/output", | ||
| "//pkg/types", | ||
| "//pkg/types/unversioned", | ||
| "@com_github_pkg_errors//:go_default_library", | ||
| "@in_gopkg_yaml_v2//:go_default_library", | ||
| ], | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "flags", | ||
| srcs = ["template.go"], | ||
| importpath = "github.com/GoogleContainerTools/container-structure-test/cmd/container-structure-test/app/flags", | ||
| visibility = ["//visibility:public"], | ||
njlr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| deps = ["@com_github_pkg_errors//:go_default_library"], | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "pkgutil", | ||
| srcs = [ | ||
| "fs_utils.go", | ||
| "image_utils.go", | ||
| "tar_utils.go", | ||
| "transport_builder.go", | ||
| ], | ||
| importpath = "github.com/GoogleContainerTools/container-structure-test/internal/pkgutil", | ||
| visibility = ["//:__subpackages__"], | ||
| deps = [ | ||
| "@com_github_google_go_containerregistry//pkg/authn:go_default_library", | ||
| "@com_github_google_go_containerregistry//pkg/name:go_default_library", | ||
| "@com_github_google_go_containerregistry//pkg/v1:go_default_library", | ||
| "@com_github_google_go_containerregistry//pkg/v1/daemon:go_default_library", | ||
| "@com_github_google_go_containerregistry//pkg/v1/mutate:go_default_library", | ||
| "@com_github_google_go_containerregistry//pkg/v1/remote:go_default_library", | ||
| "@com_github_google_go_containerregistry//pkg/v1/tarball:go_default_library", | ||
| "@com_github_moby_sys_sequential//:go_default_library", | ||
| "@com_github_pkg_errors//:go_default_library", | ||
| "@com_github_sirupsen_logrus//:go_default_library", | ||
| ], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| load("@rules_go//go:def.bzl", "go_library", "go_test") | ||
|
|
||
| go_library( | ||
| name = "color", | ||
| srcs = ["formatter.go"], | ||
| importpath = "github.com/GoogleContainerTools/container-structure-test/pkg/color", | ||
| visibility = ["//visibility:public"], | ||
| deps = ["@org_golang_x_crypto//ssh/terminal:go_default_library"], | ||
| ) | ||
|
|
||
| go_test( | ||
| name = "color_test", | ||
| srcs = ["formatter_test.go"], | ||
| embed = [":color"], | ||
| deps = ["//testutil"], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "config", | ||
| srcs = ["options.go"], | ||
| importpath = "github.com/GoogleContainerTools/container-structure-test/pkg/config", | ||
| visibility = ["//visibility:public"], | ||
| deps = ["//pkg/types/unversioned"], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "drivers", | ||
| srcs = [ | ||
| "docker_driver.go", | ||
| "driver.go", | ||
| "host_driver.go", | ||
| "tar_driver.go", | ||
| ], | ||
| importpath = "github.com/GoogleContainerTools/container-structure-test/pkg/drivers", | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| "//internal/pkgutil", | ||
| "//pkg/types/unversioned", | ||
| "//pkg/utils", | ||
| "@com_github_fsouza_go_dockerclient//:go_default_library", | ||
| "@com_github_google_go_containerregistry//pkg/v1:go_default_library", | ||
| "@com_github_google_go_containerregistry//pkg/v1/mutate:go_default_library", | ||
| "@com_github_joho_godotenv//:go_default_library", | ||
| "@com_github_pkg_errors//:go_default_library", | ||
| "@com_github_sirupsen_logrus//:go_default_library", | ||
| ], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| load("@rules_go//go:def.bzl", "go_library", "go_test") | ||
|
|
||
| go_library( | ||
| name = "output", | ||
| srcs = ["output.go"], | ||
| importpath = "github.com/GoogleContainerTools/container-structure-test/pkg/output", | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| "//pkg/color", | ||
| "//pkg/types/unversioned", | ||
| "@com_github_pkg_errors//:go_default_library", | ||
| ], | ||
| ) | ||
|
|
||
| go_test( | ||
| name = "output_test", | ||
| srcs = ["output_test.go"], | ||
| embed = [":output"], | ||
| deps = ["//pkg/types/unversioned"], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "types", | ||
| srcs = ["types.go"], | ||
| importpath = "github.com/GoogleContainerTools/container-structure-test/pkg/types", | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| "//pkg/drivers", | ||
| "//pkg/types/v1", | ||
| "//pkg/types/v2:types", | ||
njlr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ], | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "unversioned", | ||
| srcs = ["types.go"], | ||
| importpath = "github.com/GoogleContainerTools/container-structure-test/pkg/types/unversioned", | ||
| visibility = ["//visibility:public"], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "v1", | ||
| srcs = [ | ||
| "command.go", | ||
| "file_content.go", | ||
| "file_existence.go", | ||
| "licenses.go", | ||
| "structure.go", | ||
| ], | ||
| importpath = "github.com/GoogleContainerTools/container-structure-test/pkg/types/v1", | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| "//pkg/drivers", | ||
| "//pkg/types/unversioned", | ||
| "//pkg/utils", | ||
| "@com_github_pkg_errors//:go_default_library", | ||
| "@com_github_sirupsen_logrus//:go_default_library", | ||
| ], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "types", | ||
njlr marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| srcs = [ | ||
| "command.go", | ||
| "file_content.go", | ||
| "file_existence.go", | ||
| "licenses.go", | ||
| "metadata.go", | ||
| "structure.go", | ||
| ], | ||
| importpath = "github.com/GoogleContainerTools/container-structure-test/pkg/types/v2", | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| "//pkg/drivers", | ||
| "//pkg/types/unversioned", | ||
| "//pkg/utils", | ||
| "@com_github_pkg_errors//:go_default_library", | ||
| "@com_github_sirupsen_logrus//:go_default_library", | ||
| ], | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "utils", | ||
| srcs = ["utils.go"], | ||
| importpath = "github.com/GoogleContainerTools/container-structure-test/pkg/utils", | ||
| visibility = ["//visibility:public"], | ||
| deps = ["@com_github_sirupsen_logrus//:go_default_library"], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| load("@rules_go//go:def.bzl", "go_library") | ||
|
|
||
| go_library( | ||
| name = "version", | ||
| srcs = ["version.go"], | ||
| importpath = "github.com/GoogleContainerTools/container-structure-test/pkg/version", | ||
| visibility = ["//visibility:public"], | ||
| ) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.