Skip to content

Commit 845d698

Browse files
authored
add ci process (#1)
* add ci process * add gazelle check * add cache * update README
1 parent 6bc4430 commit 845d698

3 files changed

Lines changed: 52 additions & 14 deletions

File tree

.github/workflows/bazel-ci.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Bazel CI
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
branches:
8+
- main
9+
pull_request:
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
timeout-minutes: 5
15+
steps:
16+
- name: Cache bazel
17+
uses: actions/cache@v2.1.4
18+
env:
19+
cache-name: bazel-cache
20+
with:
21+
path: |
22+
~/.cache/bazelisk
23+
~/.cache/bazel
24+
key: ${{ runner.os }}-${{ env.cache-name }}
25+
- uses: actions/checkout@v3
26+
- name: gazelle check
27+
run: bazel run //:gazelle_ci
28+
- name: test
29+
run: bazel test //...
30+
- name: build
31+
run: bazel build //...
32+
- name: compatibility tests
33+
run: ./test.sh

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,10 @@ A couple reasons:
1313

1414
2. What are the differences from `bazel-diff`?
1515

16-
* Due to some implementation differences, the actual hashes generated by the two programs are different
16+
* Some of the short codes for the CLI are different (only supporting one character instead of two)
17+
* Due to some minor implementation differences, the actual hashes generated by the two programs are different
1718
* `bazel-differ` isn't using `streamed_proto` output from Bazel query (I'm not sure if there is a Go implemntation of this?). In some minimal testing against some large repositories, `bazel-differ` still seems to outperform `bazel-diff` by 2x.
19+
20+
3. What target types has this been tested against?
21+
22+
* `bazel-differ` runs compatibility tests to validate it's target outputs vs. `bazel-diff`. Additional test cases can be added via `tools/test_compatibility.sh`.

cli/BUILD.bazel

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
11
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
22

3-
go_library(
4-
name = "cli",
5-
srcs = ["main.go"],
6-
importpath = "github.com/ewhauser/bazel-differ/bazel-differ",
7-
visibility = ["//visibility:private"],
8-
deps = ["//cmd"],
9-
)
10-
113
go_binary(
124
name = "bazel-differ",
13-
embed = [":cli"],
5+
embed = [":cli_lib"],
146
visibility = ["//visibility:public"],
157
)
168

179
go_binary(
1810
name = "bazel-differ-linux-amd64",
19-
embed = [":cli"],
11+
embed = [":cli_lib"],
2012
goarch = "amd64",
2113
goos = "linux",
2214
pure = "on",
@@ -26,7 +18,7 @@ go_binary(
2618

2719
go_binary(
2820
name = "bazel-differ-linux-arm64",
29-
embed = [":cli"],
21+
embed = [":cli_lib"],
3022
goarch = "arm64",
3123
goos = "linux",
3224
pure = "on",
@@ -36,7 +28,7 @@ go_binary(
3628

3729
go_binary(
3830
name = "bazel-differ-darwin-amd64",
39-
embed = [":cli"],
31+
embed = [":cli_lib"],
4032
goarch = "amd64",
4133
goos = "darwin",
4234
pure = "on",
@@ -46,10 +38,18 @@ go_binary(
4638

4739
go_binary(
4840
name = "bazel-differ-darwin-arm64",
49-
embed = [":cli"],
41+
embed = [":cli_lib"],
5042
goarch = "arm64",
5143
goos = "darwin",
5244
pure = "on",
5345
static = "on",
5446
visibility = ["//visibility:public"],
5547
)
48+
49+
go_library(
50+
name = "cli_lib",
51+
srcs = ["main.go"],
52+
importpath = "github.com/ewhauser/bazel-differ/cli",
53+
visibility = ["//visibility:private"],
54+
deps = ["//cmd"],
55+
)

0 commit comments

Comments
 (0)