Skip to content
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

Add Bazel build config #14

Open
wants to merge 1 commit into
base: yext
Choose a base branch
from
Open
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
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,9 @@ integration_tests/log_dir/

#OSX
.DS_Store

#Bazel
bazel-bin
bazel-go-teamcity
bazel-out
bazel-testlogs
4 changes: 4 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
load("@bazel_gazelle//:def.bzl", "gazelle")

# gazelle:prefix github.com/yext/go-teamcity
gazelle(name = "gazelle")
28 changes: 28 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
workspace(name = "com_github_yext_go_teamcity")

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_go",
sha256 = "8e968b5fcea1d2d64071872b12737bbb5514524ee5f0a4f54f5920266c261acb",
url = "https://github.com/bazelbuild/rules_go/releases/download/v0.28.0/rules_go-v0.28.0.zip",
)

http_archive(
name = "bazel_gazelle",
sha256 = "62ca106be173579c0a167deb23358fdfe71ffa1e4cfdddf5582af26520f1c66f",
url = "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.23.0/bazel-gazelle-v0.23.0.tar.gz",
)

load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
load("//:repositories.bzl", "go_repositories")

# gazelle:repository_macro repositories.bzl%go_repositories
go_repositories()

go_rules_dependencies()

go_register_toolchains(version = "1.16.5")

gazelle_dependencies()
45 changes: 45 additions & 0 deletions repositories.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
load("@bazel_gazelle//:deps.bzl", "go_repository")

def go_repositories():
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_dghubble_sling",
importpath = "github.com/dghubble/sling",
sum = "h1:pZHjCJq4zJvc6qVQ5wN1jo5oNZlNE0+8T/h0XeXBUKU=",
version = "v1.3.0",
)
go_repository(
name = "com_github_google_go_querystring",
importpath = "github.com/google/go-querystring",
sum = "h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=",
version = "v1.0.0",
)
go_repository(
name = "com_github_motemen_go_loghttp",
importpath = "github.com/motemen/go-loghttp",
sum = "h1:uAI3rnOT1OSSY4PUtI/M1orb3q0ewkovwd3wr8xSno4=",
version = "v0.0.0-20170804080138-974ac5ceac27",
)
go_repository(
name = "com_github_motemen_go_nuts",
importpath = "github.com/motemen/go-nuts",
sum = "h1:gfo7RLzXaBdNShd7F5N3K1oM779cD777np9ljUgvf9s=",
version = "v0.0.0-20180315145558-42c35bdb11c2",
)
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_stretchr_testify",
importpath = "github.com/stretchr/testify",
sum = "h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=",
version = "v1.2.2",
)
98 changes: 98 additions & 0 deletions teamcity/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
name = "teamcity",
srcs = [
"agent_requirement.go",
"artifact_dep.go",
"artifact_dep_options.go",
"build_feature.go",
"build_template.go",
"build_type.go",
"build_type_options.go",
"dependency.go",
"dependency_type.go",
"feature_commit_publisher.go",
"generic_build_feature.go",
"git_vcs_root.go",
"git_vcs_root_options.go",
"locator.go",
"parameter.go",
"project.go",
"properties.go",
"property_assertions.go",
"response_decoder.go",
"rest_helper.go",
"server.go",
"snapshot_dep.go",
"status_publisher_github_options.go",
"step.go",
"step_command_line.go",
"step_octopus_create_release.go",
"step_octopus_push_package.go",
"step_powershell.go",
"teamcity.go",
"trigger.go",
"trigger_buildfinish.go",
"trigger_buildfinish_options.go",
"trigger_schedule.go",
"trigger_schedule_options.go",
"trigger_types.go",
"trigger_vcs.go",
"trigger_vcs_options.go",
"util.go",
"vcs_names.go",
"vcs_root.go",
"vcs_root_entry.go",
],
importpath = "github.com/yext/go-teamcity/teamcity",
visibility = ["//visibility:public"],
deps = [
"@com_github_dghubble_sling//:sling",
"@com_github_motemen_go_loghttp//:go-loghttp",
"@com_github_motemen_go_loghttp//global",
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
],
)

go_test(
name = "teamcity_test",
srcs = [
"agent_requirement_test.go",
"artifact_dep_options_test.go",
"artifact_dep_test.go",
"build_feature_test.go",
"build_template_test.go",
"build_type_options_test.go",
"build_type_step_test.go",
"build_type_test.go",
"context_test.go",
"dependency_test.go",
"feature_commit_publisher_test.go",
"generic_build_feature_test.go",
"git_vcs_root_options_test.go",
"locator_test.go",
"parameter_test.go",
"project_test.go",
"property_assertions_test.go",
"server_test.go",
"snapshot_dep_test.go",
"status_publisher_github_options_test.go",
"step_octopus_create_release_test.go",
"teamcity_test.go",
"trigger_buildfinish_options_test.go",
"trigger_schedule_options_test.go",
"trigger_schedule_test.go",
"trigger_test.go",
"trigger_vcs_options_test.go",
"trigger_vcs_test.go",
"vcs_root_test.go",
],
embed = [":teamcity"],
deps = [
"@com_github_stretchr_testify//assert",
"@com_github_stretchr_testify//require",
"@com_github_stretchr_testify//suite",
],
)
2 changes: 1 addition & 1 deletion teamcity/agent_requirement_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package teamcity_test
import (
"testing"

"github.com/cvbarros/go-teamcity/teamcity"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/yext/go-teamcity/teamcity"
)

func TestAgentRequirement_Create(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion teamcity/artifact_dep_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (

"github.com/stretchr/testify/assert"

"github.com/cvbarros/go-teamcity/teamcity"
"github.com/yext/go-teamcity/teamcity"
)

func Test_ArtifactDependency_Invariants(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion teamcity/build_feature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package teamcity_test
import (
"testing"

"github.com/cvbarros/go-teamcity/teamcity"
"github.com/stretchr/testify/suite"
"github.com/yext/go-teamcity/teamcity"
)

type SuiteBuildFeature struct {
Expand Down
2 changes: 1 addition & 1 deletion teamcity/build_type_step_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package teamcity_test
import (
"testing"

"github.com/cvbarros/go-teamcity/teamcity"
"github.com/stretchr/testify/suite"
"github.com/yext/go-teamcity/teamcity"
)

type SuiteBuildTypeSteps struct {
Expand Down
2 changes: 1 addition & 1 deletion teamcity/build_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package teamcity_test
import (
"testing"

"github.com/cvbarros/go-teamcity/teamcity"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/yext/go-teamcity/teamcity"
)

func TestBuildType_Create(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion teamcity/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"testing"
"time"

"github.com/cvbarros/go-teamcity/teamcity"
"github.com/yext/go-teamcity/teamcity"
)

type TestContext struct {
Expand Down
2 changes: 1 addition & 1 deletion teamcity/dependency_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"github.com/stretchr/testify/require"

"github.com/cvbarros/go-teamcity/teamcity"
"github.com/yext/go-teamcity/teamcity"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion teamcity/feature_commit_publisher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package teamcity_test
import (
"testing"

"github.com/cvbarros/go-teamcity/teamcity"
"github.com/stretchr/testify/assert"
"github.com/yext/go-teamcity/teamcity"
)

func TestFeatureCommitPublisher_UnmarshallProperties_Github(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion teamcity/parameter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

"github.com/stretchr/testify/assert"

"github.com/cvbarros/go-teamcity/teamcity"
"github.com/stretchr/testify/require"
"github.com/yext/go-teamcity/teamcity"
)

func Test_ParameterConfiguration_Serialization(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion teamcity/project_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"net/http"
"testing"

"github.com/cvbarros/go-teamcity/teamcity"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/yext/go-teamcity/teamcity"
)

func TestProject_Create(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion teamcity/property_assertions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package teamcity_test
import (
"testing"

"github.com/cvbarros/go-teamcity/teamcity"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/yext/go-teamcity/teamcity"
)

type PropertyAssertions struct {
Expand Down
2 changes: 1 addition & 1 deletion teamcity/snapshot_dep_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package teamcity_test
import (
"testing"

"github.com/cvbarros/go-teamcity/teamcity"
"github.com/yext/go-teamcity/teamcity"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion teamcity/status_publisher_github_options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package teamcity_test
import (
"testing"

"github.com/cvbarros/go-teamcity/teamcity"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/yext/go-teamcity/teamcity"
)

const githubHost = "https://api.github.com"
Expand Down
2 changes: 1 addition & 1 deletion teamcity/step_octopus_create_release_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package teamcity_test
import (
"testing"

teamcity "github.com/cvbarros/go-teamcity/teamcity"
"github.com/stretchr/testify/assert"
teamcity "github.com/yext/go-teamcity/teamcity"
)

// Ensure serialization/deserialization works as expected.
Expand Down
2 changes: 1 addition & 1 deletion teamcity/teamcity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"os"
"testing"

"github.com/cvbarros/go-teamcity/teamcity"
"github.com/yext/go-teamcity/teamcity"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
2 changes: 1 addition & 1 deletion teamcity/trigger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"testing"
"time"

"github.com/cvbarros/go-teamcity/teamcity"
"github.com/stretchr/testify/suite"
"github.com/yext/go-teamcity/teamcity"
)

type SuiteBuildTypeTrigger struct {
Expand Down
2 changes: 1 addition & 1 deletion teamcity/trigger_vcs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package teamcity_test
import (
"testing"

"github.com/cvbarros/go-teamcity/teamcity"
"github.com/yext/go-teamcity/teamcity"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
Loading