Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permissions:
contents: read

jobs:
test:
go:
strategy:
matrix:
go-version: [1.22.x, 1.23.x] # oldest version that can build go mock and official supported go versions
Expand Down Expand Up @@ -40,10 +40,35 @@ jobs:
./ci/test.sh
./ci/check_panic_handling.sh

- name: Run Tests
- name: Run Go Tests
run: |
for i in $(find $PWD -name go.mod); do
for i in $(find $PWD -name go.mod ! -path "$PWD/bazel/go.mod"); do
pushd $(dirname $i)
go test ./...
popd
done

bazel:
strategy:
matrix:
os:
- macos
- ubuntu
runs-on: ${{ matrix.os }}-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Bazel
uses: bazel-contrib/[email protected]
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Store build cache per workflow.
disk-cache: ${{ github.workflow }}
# Share repository cache between workflows.
repository-cache: true

- name: Run Bazel tests
run: |
cd bazel && bazel test //...
2 changes: 2 additions & 0 deletions bazel/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bazel-*
MODULE.bazel.lock
Empty file added bazel/BUILD.bazel
Empty file.
16 changes: 16 additions & 0 deletions bazel/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module(name = "bazel_gomock")

bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "rules_go", version = "0.51.0", repo_name = "io_bazel_rules_go")
bazel_dep(name = "gazelle", version = "0.40.0")

go_sdk = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk")

go_sdk.download(version = "1.23.4")

go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod")
use_repo(
go_deps,
"org_uber_go_mock",
)
Empty file added bazel/WORKSPACE
Empty file.
5 changes: 5 additions & 0 deletions bazel/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module go.uber.org/mock/bazel

go 1.23.0

require go.uber.org/mock v0.4.0
2 changes: 2 additions & 0 deletions bazel/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
go.uber.org/mock v0.4.0 h1:VcM4ZOtdbR4f6VXfiOpwpVJDL6lCReaZ6mw31wqh7KU=
go.uber.org/mock v0.4.0/go.mod h1:a6FSlNadKUHUa9IP5Vyt1zh4fC7uAwxMutEAscFbkZc=
9 changes: 9 additions & 0 deletions bazel/rules/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")

go_library(
name = "rules",
srcs = ["tools.go"],
importpath = "go.uber.org/mock/bazel/rules",
visibility = ["//visibility:public"],
deps = ["@org_uber_go_mock//mockgen/model:go_default_library"],
)
Loading
Loading