From 596469b46aa80a5e97876e9c6792864aee1b6724 Mon Sep 17 00:00:00 2001
From: pratikbalar <68642400+pratikbalar@users.noreply.github.com>
Date: Sat, 26 Feb 2022 12:32:21 +0530
Subject: [PATCH 01/46] ci: test remove bazel with buildbuddy
---
.bazelrc | 17 ++
.github/workflows/test.yaml | 23 +--
.gitignore | 26 +++
BUILD | 14 ++
WORKSPACE | 357 ++++++++++++++++++++++++++++++++++++
cmd/zipper/BUILD.bazel | 18 ++
internal/zipper/BUILD.bazel | 25 +++
pkg/BUILD.bazel | 15 ++
8 files changed, 480 insertions(+), 15 deletions(-)
create mode 100644 .bazelrc
create mode 100644 BUILD
create mode 100644 WORKSPACE
create mode 100644 cmd/zipper/BUILD.bazel
create mode 100644 internal/zipper/BUILD.bazel
create mode 100644 pkg/BUILD.bazel
diff --git a/.bazelrc b/.bazelrc
new file mode 100644
index 0000000..d532692
--- /dev/null
+++ b/.bazelrc
@@ -0,0 +1,17 @@
+build:remote --remote_cache=grpcs://remote.buildbuddy.io
+build:remote --remote_executor=grpcs://remote.buildbuddy.io
+build:remote --remote_upload_local_results
+build:remote --host_platform=@buildbuddy_toolchain//:platform
+build:remote --platforms=@buildbuddy_toolchain//:platform
+build:remote --crosstool_top=@buildbuddy_toolchain//:toolchain
+build:remote --jobs=100
+build:remote --define=EXECUTOR=remote
+
+build:remote --extra_execution_platforms=@buildbuddy_toolchain//:platform
+build:remote --extra_toolchains=@buildbuddy_toolchain//:cc_toolchain
+
+build:ci --config=remote
+build:ci --build_metadata=VISIBILITY=PUBLIC
+build:ci --build_metadata=ROLE=CI
+build:ci --bes_results_url=https://app.buildbuddy.io/invocation/
+build:ci --bes_backend=grpcs://remote.buildbuddy.io
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 2e413cc..38ec643 100755
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -8,25 +8,18 @@ jobs:
strategy:
fail-fast: false
matrix:
- os: [ubuntu-latest, macos-latest, windows-latest]
+ os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- - uses: actions/setup-go@v2
- with:
- go-version: 1.17.x
+ - uses: bazelbuild/setup-bazelisk@v1
- - uses: actions/cache@v2
- with:
- path: |
- ~/Library/Caches/go-build
- %LocalAppData%\go-build
- ~/.cache/go-build
- ~/go/pkg/mod
- key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
- restore-keys: |
- ${{ runner.os }}-go-
+ - run: |
+ bazel build //... --config=remote
- run: |
- go test -race ./...
+ bazelisk test \
+ --config=ci \
+ --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} \
+ //...
diff --git a/.gitignore b/.gitignore
index f381228..b126e38 100755
--- a/.gitignore
+++ b/.gitignore
@@ -28,3 +28,29 @@ mem.pprof
cpu.prof
cpu.pprof
trace.out
+
+# Ignore backup files.
+*~
+# Ignore Vim swap files.
+.*.swp
+# Ignore files generated by IDEs.
+/.classpath
+/.factorypath
+/.idea/
+/.ijwb/
+/.project
+/.settings
+/.vscode/
+/bazel.iml
+# Ignore all bazel-* symlinks. There is no full list since this can change
+# based on the name of the directory bazel is cloned into.
+/bazel-*
+# Ignore outputs generated during Bazel bootstrapping.
+/output/
+# Ignore jekyll build output.
+/production
+/.sass-cache
+# Bazelisk version file
+.bazelversion
+# User-specific .bazelrc
+user.bazelrc
diff --git a/BUILD b/BUILD
new file mode 100644
index 0000000..9b9dcb2
--- /dev/null
+++ b/BUILD
@@ -0,0 +1,14 @@
+load("@bazel_gazelle//:def.bzl", "gazelle")
+
+# gazelle:prefix github.com/pratikbalar/zipper
+gazelle(name = "gazelle")
+
+gazelle(
+ name = "gazelle-update-repos",
+ args = [
+ "-from_file=go.mod",
+ "-to_macro=deps.bzl%go_dependencies",
+ "-prune",
+ ],
+ command = "update-repos",
+)
diff --git a/WORKSPACE b/WORKSPACE
new file mode 100644
index 0000000..26e308e
--- /dev/null
+++ b/WORKSPACE
@@ -0,0 +1,357 @@
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+http_archive(
+ name = "io_bazel_rules_go",
+ sha256 = "2b1641428dff9018f9e85c0384f03ec6c10660d935b750e3fa1492a281a53b0f",
+ urls = [
+ "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip",
+ "https://github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip",
+ ],
+)
+
+http_archive(
+ name = "bazel_gazelle",
+ sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb",
+ urls = [
+ "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
+ "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
+ ],
+)
+
+load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
+load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
+
+http_archive(
+ name = "io_buildbuddy_buildbuddy_toolchain",
+ sha256 = "a2a5cccec251211e2221b1587af2ce43c36d32a42f5d881737db3b546a536510",
+ strip_prefix = "buildbuddy-toolchain-829c8a574f706de5c96c54ca310f139f4acda7dd",
+ urls = ["https://github.com/buildbuddy-io/buildbuddy-toolchain/archive/829c8a574f706de5c96c54ca310f139f4acda7dd.tar.gz"],
+)
+
+load("@io_buildbuddy_buildbuddy_toolchain//:deps.bzl", "buildbuddy_deps")
+
+buildbuddy_deps()
+
+load("@io_buildbuddy_buildbuddy_toolchain//:rules.bzl", "buildbuddy")
+
+buildbuddy(name = "buildbuddy_toolchain")
+
+############################################################
+# Define your own dependencies here using go_repository.
+# Else, dependencies declared by rules_go/gazelle will be used.
+# The first declaration of an external repository "wins".
+############################################################
+
+go_repository(
+ name = "com_github_andybalholm_brotli",
+ importpath = "github.com/andybalholm/brotli",
+ sum = "h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY=",
+ version = "v1.0.4",
+)
+
+go_repository(
+ name = "com_github_creack_pty",
+ importpath = "github.com/creack/pty",
+ sum = "h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w=",
+ version = "v1.1.9",
+)
+
+go_repository(
+ name = "com_github_davecgh_go_spew",
+ importpath = "github.com/davecgh/go-spew",
+ sum = "h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=",
+ version = "v1.1.1",
+)
+
+go_repository(
+ name = "com_github_dsnet_compress",
+ importpath = "github.com/dsnet/compress",
+ sum = "h1:iFaUwBSo5Svw6L7HYpRu/0lE3e0BaElwnNO1qkNQxBY=",
+ version = "v0.0.2-0.20210315054119-f66993602bf5",
+)
+
+go_repository(
+ name = "com_github_dsnet_golib",
+ importpath = "github.com/dsnet/golib",
+ sum = "h1:tFh1tRc4CA31yP6qDcu+Trax5wW5GuMxvkIba07qVLY=",
+ version = "v0.0.0-20171103203638-1ea166775780",
+)
+
+go_repository(
+ name = "com_github_frankban_quicktest",
+ importpath = "github.com/frankban/quicktest",
+ sum = "h1:SPb1KFFmM+ybpEjPUhCCkZOM5xlovT5UbrMvWnXyBns=",
+ version = "v1.14.2",
+)
+
+go_repository(
+ name = "com_github_golang_snappy",
+ importpath = "github.com/golang/snappy",
+ sum = "h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=",
+ version = "v0.0.4",
+)
+
+go_repository(
+ name = "com_github_google_go_cmp",
+ importpath = "github.com/google/go-cmp",
+ sum = "h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=",
+ version = "v0.5.7",
+)
+
+go_repository(
+ name = "com_github_klauspost_compress",
+ importpath = "github.com/klauspost/compress",
+ sum = "h1:S0OHlFk/Gbon/yauFJ4FfJJF5V0fc5HbBTJazi28pRw=",
+ version = "v1.14.2",
+)
+
+go_repository(
+ name = "com_github_klauspost_cpuid",
+ importpath = "github.com/klauspost/cpuid",
+ sum = "h1:NMpwD2G9JSFOE1/TJjGSo5zG7Yb2bTe7eq1jH+irmeE=",
+ version = "v1.2.0",
+)
+
+go_repository(
+ name = "com_github_klauspost_pgzip",
+ importpath = "github.com/klauspost/pgzip",
+ sum = "h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=",
+ version = "v1.2.5",
+)
+
+go_repository(
+ name = "com_github_kr_pretty",
+ importpath = "github.com/kr/pretty",
+ sum = "h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=",
+ version = "v0.3.0",
+)
+
+go_repository(
+ name = "com_github_kr_pty",
+ importpath = "github.com/kr/pty",
+ sum = "h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=",
+ version = "v1.1.1",
+)
+
+go_repository(
+ name = "com_github_kr_text",
+ importpath = "github.com/kr/text",
+ sum = "h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=",
+ version = "v0.2.0",
+)
+
+go_repository(
+ name = "com_github_mholt_archiver",
+ importpath = "github.com/mholt/archiver",
+ sum = "h1:1dCVxuqs0dJseYEhi5pl7MYPH9zDa1wBi7mF09cbNkU=",
+ version = "v3.1.1+incompatible",
+)
+
+go_repository(
+ name = "com_github_mholt_archiver_v3",
+ importpath = "github.com/mholt/archiver/v3",
+ sum = "h1:rDjOBX9JSF5BvoJGvjqK479aL70qh9DIpZCl+k7Clwo=",
+ version = "v3.5.1",
+)
+
+go_repository(
+ name = "com_github_nwaples_rardecode",
+ importpath = "github.com/nwaples/rardecode",
+ sum = "h1:Cj0yZY6T1Zx1R7AhTbyGSALm44/Mmq+BAPc4B/p/d3M=",
+ version = "v1.1.2",
+)
+
+go_repository(
+ name = "com_github_oleiade_lane",
+ importpath = "github.com/oleiade/lane",
+ sum = "h1:hXofkn7GEOubzTwNpeL9MaNy8WxolCYb9cInAIeqShU=",
+ version = "v1.0.1",
+)
+
+go_repository(
+ name = "com_github_pierrec_lz4",
+ importpath = "github.com/pierrec/lz4",
+ sum = "h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM=",
+ version = "v2.6.1+incompatible",
+)
+
+go_repository(
+ name = "com_github_pierrec_lz4_v4",
+ importpath = "github.com/pierrec/lz4/v4",
+ sum = "h1:44l88ehTZAUGW4VlO1QC4zkilL99M6Y9MXNwEs0uzP8=",
+ version = "v4.1.12",
+)
+
+go_repository(
+ name = "com_github_pkg_diff",
+ importpath = "github.com/pkg/diff",
+ sum = "h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A=",
+ version = "v0.0.0-20210226163009-20ebb0f2a09e",
+)
+
+go_repository(
+ name = "com_github_pkg_profile",
+ importpath = "github.com/pkg/profile",
+ sum = "h1:hUDfIISABYI59DyeB3OTay/HxSRwTQ8rB/H83k6r5dM=",
+ version = "v1.6.0",
+)
+
+go_repository(
+ name = "com_github_pmezard_go_difflib",
+ importpath = "github.com/pmezard/go-difflib",
+ sum = "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=",
+ version = "v1.0.0",
+)
+
+go_repository(
+ name = "com_github_rogpeppe_go_internal",
+ importpath = "github.com/rogpeppe/go-internal",
+ sum = "h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=",
+ version = "v1.8.0",
+)
+
+go_repository(
+ name = "com_github_stretchr_objx",
+ importpath = "github.com/stretchr/objx",
+ sum = "h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=",
+ version = "v0.1.0",
+)
+
+go_repository(
+ name = "com_github_stretchr_testify",
+ importpath = "github.com/stretchr/testify",
+ sum = "h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=",
+ version = "v1.7.0",
+)
+
+go_repository(
+ name = "com_github_ulikunitz_xz",
+ importpath = "github.com/ulikunitz/xz",
+ sum = "h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8=",
+ version = "v0.5.10",
+)
+
+go_repository(
+ name = "com_github_xi2_xz",
+ importpath = "github.com/xi2/xz",
+ sum = "h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo=",
+ version = "v0.0.0-20171230120015-48954b6210f8",
+)
+
+go_repository(
+ name = "com_github_yuin_goldmark",
+ importpath = "github.com/yuin/goldmark",
+ sum = "h1:dPmz1Snjq0kmkz159iL7S6WzdahUTHnHB5M56WFVifs=",
+ version = "v1.3.5",
+)
+
+go_repository(
+ name = "in_gopkg_check_v1",
+ importpath = "gopkg.in/check.v1",
+ sum = "h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=",
+ version = "v1.0.0-20190902080502-41f04d3bba15",
+)
+
+go_repository(
+ name = "in_gopkg_errgo_v2",
+ importpath = "gopkg.in/errgo.v2",
+ sum = "h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8=",
+ version = "v2.1.0",
+)
+
+go_repository(
+ name = "in_gopkg_loremipsum_v1",
+ importpath = "gopkg.in/loremipsum.v1",
+ sum = "h1:j6TAjs6Db5AMfLwTzs51Kq4Qx7dCufw/IJ0hpMbjU8U=",
+ version = "v1.1.0",
+)
+
+go_repository(
+ name = "in_gopkg_yaml_v3",
+ importpath = "gopkg.in/yaml.v3",
+ sum = "h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=",
+ version = "v3.0.0-20210107192922-496545a6307b",
+)
+
+go_repository(
+ name = "org_golang_x_crypto",
+ importpath = "golang.org/x/crypto",
+ sum = "h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=",
+ version = "v0.0.0-20191011191535-87dc89f01550",
+)
+
+go_repository(
+ name = "org_golang_x_lint",
+ importpath = "golang.org/x/lint",
+ sum = "h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=",
+ version = "v0.0.0-20190930215403-16217165b5de",
+)
+
+go_repository(
+ name = "org_golang_x_mod",
+ importpath = "golang.org/x/mod",
+ sum = "h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=",
+ version = "v0.4.2",
+)
+
+go_repository(
+ name = "org_golang_x_net",
+ importpath = "golang.org/x/net",
+ sum = "h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=",
+ version = "v0.0.0-20210405180319-a5a99cb37ef4",
+)
+
+go_repository(
+ name = "org_golang_x_sync",
+ importpath = "golang.org/x/sync",
+ sum = "h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=",
+ version = "v0.0.0-20210220032951-036812b2e83c",
+)
+
+go_repository(
+ name = "org_golang_x_sys",
+ importpath = "golang.org/x/sys",
+ sum = "h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=",
+ version = "v0.0.0-20210510120138-977fb7262007",
+)
+
+go_repository(
+ name = "org_golang_x_term",
+ importpath = "golang.org/x/term",
+ sum = "h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=",
+ version = "v0.0.0-20201126162022-7de9c90e9dd1",
+)
+
+go_repository(
+ name = "org_golang_x_text",
+ importpath = "golang.org/x/text",
+ sum = "h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=",
+ version = "v0.3.3",
+)
+
+go_repository(
+ name = "org_golang_x_tools",
+ importpath = "golang.org/x/tools",
+ sum = "h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=",
+ version = "v0.1.5",
+)
+
+go_repository(
+ name = "org_golang_x_xerrors",
+ importpath = "golang.org/x/xerrors",
+ sum = "h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=",
+ version = "v0.0.0-20200804184101-5ec99f83aff1",
+)
+
+go_repository(
+ name = "org_uber_go_goleak",
+ importpath = "go.uber.org/goleak",
+ sum = "h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=",
+ version = "v1.1.12",
+)
+
+go_rules_dependencies()
+
+go_register_toolchains(version = "1.17.6")
+
+gazelle_dependencies()
diff --git a/cmd/zipper/BUILD.bazel b/cmd/zipper/BUILD.bazel
new file mode 100644
index 0000000..9a36ad9
--- /dev/null
+++ b/cmd/zipper/BUILD.bazel
@@ -0,0 +1,18 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
+
+go_library(
+ name = "zipper_lib",
+ srcs = ["main.go"],
+ importpath = "github.com/pratikbalar/zipper/cmd/zipper",
+ visibility = ["//visibility:private"],
+ deps = [
+ "//internal/zipper",
+ "@com_github_pkg_profile//:profile",
+ ],
+)
+
+go_binary(
+ name = "zipper",
+ embed = [":zipper_lib"],
+ visibility = ["//visibility:public"],
+)
diff --git a/internal/zipper/BUILD.bazel b/internal/zipper/BUILD.bazel
new file mode 100644
index 0000000..ce83ef5
--- /dev/null
+++ b/internal/zipper/BUILD.bazel
@@ -0,0 +1,25 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "zipper",
+ srcs = ["zip.go"],
+ importpath = "github.com/pratikbalar/zipper/internal/zipper",
+ visibility = ["//:__subpackages__"],
+ deps = [
+ "//pkg",
+ "@com_github_mholt_archiver//:archiver",
+ "@com_github_oleiade_lane//:lane",
+ ],
+)
+
+go_test(
+ name = "zipper_test",
+ srcs = ["zip_test.go"],
+ embed = [":zipper"],
+ deps = [
+ "@com_github_mholt_archiver_v3//:archiver",
+ "@com_github_stretchr_testify//assert",
+ "@in_gopkg_loremipsum_v1//:loremipsum_v1",
+ "@org_uber_go_goleak//:goleak",
+ ],
+)
diff --git a/pkg/BUILD.bazel b/pkg/BUILD.bazel
new file mode 100644
index 0000000..939e13d
--- /dev/null
+++ b/pkg/BUILD.bazel
@@ -0,0 +1,15 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "pkg",
+ srcs = ["helper.go"],
+ importpath = "github.com/pratikbalar/zipper/pkg",
+ visibility = ["//visibility:public"],
+)
+
+go_test(
+ name = "pkg_test",
+ srcs = ["helper_test.go"],
+ embed = [":pkg"],
+ deps = ["@com_github_stretchr_testify//assert"],
+)
From c01c4c4118f60a3489bb1599cc97dbab47e7e89b Mon Sep 17 00:00:00 2001
From: pratikbalar <68642400+pratikbalar@users.noreply.github.com>
Date: Sat, 26 Feb 2022 12:33:27 +0530
Subject: [PATCH 02/46] ci: add build and test
---
.github/workflows/test.yaml | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 38ec643..96cf8f8 100755
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -16,10 +16,13 @@ jobs:
- uses: bazelbuild/setup-bazelisk@v1
- run: |
- bazel build //... --config=remote
+ bazelisk test \
+ --config=ci \
+ --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} \
+ //...
- run: |
- bazelisk test \
+ bazelisk build \
--config=ci \
--remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} \
//...
From 677a03df35b5859777c1f443ec1f4fcbbacd5126 Mon Sep 17 00:00:00 2001
From: pratikbalar <68642400+pratikbalar@users.noreply.github.com>
Date: Sat, 26 Feb 2022 12:54:43 +0530
Subject: [PATCH 03/46] ci: Enable race testing, pure and static bin
---
.bazelrc | 6 ++++++
cmd/zipper/BUILD.bazel | 2 ++
internal/zipper/BUILD.bazel | 13 +++++++++++++
3 files changed, 21 insertions(+)
diff --git a/.bazelrc b/.bazelrc
index d532692..93b45d2 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -15,3 +15,9 @@ build:ci --build_metadata=VISIBILITY=PUBLIC
build:ci --build_metadata=ROLE=CI
build:ci --bes_results_url=https://app.buildbuddy.io/invocation/
build:ci --bes_backend=grpcs://remote.buildbuddy.io
+
+## Local settings
+build --jobs=HOST_CPUS
+test --jobs=HOST_CPUS
+
+try-import ~/.bazelrc
diff --git a/cmd/zipper/BUILD.bazel b/cmd/zipper/BUILD.bazel
index 9a36ad9..fd94e02 100644
--- a/cmd/zipper/BUILD.bazel
+++ b/cmd/zipper/BUILD.bazel
@@ -14,5 +14,7 @@ go_library(
go_binary(
name = "zipper",
embed = [":zipper_lib"],
+ pure = "on",
+ static = "on",
visibility = ["//visibility:public"],
)
diff --git a/internal/zipper/BUILD.bazel b/internal/zipper/BUILD.bazel
index ce83ef5..9fed187 100644
--- a/internal/zipper/BUILD.bazel
+++ b/internal/zipper/BUILD.bazel
@@ -23,3 +23,16 @@ go_test(
"@org_uber_go_goleak//:goleak",
],
)
+
+go_test(
+ name = "zipper_test_race",
+ srcs = ["zip_test.go"],
+ embed = [":zipper"],
+ race = "on",
+ deps = [
+ "@com_github_mholt_archiver_v3//:archiver",
+ "@com_github_stretchr_testify//assert",
+ "@in_gopkg_loremipsum_v1//:loremipsum_v1",
+ "@org_uber_go_goleak//:goleak",
+ ],
+)
From 928f3d483dc6327e7772bb4988eb56e3eafdfc91 Mon Sep 17 00:00:00 2001
From: pratikbalar <68642400+pratikbalar@users.noreply.github.com>
Date: Sat, 26 Feb 2022 14:27:22 +0530
Subject: [PATCH 04/46] c: bump rules_go, add go container image
---
.github/workflows/test.yaml | 13 ++++++++++--
WORKSPACE | 41 +++++++++++++++++++++++++++++--------
cmd/zipper/BUILD.bazel | 11 ++++++++++
3 files changed, 54 insertions(+), 11 deletions(-)
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 96cf8f8..23a4686 100755
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -15,14 +15,23 @@ jobs:
- uses: bazelbuild/setup-bazelisk@v1
- - run: |
+ - name: test
+ run: |
bazelisk test \
--config=ci \
--remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} \
//...
- - run: |
+ - name: build
+ run: |
bazelisk build \
--config=ci \
--remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} \
//...
+
+ - name: build image
+ run: |
+ bazelisk build \
+ --config=ci \
+ --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} \
+ //cmd/zipper:zipper_image
diff --git a/WORKSPACE b/WORKSPACE
index 26e308e..6dabed6 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -2,10 +2,10 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
- sha256 = "2b1641428dff9018f9e85c0384f03ec6c10660d935b750e3fa1492a281a53b0f",
+ sha256 = "d6b2513456fe2229811da7eb67a444be7785f5323c6708b38d851d2b51e54d83",
urls = [
- "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip",
- "https://github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip",
+ "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.30.0/rules_go-v0.30.0.zip",
+ "https://github.com/bazelbuild/rules_go/releases/download/v0.30.0/rules_go-v0.30.0.zip",
],
)
@@ -21,6 +21,12 @@ http_archive(
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
+go_rules_dependencies()
+
+go_register_toolchains(version = "1.17.6")
+
+gazelle_dependencies()
+
http_archive(
name = "io_buildbuddy_buildbuddy_toolchain",
sha256 = "a2a5cccec251211e2221b1587af2ce43c36d32a42f5d881737db3b546a536510",
@@ -36,6 +42,29 @@ load("@io_buildbuddy_buildbuddy_toolchain//:rules.bzl", "buildbuddy")
buildbuddy(name = "buildbuddy_toolchain")
+http_archive(
+ name = "io_bazel_rules_docker",
+ sha256 = "85ffff62a4c22a74dbd98d05da6cf40f497344b3dbf1e1ab0a37ab2a1a6ca014",
+ strip_prefix = "rules_docker-0.23.0",
+ urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.23.0/rules_docker-v0.23.0.tar.gz"],
+)
+
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+load(
+ "@io_bazel_rules_docker//repositories:repositories.bzl",
+ container_repositories = "repositories",
+)
+
+container_repositories()
+
+load(
+ "@io_bazel_rules_docker//go:image.bzl",
+ _go_image_repos = "repositories",
+)
+
+_go_image_repos()
+
############################################################
# Define your own dependencies here using go_repository.
# Else, dependencies declared by rules_go/gazelle will be used.
@@ -349,9 +378,3 @@ go_repository(
sum = "h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=",
version = "v1.1.12",
)
-
-go_rules_dependencies()
-
-go_register_toolchains(version = "1.17.6")
-
-gazelle_dependencies()
diff --git a/cmd/zipper/BUILD.bazel b/cmd/zipper/BUILD.bazel
index fd94e02..509314f 100644
--- a/cmd/zipper/BUILD.bazel
+++ b/cmd/zipper/BUILD.bazel
@@ -1,4 +1,5 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
+load("@io_bazel_rules_docker//go:image.bzl", "go_image")
go_library(
name = "zipper_lib",
@@ -18,3 +19,13 @@ go_binary(
static = "on",
visibility = ["//visibility:public"],
)
+
+go_image(
+ name = "zipper_image",
+ srcs = ["main.go"],
+ importpath = "github.com/pratikbalar/zipper/cmd/zipper",
+ deps = [
+ "//internal/zipper",
+ "@com_github_pkg_profile//:profile",
+ ],
+)
From c79a51299deda2f7bdf5b51b0d5e487caa8a9c4d Mon Sep 17 00:00:00 2001
From: pratikbalar <68642400+pratikbalar@users.noreply.github.com>
Date: Sat, 26 Feb 2022 17:24:27 +0530
Subject: [PATCH 05/46] bazel: move deps to deps.bzl
---
BAZEL.md | 15 +++
WORKSPACE | 308 ------------------------------------------------------
deps.bzl | 267 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 282 insertions(+), 308 deletions(-)
create mode 100644 BAZEL.md
create mode 100644 deps.bzl
diff --git a/BAZEL.md b/BAZEL.md
new file mode 100644
index 0000000..9414ba8
--- /dev/null
+++ b/BAZEL.md
@@ -0,0 +1,15 @@
+# Bazel
+
+## Update
+
+### Build files
+
+```shell
+bazel run //:gazelle
+```
+
+### Go deps
+
+```shell
+bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=deps.bzl%go_dependencies
+```
diff --git a/WORKSPACE b/WORKSPACE
index 6dabed6..0ddf7ba 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -70,311 +70,3 @@ _go_image_repos()
# Else, dependencies declared by rules_go/gazelle will be used.
# The first declaration of an external repository "wins".
############################################################
-
-go_repository(
- name = "com_github_andybalholm_brotli",
- importpath = "github.com/andybalholm/brotli",
- sum = "h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY=",
- version = "v1.0.4",
-)
-
-go_repository(
- name = "com_github_creack_pty",
- importpath = "github.com/creack/pty",
- sum = "h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w=",
- version = "v1.1.9",
-)
-
-go_repository(
- name = "com_github_davecgh_go_spew",
- importpath = "github.com/davecgh/go-spew",
- sum = "h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=",
- version = "v1.1.1",
-)
-
-go_repository(
- name = "com_github_dsnet_compress",
- importpath = "github.com/dsnet/compress",
- sum = "h1:iFaUwBSo5Svw6L7HYpRu/0lE3e0BaElwnNO1qkNQxBY=",
- version = "v0.0.2-0.20210315054119-f66993602bf5",
-)
-
-go_repository(
- name = "com_github_dsnet_golib",
- importpath = "github.com/dsnet/golib",
- sum = "h1:tFh1tRc4CA31yP6qDcu+Trax5wW5GuMxvkIba07qVLY=",
- version = "v0.0.0-20171103203638-1ea166775780",
-)
-
-go_repository(
- name = "com_github_frankban_quicktest",
- importpath = "github.com/frankban/quicktest",
- sum = "h1:SPb1KFFmM+ybpEjPUhCCkZOM5xlovT5UbrMvWnXyBns=",
- version = "v1.14.2",
-)
-
-go_repository(
- name = "com_github_golang_snappy",
- importpath = "github.com/golang/snappy",
- sum = "h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=",
- version = "v0.0.4",
-)
-
-go_repository(
- name = "com_github_google_go_cmp",
- importpath = "github.com/google/go-cmp",
- sum = "h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=",
- version = "v0.5.7",
-)
-
-go_repository(
- name = "com_github_klauspost_compress",
- importpath = "github.com/klauspost/compress",
- sum = "h1:S0OHlFk/Gbon/yauFJ4FfJJF5V0fc5HbBTJazi28pRw=",
- version = "v1.14.2",
-)
-
-go_repository(
- name = "com_github_klauspost_cpuid",
- importpath = "github.com/klauspost/cpuid",
- sum = "h1:NMpwD2G9JSFOE1/TJjGSo5zG7Yb2bTe7eq1jH+irmeE=",
- version = "v1.2.0",
-)
-
-go_repository(
- name = "com_github_klauspost_pgzip",
- importpath = "github.com/klauspost/pgzip",
- sum = "h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=",
- version = "v1.2.5",
-)
-
-go_repository(
- name = "com_github_kr_pretty",
- importpath = "github.com/kr/pretty",
- sum = "h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=",
- version = "v0.3.0",
-)
-
-go_repository(
- name = "com_github_kr_pty",
- importpath = "github.com/kr/pty",
- sum = "h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=",
- version = "v1.1.1",
-)
-
-go_repository(
- name = "com_github_kr_text",
- importpath = "github.com/kr/text",
- sum = "h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=",
- version = "v0.2.0",
-)
-
-go_repository(
- name = "com_github_mholt_archiver",
- importpath = "github.com/mholt/archiver",
- sum = "h1:1dCVxuqs0dJseYEhi5pl7MYPH9zDa1wBi7mF09cbNkU=",
- version = "v3.1.1+incompatible",
-)
-
-go_repository(
- name = "com_github_mholt_archiver_v3",
- importpath = "github.com/mholt/archiver/v3",
- sum = "h1:rDjOBX9JSF5BvoJGvjqK479aL70qh9DIpZCl+k7Clwo=",
- version = "v3.5.1",
-)
-
-go_repository(
- name = "com_github_nwaples_rardecode",
- importpath = "github.com/nwaples/rardecode",
- sum = "h1:Cj0yZY6T1Zx1R7AhTbyGSALm44/Mmq+BAPc4B/p/d3M=",
- version = "v1.1.2",
-)
-
-go_repository(
- name = "com_github_oleiade_lane",
- importpath = "github.com/oleiade/lane",
- sum = "h1:hXofkn7GEOubzTwNpeL9MaNy8WxolCYb9cInAIeqShU=",
- version = "v1.0.1",
-)
-
-go_repository(
- name = "com_github_pierrec_lz4",
- importpath = "github.com/pierrec/lz4",
- sum = "h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM=",
- version = "v2.6.1+incompatible",
-)
-
-go_repository(
- name = "com_github_pierrec_lz4_v4",
- importpath = "github.com/pierrec/lz4/v4",
- sum = "h1:44l88ehTZAUGW4VlO1QC4zkilL99M6Y9MXNwEs0uzP8=",
- version = "v4.1.12",
-)
-
-go_repository(
- name = "com_github_pkg_diff",
- importpath = "github.com/pkg/diff",
- sum = "h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A=",
- version = "v0.0.0-20210226163009-20ebb0f2a09e",
-)
-
-go_repository(
- name = "com_github_pkg_profile",
- importpath = "github.com/pkg/profile",
- sum = "h1:hUDfIISABYI59DyeB3OTay/HxSRwTQ8rB/H83k6r5dM=",
- version = "v1.6.0",
-)
-
-go_repository(
- name = "com_github_pmezard_go_difflib",
- importpath = "github.com/pmezard/go-difflib",
- sum = "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=",
- version = "v1.0.0",
-)
-
-go_repository(
- name = "com_github_rogpeppe_go_internal",
- importpath = "github.com/rogpeppe/go-internal",
- sum = "h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=",
- version = "v1.8.0",
-)
-
-go_repository(
- name = "com_github_stretchr_objx",
- importpath = "github.com/stretchr/objx",
- sum = "h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=",
- version = "v0.1.0",
-)
-
-go_repository(
- name = "com_github_stretchr_testify",
- importpath = "github.com/stretchr/testify",
- sum = "h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=",
- version = "v1.7.0",
-)
-
-go_repository(
- name = "com_github_ulikunitz_xz",
- importpath = "github.com/ulikunitz/xz",
- sum = "h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8=",
- version = "v0.5.10",
-)
-
-go_repository(
- name = "com_github_xi2_xz",
- importpath = "github.com/xi2/xz",
- sum = "h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo=",
- version = "v0.0.0-20171230120015-48954b6210f8",
-)
-
-go_repository(
- name = "com_github_yuin_goldmark",
- importpath = "github.com/yuin/goldmark",
- sum = "h1:dPmz1Snjq0kmkz159iL7S6WzdahUTHnHB5M56WFVifs=",
- version = "v1.3.5",
-)
-
-go_repository(
- name = "in_gopkg_check_v1",
- importpath = "gopkg.in/check.v1",
- sum = "h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=",
- version = "v1.0.0-20190902080502-41f04d3bba15",
-)
-
-go_repository(
- name = "in_gopkg_errgo_v2",
- importpath = "gopkg.in/errgo.v2",
- sum = "h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8=",
- version = "v2.1.0",
-)
-
-go_repository(
- name = "in_gopkg_loremipsum_v1",
- importpath = "gopkg.in/loremipsum.v1",
- sum = "h1:j6TAjs6Db5AMfLwTzs51Kq4Qx7dCufw/IJ0hpMbjU8U=",
- version = "v1.1.0",
-)
-
-go_repository(
- name = "in_gopkg_yaml_v3",
- importpath = "gopkg.in/yaml.v3",
- sum = "h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=",
- version = "v3.0.0-20210107192922-496545a6307b",
-)
-
-go_repository(
- name = "org_golang_x_crypto",
- importpath = "golang.org/x/crypto",
- sum = "h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=",
- version = "v0.0.0-20191011191535-87dc89f01550",
-)
-
-go_repository(
- name = "org_golang_x_lint",
- importpath = "golang.org/x/lint",
- sum = "h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=",
- version = "v0.0.0-20190930215403-16217165b5de",
-)
-
-go_repository(
- name = "org_golang_x_mod",
- importpath = "golang.org/x/mod",
- sum = "h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=",
- version = "v0.4.2",
-)
-
-go_repository(
- name = "org_golang_x_net",
- importpath = "golang.org/x/net",
- sum = "h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=",
- version = "v0.0.0-20210405180319-a5a99cb37ef4",
-)
-
-go_repository(
- name = "org_golang_x_sync",
- importpath = "golang.org/x/sync",
- sum = "h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=",
- version = "v0.0.0-20210220032951-036812b2e83c",
-)
-
-go_repository(
- name = "org_golang_x_sys",
- importpath = "golang.org/x/sys",
- sum = "h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=",
- version = "v0.0.0-20210510120138-977fb7262007",
-)
-
-go_repository(
- name = "org_golang_x_term",
- importpath = "golang.org/x/term",
- sum = "h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=",
- version = "v0.0.0-20201126162022-7de9c90e9dd1",
-)
-
-go_repository(
- name = "org_golang_x_text",
- importpath = "golang.org/x/text",
- sum = "h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=",
- version = "v0.3.3",
-)
-
-go_repository(
- name = "org_golang_x_tools",
- importpath = "golang.org/x/tools",
- sum = "h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=",
- version = "v0.1.5",
-)
-
-go_repository(
- name = "org_golang_x_xerrors",
- importpath = "golang.org/x/xerrors",
- sum = "h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=",
- version = "v0.0.0-20200804184101-5ec99f83aff1",
-)
-
-go_repository(
- name = "org_uber_go_goleak",
- importpath = "go.uber.org/goleak",
- sum = "h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=",
- version = "v1.1.12",
-)
diff --git a/deps.bzl b/deps.bzl
new file mode 100644
index 0000000..8574ea1
--- /dev/null
+++ b/deps.bzl
@@ -0,0 +1,267 @@
+load("@bazel_gazelle//:deps.bzl", "go_repository")
+
+def go_dependencies():
+ go_repository(
+ name = "com_github_andybalholm_brotli",
+ importpath = "github.com/andybalholm/brotli",
+ sum = "h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY=",
+ version = "v1.0.4",
+ )
+ go_repository(
+ name = "com_github_creack_pty",
+ importpath = "github.com/creack/pty",
+ sum = "h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w=",
+ version = "v1.1.9",
+ )
+ go_repository(
+ name = "com_github_davecgh_go_spew",
+ importpath = "github.com/davecgh/go-spew",
+ sum = "h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=",
+ version = "v1.1.1",
+ )
+ go_repository(
+ name = "com_github_dsnet_compress",
+ importpath = "github.com/dsnet/compress",
+ sum = "h1:iFaUwBSo5Svw6L7HYpRu/0lE3e0BaElwnNO1qkNQxBY=",
+ version = "v0.0.2-0.20210315054119-f66993602bf5",
+ )
+ go_repository(
+ name = "com_github_dsnet_golib",
+ importpath = "github.com/dsnet/golib",
+ sum = "h1:tFh1tRc4CA31yP6qDcu+Trax5wW5GuMxvkIba07qVLY=",
+ version = "v0.0.0-20171103203638-1ea166775780",
+ )
+ go_repository(
+ name = "com_github_frankban_quicktest",
+ importpath = "github.com/frankban/quicktest",
+ sum = "h1:SPb1KFFmM+ybpEjPUhCCkZOM5xlovT5UbrMvWnXyBns=",
+ version = "v1.14.2",
+ )
+ go_repository(
+ name = "com_github_golang_snappy",
+ importpath = "github.com/golang/snappy",
+ sum = "h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=",
+ version = "v0.0.4",
+ )
+ go_repository(
+ name = "com_github_google_go_cmp",
+ importpath = "github.com/google/go-cmp",
+ sum = "h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=",
+ version = "v0.5.7",
+ )
+ go_repository(
+ name = "com_github_klauspost_compress",
+ importpath = "github.com/klauspost/compress",
+ sum = "h1:S0OHlFk/Gbon/yauFJ4FfJJF5V0fc5HbBTJazi28pRw=",
+ version = "v1.14.2",
+ )
+ go_repository(
+ name = "com_github_klauspost_cpuid",
+ importpath = "github.com/klauspost/cpuid",
+ sum = "h1:NMpwD2G9JSFOE1/TJjGSo5zG7Yb2bTe7eq1jH+irmeE=",
+ version = "v1.2.0",
+ )
+ go_repository(
+ name = "com_github_klauspost_pgzip",
+ importpath = "github.com/klauspost/pgzip",
+ sum = "h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=",
+ version = "v1.2.5",
+ )
+ go_repository(
+ name = "com_github_kr_pretty",
+ importpath = "github.com/kr/pretty",
+ sum = "h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=",
+ version = "v0.3.0",
+ )
+ go_repository(
+ name = "com_github_kr_pty",
+ importpath = "github.com/kr/pty",
+ sum = "h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=",
+ version = "v1.1.1",
+ )
+ go_repository(
+ name = "com_github_kr_text",
+ importpath = "github.com/kr/text",
+ sum = "h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=",
+ version = "v0.2.0",
+ )
+ go_repository(
+ name = "com_github_mholt_archiver",
+ importpath = "github.com/mholt/archiver",
+ sum = "h1:1dCVxuqs0dJseYEhi5pl7MYPH9zDa1wBi7mF09cbNkU=",
+ version = "v3.1.1+incompatible",
+ )
+ go_repository(
+ name = "com_github_mholt_archiver_v3",
+ importpath = "github.com/mholt/archiver/v3",
+ sum = "h1:rDjOBX9JSF5BvoJGvjqK479aL70qh9DIpZCl+k7Clwo=",
+ version = "v3.5.1",
+ )
+ go_repository(
+ name = "com_github_nwaples_rardecode",
+ importpath = "github.com/nwaples/rardecode",
+ sum = "h1:Cj0yZY6T1Zx1R7AhTbyGSALm44/Mmq+BAPc4B/p/d3M=",
+ version = "v1.1.2",
+ )
+ go_repository(
+ name = "com_github_oleiade_lane",
+ importpath = "github.com/oleiade/lane",
+ sum = "h1:hXofkn7GEOubzTwNpeL9MaNy8WxolCYb9cInAIeqShU=",
+ version = "v1.0.1",
+ )
+ go_repository(
+ name = "com_github_pierrec_lz4",
+ importpath = "github.com/pierrec/lz4",
+ sum = "h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM=",
+ version = "v2.6.1+incompatible",
+ )
+ go_repository(
+ name = "com_github_pierrec_lz4_v4",
+ importpath = "github.com/pierrec/lz4/v4",
+ sum = "h1:44l88ehTZAUGW4VlO1QC4zkilL99M6Y9MXNwEs0uzP8=",
+ version = "v4.1.12",
+ )
+ go_repository(
+ name = "com_github_pkg_diff",
+ importpath = "github.com/pkg/diff",
+ sum = "h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A=",
+ version = "v0.0.0-20210226163009-20ebb0f2a09e",
+ )
+ go_repository(
+ name = "com_github_pkg_profile",
+ importpath = "github.com/pkg/profile",
+ sum = "h1:hUDfIISABYI59DyeB3OTay/HxSRwTQ8rB/H83k6r5dM=",
+ version = "v1.6.0",
+ )
+ go_repository(
+ name = "com_github_pmezard_go_difflib",
+ importpath = "github.com/pmezard/go-difflib",
+ sum = "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=",
+ version = "v1.0.0",
+ )
+ go_repository(
+ name = "com_github_rogpeppe_go_internal",
+ importpath = "github.com/rogpeppe/go-internal",
+ sum = "h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=",
+ version = "v1.8.0",
+ )
+ go_repository(
+ name = "com_github_stretchr_objx",
+ importpath = "github.com/stretchr/objx",
+ sum = "h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=",
+ version = "v0.1.0",
+ )
+ go_repository(
+ name = "com_github_stretchr_testify",
+ importpath = "github.com/stretchr/testify",
+ sum = "h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=",
+ version = "v1.7.0",
+ )
+ go_repository(
+ name = "com_github_ulikunitz_xz",
+ importpath = "github.com/ulikunitz/xz",
+ sum = "h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8=",
+ version = "v0.5.10",
+ )
+ go_repository(
+ name = "com_github_xi2_xz",
+ importpath = "github.com/xi2/xz",
+ sum = "h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo=",
+ version = "v0.0.0-20171230120015-48954b6210f8",
+ )
+ go_repository(
+ name = "com_github_yuin_goldmark",
+ importpath = "github.com/yuin/goldmark",
+ sum = "h1:dPmz1Snjq0kmkz159iL7S6WzdahUTHnHB5M56WFVifs=",
+ version = "v1.3.5",
+ )
+ go_repository(
+ name = "in_gopkg_check_v1",
+ importpath = "gopkg.in/check.v1",
+ sum = "h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=",
+ version = "v1.0.0-20190902080502-41f04d3bba15",
+ )
+ go_repository(
+ name = "in_gopkg_errgo_v2",
+ importpath = "gopkg.in/errgo.v2",
+ sum = "h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8=",
+ version = "v2.1.0",
+ )
+ go_repository(
+ name = "in_gopkg_loremipsum_v1",
+ importpath = "gopkg.in/loremipsum.v1",
+ sum = "h1:j6TAjs6Db5AMfLwTzs51Kq4Qx7dCufw/IJ0hpMbjU8U=",
+ version = "v1.1.0",
+ )
+ go_repository(
+ name = "in_gopkg_yaml_v3",
+ importpath = "gopkg.in/yaml.v3",
+ sum = "h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=",
+ version = "v3.0.0-20210107192922-496545a6307b",
+ )
+ go_repository(
+ name = "org_golang_x_crypto",
+ importpath = "golang.org/x/crypto",
+ sum = "h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=",
+ version = "v0.0.0-20191011191535-87dc89f01550",
+ )
+ go_repository(
+ name = "org_golang_x_lint",
+ importpath = "golang.org/x/lint",
+ sum = "h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=",
+ version = "v0.0.0-20190930215403-16217165b5de",
+ )
+ go_repository(
+ name = "org_golang_x_mod",
+ importpath = "golang.org/x/mod",
+ sum = "h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=",
+ version = "v0.4.2",
+ )
+ go_repository(
+ name = "org_golang_x_net",
+ importpath = "golang.org/x/net",
+ sum = "h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=",
+ version = "v0.0.0-20210405180319-a5a99cb37ef4",
+ )
+ go_repository(
+ name = "org_golang_x_sync",
+ importpath = "golang.org/x/sync",
+ sum = "h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=",
+ version = "v0.0.0-20210220032951-036812b2e83c",
+ )
+ go_repository(
+ name = "org_golang_x_sys",
+ importpath = "golang.org/x/sys",
+ sum = "h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=",
+ version = "v0.0.0-20210510120138-977fb7262007",
+ )
+ go_repository(
+ name = "org_golang_x_term",
+ importpath = "golang.org/x/term",
+ sum = "h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=",
+ version = "v0.0.0-20201126162022-7de9c90e9dd1",
+ )
+ go_repository(
+ name = "org_golang_x_text",
+ importpath = "golang.org/x/text",
+ sum = "h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=",
+ version = "v0.3.3",
+ )
+ go_repository(
+ name = "org_golang_x_tools",
+ importpath = "golang.org/x/tools",
+ sum = "h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=",
+ version = "v0.1.5",
+ )
+ go_repository(
+ name = "org_golang_x_xerrors",
+ importpath = "golang.org/x/xerrors",
+ sum = "h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=",
+ version = "v0.0.0-20200804184101-5ec99f83aff1",
+ )
+ go_repository(
+ name = "org_uber_go_goleak",
+ importpath = "go.uber.org/goleak",
+ sum = "h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=",
+ version = "v1.1.12",
+ )
From 7cfcfa1ce388cb2c5db09c61ad61c8056d87618b Mon Sep 17 00:00:00 2001
From: pratikbalar <68642400+pratikbalar@users.noreply.github.com>
Date: Sat, 26 Feb 2022 19:19:18 +0530
Subject: [PATCH 06/46] Revert "c: bump rules_go, add go container image"
This reverts commit 928f3d483dc6327e7772bb4988eb56e3eafdfc91.
---
.github/workflows/test.yaml | 13 +-
WORKSPACE | 329 +++++++++++++++++++++++++++++++++---
cmd/zipper/BUILD.bazel | 11 --
3 files changed, 309 insertions(+), 44 deletions(-)
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 23a4686..96cf8f8 100755
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -15,23 +15,14 @@ jobs:
- uses: bazelbuild/setup-bazelisk@v1
- - name: test
- run: |
+ - run: |
bazelisk test \
--config=ci \
--remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} \
//...
- - name: build
- run: |
+ - run: |
bazelisk build \
--config=ci \
--remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} \
//...
-
- - name: build image
- run: |
- bazelisk build \
- --config=ci \
- --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} \
- //cmd/zipper:zipper_image
diff --git a/WORKSPACE b/WORKSPACE
index 0ddf7ba..2a8b363 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -2,10 +2,10 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
- sha256 = "d6b2513456fe2229811da7eb67a444be7785f5323c6708b38d851d2b51e54d83",
+ sha256 = "2b1641428dff9018f9e85c0384f03ec6c10660d935b750e3fa1492a281a53b0f",
urls = [
- "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.30.0/rules_go-v0.30.0.zip",
- "https://github.com/bazelbuild/rules_go/releases/download/v0.30.0/rules_go-v0.30.0.zip",
+ "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip",
+ "https://github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip",
],
)
@@ -42,31 +42,316 @@ load("@io_buildbuddy_buildbuddy_toolchain//:rules.bzl", "buildbuddy")
buildbuddy(name = "buildbuddy_toolchain")
-http_archive(
- name = "io_bazel_rules_docker",
- sha256 = "85ffff62a4c22a74dbd98d05da6cf40f497344b3dbf1e1ab0a37ab2a1a6ca014",
- strip_prefix = "rules_docker-0.23.0",
- urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.23.0/rules_docker-v0.23.0.tar.gz"],
+############################################################
+# Define your own dependencies here using go_repository.
+# Else, dependencies declared by rules_go/gazelle will be used.
+# The first declaration of an external repository "wins".
+############################################################
+
+go_repository(
+ name = "com_github_andybalholm_brotli",
+ importpath = "github.com/andybalholm/brotli",
+ sum = "h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY=",
+ version = "v1.0.4",
)
-load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+go_repository(
+ name = "com_github_creack_pty",
+ importpath = "github.com/creack/pty",
+ sum = "h1:uDmaGzcdjhF4i/plgjmEsriH11Y0o7RKapEf/LDaM3w=",
+ version = "v1.1.9",
+)
-load(
- "@io_bazel_rules_docker//repositories:repositories.bzl",
- container_repositories = "repositories",
+go_repository(
+ name = "com_github_davecgh_go_spew",
+ importpath = "github.com/davecgh/go-spew",
+ sum = "h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=",
+ version = "v1.1.1",
)
-container_repositories()
+go_repository(
+ name = "com_github_dsnet_compress",
+ importpath = "github.com/dsnet/compress",
+ sum = "h1:iFaUwBSo5Svw6L7HYpRu/0lE3e0BaElwnNO1qkNQxBY=",
+ version = "v0.0.2-0.20210315054119-f66993602bf5",
+)
-load(
- "@io_bazel_rules_docker//go:image.bzl",
- _go_image_repos = "repositories",
+go_repository(
+ name = "com_github_dsnet_golib",
+ importpath = "github.com/dsnet/golib",
+ sum = "h1:tFh1tRc4CA31yP6qDcu+Trax5wW5GuMxvkIba07qVLY=",
+ version = "v0.0.0-20171103203638-1ea166775780",
)
-_go_image_repos()
+go_repository(
+ name = "com_github_frankban_quicktest",
+ importpath = "github.com/frankban/quicktest",
+ sum = "h1:SPb1KFFmM+ybpEjPUhCCkZOM5xlovT5UbrMvWnXyBns=",
+ version = "v1.14.2",
+)
-############################################################
-# Define your own dependencies here using go_repository.
-# Else, dependencies declared by rules_go/gazelle will be used.
-# The first declaration of an external repository "wins".
-############################################################
+go_repository(
+ name = "com_github_golang_snappy",
+ importpath = "github.com/golang/snappy",
+ sum = "h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=",
+ version = "v0.0.4",
+)
+
+go_repository(
+ name = "com_github_google_go_cmp",
+ importpath = "github.com/google/go-cmp",
+ sum = "h1:81/ik6ipDQS2aGcBfIN5dHDB36BwrStyeAQquSYCV4o=",
+ version = "v0.5.7",
+)
+
+go_repository(
+ name = "com_github_klauspost_compress",
+ importpath = "github.com/klauspost/compress",
+ sum = "h1:S0OHlFk/Gbon/yauFJ4FfJJF5V0fc5HbBTJazi28pRw=",
+ version = "v1.14.2",
+)
+
+go_repository(
+ name = "com_github_klauspost_cpuid",
+ importpath = "github.com/klauspost/cpuid",
+ sum = "h1:NMpwD2G9JSFOE1/TJjGSo5zG7Yb2bTe7eq1jH+irmeE=",
+ version = "v1.2.0",
+)
+
+go_repository(
+ name = "com_github_klauspost_pgzip",
+ importpath = "github.com/klauspost/pgzip",
+ sum = "h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE=",
+ version = "v1.2.5",
+)
+
+go_repository(
+ name = "com_github_kr_pretty",
+ importpath = "github.com/kr/pretty",
+ sum = "h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=",
+ version = "v0.3.0",
+)
+
+go_repository(
+ name = "com_github_kr_pty",
+ importpath = "github.com/kr/pty",
+ sum = "h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=",
+ version = "v1.1.1",
+)
+
+go_repository(
+ name = "com_github_kr_text",
+ importpath = "github.com/kr/text",
+ sum = "h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=",
+ version = "v0.2.0",
+)
+
+go_repository(
+ name = "com_github_mholt_archiver",
+ importpath = "github.com/mholt/archiver",
+ sum = "h1:1dCVxuqs0dJseYEhi5pl7MYPH9zDa1wBi7mF09cbNkU=",
+ version = "v3.1.1+incompatible",
+)
+
+go_repository(
+ name = "com_github_mholt_archiver_v3",
+ importpath = "github.com/mholt/archiver/v3",
+ sum = "h1:rDjOBX9JSF5BvoJGvjqK479aL70qh9DIpZCl+k7Clwo=",
+ version = "v3.5.1",
+)
+
+go_repository(
+ name = "com_github_nwaples_rardecode",
+ importpath = "github.com/nwaples/rardecode",
+ sum = "h1:Cj0yZY6T1Zx1R7AhTbyGSALm44/Mmq+BAPc4B/p/d3M=",
+ version = "v1.1.2",
+)
+
+go_repository(
+ name = "com_github_oleiade_lane",
+ importpath = "github.com/oleiade/lane",
+ sum = "h1:hXofkn7GEOubzTwNpeL9MaNy8WxolCYb9cInAIeqShU=",
+ version = "v1.0.1",
+)
+
+go_repository(
+ name = "com_github_pierrec_lz4",
+ importpath = "github.com/pierrec/lz4",
+ sum = "h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM=",
+ version = "v2.6.1+incompatible",
+)
+
+go_repository(
+ name = "com_github_pierrec_lz4_v4",
+ importpath = "github.com/pierrec/lz4/v4",
+ sum = "h1:44l88ehTZAUGW4VlO1QC4zkilL99M6Y9MXNwEs0uzP8=",
+ version = "v4.1.12",
+)
+
+go_repository(
+ name = "com_github_pkg_diff",
+ importpath = "github.com/pkg/diff",
+ sum = "h1:aoZm08cpOy4WuID//EZDgcC4zIxODThtZNPirFr42+A=",
+ version = "v0.0.0-20210226163009-20ebb0f2a09e",
+)
+
+go_repository(
+ name = "com_github_pkg_profile",
+ importpath = "github.com/pkg/profile",
+ sum = "h1:hUDfIISABYI59DyeB3OTay/HxSRwTQ8rB/H83k6r5dM=",
+ version = "v1.6.0",
+)
+
+go_repository(
+ name = "com_github_pmezard_go_difflib",
+ importpath = "github.com/pmezard/go-difflib",
+ sum = "h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=",
+ version = "v1.0.0",
+)
+
+go_repository(
+ name = "com_github_rogpeppe_go_internal",
+ importpath = "github.com/rogpeppe/go-internal",
+ sum = "h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=",
+ version = "v1.8.0",
+)
+
+go_repository(
+ name = "com_github_stretchr_objx",
+ importpath = "github.com/stretchr/objx",
+ sum = "h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=",
+ version = "v0.1.0",
+)
+
+go_repository(
+ name = "com_github_stretchr_testify",
+ importpath = "github.com/stretchr/testify",
+ sum = "h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=",
+ version = "v1.7.0",
+)
+
+go_repository(
+ name = "com_github_ulikunitz_xz",
+ importpath = "github.com/ulikunitz/xz",
+ sum = "h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8=",
+ version = "v0.5.10",
+)
+
+go_repository(
+ name = "com_github_xi2_xz",
+ importpath = "github.com/xi2/xz",
+ sum = "h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo=",
+ version = "v0.0.0-20171230120015-48954b6210f8",
+)
+
+go_repository(
+ name = "com_github_yuin_goldmark",
+ importpath = "github.com/yuin/goldmark",
+ sum = "h1:dPmz1Snjq0kmkz159iL7S6WzdahUTHnHB5M56WFVifs=",
+ version = "v1.3.5",
+)
+
+go_repository(
+ name = "in_gopkg_check_v1",
+ importpath = "gopkg.in/check.v1",
+ sum = "h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=",
+ version = "v1.0.0-20190902080502-41f04d3bba15",
+)
+
+go_repository(
+ name = "in_gopkg_errgo_v2",
+ importpath = "gopkg.in/errgo.v2",
+ sum = "h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8=",
+ version = "v2.1.0",
+)
+
+go_repository(
+ name = "in_gopkg_loremipsum_v1",
+ importpath = "gopkg.in/loremipsum.v1",
+ sum = "h1:j6TAjs6Db5AMfLwTzs51Kq4Qx7dCufw/IJ0hpMbjU8U=",
+ version = "v1.1.0",
+)
+
+go_repository(
+ name = "in_gopkg_yaml_v3",
+ importpath = "gopkg.in/yaml.v3",
+ sum = "h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=",
+ version = "v3.0.0-20210107192922-496545a6307b",
+)
+
+go_repository(
+ name = "org_golang_x_crypto",
+ importpath = "golang.org/x/crypto",
+ sum = "h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=",
+ version = "v0.0.0-20191011191535-87dc89f01550",
+)
+
+go_repository(
+ name = "org_golang_x_lint",
+ importpath = "golang.org/x/lint",
+ sum = "h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs=",
+ version = "v0.0.0-20190930215403-16217165b5de",
+)
+
+go_repository(
+ name = "org_golang_x_mod",
+ importpath = "golang.org/x/mod",
+ sum = "h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=",
+ version = "v0.4.2",
+)
+
+go_repository(
+ name = "org_golang_x_net",
+ importpath = "golang.org/x/net",
+ sum = "h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=",
+ version = "v0.0.0-20210405180319-a5a99cb37ef4",
+)
+
+go_repository(
+ name = "org_golang_x_sync",
+ importpath = "golang.org/x/sync",
+ sum = "h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=",
+ version = "v0.0.0-20210220032951-036812b2e83c",
+)
+
+go_repository(
+ name = "org_golang_x_sys",
+ importpath = "golang.org/x/sys",
+ sum = "h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=",
+ version = "v0.0.0-20210510120138-977fb7262007",
+)
+
+go_repository(
+ name = "org_golang_x_term",
+ importpath = "golang.org/x/term",
+ sum = "h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=",
+ version = "v0.0.0-20201126162022-7de9c90e9dd1",
+)
+
+go_repository(
+ name = "org_golang_x_text",
+ importpath = "golang.org/x/text",
+ sum = "h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=",
+ version = "v0.3.3",
+)
+
+go_repository(
+ name = "org_golang_x_tools",
+ importpath = "golang.org/x/tools",
+ sum = "h1:ouewzE6p+/VEB31YYnTbEJdi8pFqKp4P4n85vwo3DHA=",
+ version = "v0.1.5",
+)
+
+go_repository(
+ name = "org_golang_x_xerrors",
+ importpath = "golang.org/x/xerrors",
+ sum = "h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=",
+ version = "v0.0.0-20200804184101-5ec99f83aff1",
+)
+
+go_repository(
+ name = "org_uber_go_goleak",
+ importpath = "go.uber.org/goleak",
+ sum = "h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=",
+ version = "v1.1.12",
+)
diff --git a/cmd/zipper/BUILD.bazel b/cmd/zipper/BUILD.bazel
index 509314f..fd94e02 100644
--- a/cmd/zipper/BUILD.bazel
+++ b/cmd/zipper/BUILD.bazel
@@ -1,5 +1,4 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
-load("@io_bazel_rules_docker//go:image.bzl", "go_image")
go_library(
name = "zipper_lib",
@@ -19,13 +18,3 @@ go_binary(
static = "on",
visibility = ["//visibility:public"],
)
-
-go_image(
- name = "zipper_image",
- srcs = ["main.go"],
- importpath = "github.com/pratikbalar/zipper/cmd/zipper",
- deps = [
- "//internal/zipper",
- "@com_github_pkg_profile//:profile",
- ],
-)
From 542900b5b6fe1f9d78d4f1136a2b08f5100b89ea Mon Sep 17 00:00:00 2001
From: pratikbalar <68642400+pratikbalar@users.noreply.github.com>
Date: Sun, 27 Feb 2022 14:38:41 +0530
Subject: [PATCH 07/46] ci: bazel based container build
---
.github/workflows/test.yaml | 13 +++++++++++--
WORKSPACE | 29 ++++++++++++++++++++++++++---
cmd/zipper/BUILD.bazel | 8 ++++++++
3 files changed, 45 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 96cf8f8..be8b55f 100755
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -15,14 +15,23 @@ jobs:
- uses: bazelbuild/setup-bazelisk@v1
- - run: |
+ - name: Test
+ run: |
bazelisk test \
--config=ci \
--remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} \
//...
- - run: |
+ - name: Build
+ run: |
bazelisk build \
--config=ci \
--remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} \
//...
+
+ - name: Build image
+ run: |
+ bazelisk build \
+ --config=ci \
+ --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} \
+ //cmd/zipper:go_image
diff --git a/WORKSPACE b/WORKSPACE
index 2a8b363..6dabed6 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -2,10 +2,10 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
- sha256 = "2b1641428dff9018f9e85c0384f03ec6c10660d935b750e3fa1492a281a53b0f",
+ sha256 = "d6b2513456fe2229811da7eb67a444be7785f5323c6708b38d851d2b51e54d83",
urls = [
- "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip",
- "https://github.com/bazelbuild/rules_go/releases/download/v0.29.0/rules_go-v0.29.0.zip",
+ "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.30.0/rules_go-v0.30.0.zip",
+ "https://github.com/bazelbuild/rules_go/releases/download/v0.30.0/rules_go-v0.30.0.zip",
],
)
@@ -42,6 +42,29 @@ load("@io_buildbuddy_buildbuddy_toolchain//:rules.bzl", "buildbuddy")
buildbuddy(name = "buildbuddy_toolchain")
+http_archive(
+ name = "io_bazel_rules_docker",
+ sha256 = "85ffff62a4c22a74dbd98d05da6cf40f497344b3dbf1e1ab0a37ab2a1a6ca014",
+ strip_prefix = "rules_docker-0.23.0",
+ urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.23.0/rules_docker-v0.23.0.tar.gz"],
+)
+
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+load(
+ "@io_bazel_rules_docker//repositories:repositories.bzl",
+ container_repositories = "repositories",
+)
+
+container_repositories()
+
+load(
+ "@io_bazel_rules_docker//go:image.bzl",
+ _go_image_repos = "repositories",
+)
+
+_go_image_repos()
+
############################################################
# Define your own dependencies here using go_repository.
# Else, dependencies declared by rules_go/gazelle will be used.
diff --git a/cmd/zipper/BUILD.bazel b/cmd/zipper/BUILD.bazel
index fd94e02..a3a838b 100644
--- a/cmd/zipper/BUILD.bazel
+++ b/cmd/zipper/BUILD.bazel
@@ -18,3 +18,11 @@ go_binary(
static = "on",
visibility = ["//visibility:public"],
)
+
+load("@io_bazel_rules_docker//go:image.bzl", "go_image")
+
+go_image(
+ name = "go_image",
+ srcs = ["main.go"],
+ importpath = "github.com/pratikbalar/zipper/cmd/zipper",
+)
From cfb4129f4ed10441ab27785077c4e96b1151f2c5 Mon Sep 17 00:00:00 2001
From: pratikbalar <68642400+pratikbalar@users.noreply.github.com>
Date: Sun, 27 Feb 2022 14:41:10 +0530
Subject: [PATCH 08/46] bazel: fix go image deps
---
cmd/zipper/BUILD.bazel | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/cmd/zipper/BUILD.bazel b/cmd/zipper/BUILD.bazel
index a3a838b..b93dba4 100644
--- a/cmd/zipper/BUILD.bazel
+++ b/cmd/zipper/BUILD.bazel
@@ -25,4 +25,8 @@ go_image(
name = "go_image",
srcs = ["main.go"],
importpath = "github.com/pratikbalar/zipper/cmd/zipper",
+ deps = [
+ "//internal/zipper",
+ "@com_github_pkg_profile//:profile",
+ ],
)
From 95319e756d5a91e67a15b67a25c1f01ac56c830e Mon Sep 17 00:00:00 2001
From: pratikbalar <68642400+pratikbalar@users.noreply.github.com>
Date: Sun, 27 Feb 2022 14:46:46 +0530
Subject: [PATCH 09/46] ci: add link checker ci
---
.github/workflows/links.yaml | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
create mode 100644 .github/workflows/links.yaml
diff --git a/.github/workflows/links.yaml b/.github/workflows/links.yaml
new file mode 100644
index 0000000..86c3287
--- /dev/null
+++ b/.github/workflows/links.yaml
@@ -0,0 +1,19 @@
+name: Links
+
+on:
+ push:
+ paths:
+ - "**.md"
+
+jobs:
+ linkChecker:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Link Checker
+ uses: lycheeverse/lychee-action@v1.3.0
+ with:
+ fail: true
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
From 634239aa75187b32df8704c1da679912e3985637 Mon Sep 17 00:00:00 2001
From: pratikbalar <68642400+pratikbalar@users.noreply.github.com>
Date: Mon, 28 Feb 2022 22:56:46 +0530
Subject: [PATCH 10/46] ci: remove container building
---
WORKSPACE | 23 -----------------------
cmd/zipper/BUILD.bazel | 13 -------------
2 files changed, 36 deletions(-)
diff --git a/WORKSPACE b/WORKSPACE
index 6dabed6..9e09a17 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -42,29 +42,6 @@ load("@io_buildbuddy_buildbuddy_toolchain//:rules.bzl", "buildbuddy")
buildbuddy(name = "buildbuddy_toolchain")
-http_archive(
- name = "io_bazel_rules_docker",
- sha256 = "85ffff62a4c22a74dbd98d05da6cf40f497344b3dbf1e1ab0a37ab2a1a6ca014",
- strip_prefix = "rules_docker-0.23.0",
- urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.23.0/rules_docker-v0.23.0.tar.gz"],
-)
-
-load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
-
-load(
- "@io_bazel_rules_docker//repositories:repositories.bzl",
- container_repositories = "repositories",
-)
-
-container_repositories()
-
-load(
- "@io_bazel_rules_docker//go:image.bzl",
- _go_image_repos = "repositories",
-)
-
-_go_image_repos()
-
############################################################
# Define your own dependencies here using go_repository.
# Else, dependencies declared by rules_go/gazelle will be used.
diff --git a/cmd/zipper/BUILD.bazel b/cmd/zipper/BUILD.bazel
index b93dba4..b5b5030 100644
--- a/cmd/zipper/BUILD.bazel
+++ b/cmd/zipper/BUILD.bazel
@@ -14,19 +14,6 @@ go_library(
go_binary(
name = "zipper",
embed = [":zipper_lib"],
- pure = "on",
static = "on",
visibility = ["//visibility:public"],
)
-
-load("@io_bazel_rules_docker//go:image.bzl", "go_image")
-
-go_image(
- name = "go_image",
- srcs = ["main.go"],
- importpath = "github.com/pratikbalar/zipper/cmd/zipper",
- deps = [
- "//internal/zipper",
- "@com_github_pkg_profile//:profile",
- ],
-)
From 6d7fc85050c77493ca56dba49160ff60cf67049b Mon Sep 17 00:00:00 2001
From: pratikbalar <68642400+pratikbalar@users.noreply.github.com>
Date: Mon, 28 Feb 2022 23:04:19 +0530
Subject: [PATCH 11/46] ci: strip binary
---
.bazelrc | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/.bazelrc b/.bazelrc
index 93b45d2..3ff15bf 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -1,3 +1,5 @@
+build:common --strip=always
+
build:remote --remote_cache=grpcs://remote.buildbuddy.io
build:remote --remote_executor=grpcs://remote.buildbuddy.io
build:remote --remote_upload_local_results
@@ -11,12 +13,14 @@ build:remote --extra_execution_platforms=@buildbuddy_toolchain//:platform
build:remote --extra_toolchains=@buildbuddy_toolchain//:cc_toolchain
build:ci --config=remote
+build:ci --config=common
build:ci --build_metadata=VISIBILITY=PUBLIC
build:ci --build_metadata=ROLE=CI
build:ci --bes_results_url=https://app.buildbuddy.io/invocation/
build:ci --bes_backend=grpcs://remote.buildbuddy.io
## Local settings
+build --config=common
build --jobs=HOST_CPUS
test --jobs=HOST_CPUS
From 1cea088287dac20fcf4b80f900b8feb23f913c8a Mon Sep 17 00:00:00 2001
From: pratikbalar <68642400+pratikbalar@users.noreply.github.com>
Date: Tue, 1 Mar 2022 10:00:02 +0530
Subject: [PATCH 12/46] ci: do not cache standard lib
---
.bazelrc | 1 +
1 file changed, 1 insertion(+)
diff --git a/.bazelrc b/.bazelrc
index 3ff15bf..2dfd548 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -8,6 +8,7 @@ build:remote --platforms=@buildbuddy_toolchain//:platform
build:remote --crosstool_top=@buildbuddy_toolchain//:toolchain
build:remote --jobs=100
build:remote --define=EXECUTOR=remote
+build:remote --modify_execution_info='GoStdlib.*=+no-remote-cache
build:remote --extra_execution_platforms=@buildbuddy_toolchain//:platform
build:remote --extra_toolchains=@buildbuddy_toolchain//:cc_toolchain
From 449fa21e604c3dab38ab153368e8dffaf2568a45 Mon Sep 17 00:00:00 2001
From: pratikbalar <68642400+pratikbalar@users.noreply.github.com>
Date: Tue, 1 Mar 2022 10:19:53 +0530
Subject: [PATCH 13/46] ci: remove image build as it's not working in osx
---
.github/workflows/test.yaml | 19 ++++++-------------
1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index be8b55f..6ab3b4c 100755
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -18,20 +18,13 @@ jobs:
- name: Test
run: |
bazelisk test \
- --config=ci \
- --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} \
- //...
+ --config=ci \
+ --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} \
+ //...
- name: Build
run: |
bazelisk build \
- --config=ci \
- --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} \
- //...
-
- - name: Build image
- run: |
- bazelisk build \
- --config=ci \
- --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} \
- //cmd/zipper:go_image
+ --config=ci \
+ --remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} \
+ //...
From 27c0bc488f1b51fa526106bbd97ad8c31323b54f Mon Sep 17 00:00:00 2001
From: pratikbalar <68642400+pratikbalar@users.noreply.github.com>
Date: Tue, 1 Mar 2022 10:24:46 +0530
Subject: [PATCH 14/46] ci: add local caching
---
.github/workflows/test.yaml | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index 6ab3b4c..b0e63b9 100755
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -13,7 +13,16 @@ jobs:
steps:
- uses: actions/checkout@v2
- - uses: bazelbuild/setup-bazelisk@v1
+ - name: Bazel cache
+ uses: actions/cache@v2
+ with:
+ path: |
+ ~/.cache/bazel
+ key: bazel-{{ hashFiles('WORKSPACE') }}
+ restore-keys: bazel-
+
+ - name: Setup bazelisk
+ uses: bazelbuild/setup-bazelisk@v1
- name: Test
run: |
From 2b0a4884cf23e55659b1e43c19a2d628a83c6596 Mon Sep 17 00:00:00 2001
From: pratikbalar <68642400+pratikbalar@users.noreply.github.com>
Date: Wed, 9 Mar 2022 00:55:28 +0530
Subject: [PATCH 15/46] feat: bazel and table output...
- bazel: add sendbox_debug, verbose failures, test output to all, add buildifier, add bazelisk version step, add zipper tar with multiplatform builds,
- Add table based output for the zipped files
- docs: remove bazel.md, todo.md, update readme.md
---
.bazelrc | 3 +
.github/workflows/test.yaml | 7 +-
.gitignore | 1 +
BAZEL.md | 15 --
BUILD | 6 +
README.md | 36 +++-
TODO.md | 15 --
WORKSPACE | 345 +++++-------------------------------
cmd/zipper/BUILD.bazel | 72 +++++++-
deps.bzl | 14 ++
go.mod | 1 +
go.sum | 2 +
internal/zipper/BUILD.bazel | 1 +
internal/zipper/zip.go | 39 +++-
14 files changed, 201 insertions(+), 356 deletions(-)
delete mode 100644 BAZEL.md
delete mode 100644 TODO.md
diff --git a/.bazelrc b/.bazelrc
index 2dfd548..36ba7cb 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -1,4 +1,7 @@
+build:common --sandbox_debug
+build:common --verbose_failures
build:common --strip=always
+test:common --test_output=all
build:remote --remote_cache=grpcs://remote.buildbuddy.io
build:remote --remote_executor=grpcs://remote.buildbuddy.io
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
index b0e63b9..ce9f241 100755
--- a/.github/workflows/test.yaml
+++ b/.github/workflows/test.yaml
@@ -24,16 +24,19 @@ jobs:
- name: Setup bazelisk
uses: bazelbuild/setup-bazelisk@v1
+ - name: bazel version
+ run: bazelisk --version
+
- name: Test
run: |
bazelisk test \
--config=ci \
--remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} \
- //...
+ $(bazelisk query 'kind(".*_test", //...:*)')
- name: Build
run: |
bazelisk build \
--config=ci \
--remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} \
- //...
+ //cmd/zipper:zipper_tar
diff --git a/.gitignore b/.gitignore
index b126e38..8a43dd6 100755
--- a/.gitignore
+++ b/.gitignore
@@ -54,3 +54,4 @@ trace.out
.bazelversion
# User-specific .bazelrc
user.bazelrc
+cert/*
diff --git a/BAZEL.md b/BAZEL.md
deleted file mode 100644
index 9414ba8..0000000
--- a/BAZEL.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# Bazel
-
-## Update
-
-### Build files
-
-```shell
-bazel run //:gazelle
-```
-
-### Go deps
-
-```shell
-bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=deps.bzl%go_dependencies
-```
diff --git a/BUILD b/BUILD
index 9b9dcb2..257ee2a 100644
--- a/BUILD
+++ b/BUILD
@@ -12,3 +12,9 @@ gazelle(
],
command = "update-repos",
)
+
+load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
+
+buildifier(
+ name = "buildifier",
+)
diff --git a/README.md b/README.md
index 9b89a0b..8716ff9 100755
--- a/README.md
+++ b/README.md
@@ -60,7 +60,7 @@ Container image availabel for
- **windows**: *available soon*
-Image available for
+Binaries available for
- **linux**: `amd64`, `386`, `arm64`, `riscv64`, `ppc64le`, `s390x`, `mips64le`, `mips64`, `arm/v7`, `arm/v6`
@@ -75,21 +75,20 @@ Image available for
### Testing
```shell
-go test -v ./...
-go test -v -race ./...
+bazel test //...
```
### Profiling
```shell
go build -ldflags="-X main.profEnable=true" ./cmd/zipper/
-./zipper 10000 /home/pratik/workspace/pratikbalar/zipper/test
```
#### CPU and Memory profiling
```shell
-go tool pprof -http=:8080 mem.pprof
+go tool pprof -http=:8080 mem.pprof &
+go tool pprof -http=:8081 cpu.pprof
```
@@ -106,9 +105,34 @@ go tool trace trace.out
>
+### Build files
+
+```shell
+bazel run //:gazelle
+```
+
+### Go deps
+
+```shell
+bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro=deps.bzl%go_dependencies
+```
+
## To-Do
-move to [todo.md](TODO.md)
+- [ ] Use existing buffer for zip creation
+- [ ] Replace queue with channels
+- [ ] Try bazel
+- [ ] Add structured logging `: