Skip to content

Commit defa9e8

Browse files
author
Som Bhattacharjee
committed
[#1] add CI setup and upgrade dependencies
1 parent a0b5e77 commit defa9e8

File tree

7 files changed

+1055
-1907
lines changed

7 files changed

+1055
-1907
lines changed

.github/workflows/main.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
on: [push, pull_request]
2+
name: CI
3+
jobs:
4+
analyse-and-test:
5+
strategy:
6+
matrix:
7+
go-version: [1.23.5]
8+
os: [ubuntu-latest]
9+
runs-on: ${{ matrix.os }}
10+
steps:
11+
- name: Install Go
12+
uses: actions/setup-go@v2
13+
with:
14+
go-version: ${{ matrix.go-version }}
15+
stable: false
16+
- name: Checkout code
17+
uses: actions/checkout@v2
18+
- name: Static Code Analysis
19+
run: make setup-ci && make static-code-analysis
20+
- name: Unit Tests
21+
run: |
22+
sudo apt-get update
23+
make setup-ci && make ci-all

Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.PHONY: all clean
22
all: clean setup fmt vet lint imports copy-config setup-local-infra test-cover-report
3-
ci-all: clean setup fmt vet lint imports copy-config-ci test-cover-report
3+
ci-all: clean setup fmt vet lint imports copy-config-ci setup-ci-infra test-cover-report
44

55
APP=belvedere
66
ALL_PACKAGES=$(shell go list ./...)
@@ -73,9 +73,17 @@ test-cover-report: test-cover
7373
test-cover-html: test-cover
7474
@go tool cover -html=coverage.out
7575

76+
static-code-analysis: clean fmt vet lint imports
77+
78+
setup-ci-infra: clean-stale-infra setup-docker-directory
79+
@echo "starting all infra for tests..."
80+
@docker compose up -d
81+
@echo "waiting for all components to be available ..."
82+
@sleep 15
83+
7684
setup-local-infra: clean-stale-infra setup-docker-directory
7785
@echo "starting all infra for tests..."
78-
@docker-compose up -d
86+
@docker compose up -d
7987
@echo "waiting for all components to be available ..."
8088
@sleep 30
8189

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
# Belvedere
2+
3+
---
4+
5+
![Workflow Status](https://github.com/isomnath/belvedere/actions/workflows/main.yml/badge.svg)
6+
[![Go Report Card](https://goreportcard.com/badge/github.com/isomnath/belvedere)](https://goreportcard.com/report/github.com/isomnath/belvedere)
7+
18
<div align="center">
29
<img src="assets/belvedere.jpeg" title="Belvedere" alt="Belvedere Logo">
310
</div>
411

5-
# Belvedere
6-
712
Full-featured library to bootstrap golang applications lightning quick.
813

914
- [Features](#features)

console/mongo_indexes_test.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@ package console
33
import (
44
"context"
55
"testing"
6+
"time"
67

78
"github.com/isomnath/belvedere/config"
89
"github.com/isomnath/belvedere/instrumentation"
910
"github.com/isomnath/belvedere/log"
1011
"github.com/isomnath/belvedere/store"
1112

1213
"github.com/stretchr/testify/suite"
14+
"go.mongodb.org/mongo-driver/bson"
1315
"go.mongodb.org/mongo-driver/mongo"
14-
"go.mongodb.org/mongo-driver/x/bsonx"
1516
)
1617

1718
type MongoIndexSupportTestSuite struct {
@@ -43,8 +44,8 @@ func (suite *MongoIndexSupportTestSuite) TearDownTest() {
4344
func (suite *MongoIndexSupportTestSuite) TestCreateIndexesSuccessfully() {
4445
indexes := []mongo.IndexModel{
4546
{
46-
Keys: bsonx.MDoc{
47-
"test_key": bsonx.Int64(1),
47+
Keys: bson.M{
48+
"test_key": int64(1),
4849
},
4950
},
5051
}
@@ -58,16 +59,16 @@ func (suite *MongoIndexSupportTestSuite) TestCreateIndexesSuccessfully() {
5859
func (suite *MongoIndexSupportTestSuite) TestCreateIndexesFails() {
5960
indexes := []mongo.IndexModel{
6061
{
61-
Keys: bsonx.MDoc{
62-
"test_key": bsonx.Int64(1),
62+
Keys: bson.M{
63+
"test_key": int64(1),
6364
},
6465
},
6566
}
6667
_ = CreateIndexes(suite.collectionName, indexes)
6768
indexes = []mongo.IndexModel{
6869
{
69-
Keys: bsonx.MDoc{
70-
"test_key": bsonx.Timestamp(uint32(1), uint32(12)),
70+
Keys: bson.M{
71+
"test_key": time.Now(),
7172
},
7273
},
7374
}

docker-compose.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
version: '3.0'
2-
31
services:
42
postgres:
5-
image: postgres:11.4-alpine
3+
image: postgres:17.0
64
container_name: belvedere_postgres
75
restart: always
86
environment:

go.mod

Lines changed: 103 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,133 @@
11
module github.com/isomnath/belvedere
22

3-
go 1.20
3+
go 1.23
44

55
require (
6-
github.com/jmoiron/sqlx v1.3.5
6+
github.com/jmoiron/sqlx v1.4.0
77
github.com/lib/pq v1.10.9
8-
github.com/mitchellh/mapstructure v1.5.0
9-
github.com/sirupsen/logrus v1.9.0
10-
github.com/spf13/viper v1.15.0
11-
github.com/stretchr/testify v1.8.2
12-
go.mongodb.org/mongo-driver v1.11.6
8+
github.com/mitchellh/mapstructure v1.5.1-0.20231216201459-8508981c8b6c
9+
github.com/sirupsen/logrus v1.9.3
10+
github.com/spf13/viper v1.19.0
11+
github.com/stretchr/testify v1.10.0
12+
go.mongodb.org/mongo-driver v1.17.2
1313
)
1414

1515
require (
16-
github.com/DataDog/datadog-go/v5 v5.2.0
17-
github.com/getsentry/sentry-go v0.21.0
18-
github.com/golang-migrate/migrate v3.5.4+incompatible
19-
github.com/golang-migrate/migrate/v4 v4.15.2
20-
github.com/newrelic/go-agent v3.20.3+incompatible
16+
github.com/DataDog/datadog-go/v5 v5.6.0
17+
github.com/getsentry/sentry-go v0.31.1
18+
github.com/golang-migrate/migrate/v4 v4.18.1
19+
github.com/newrelic/go-agent v3.21.0+incompatible
2120
gopkg.in/redis.v5 v5.2.9
2221
)
2322

2423
require (
25-
github.com/DataDog/datadog-agent/pkg/obfuscate v0.42.0 // indirect
26-
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.42.0 // indirect
27-
github.com/DataDog/go-tuf v0.3.0--fix-localmeta-fork // indirect
28-
github.com/DataDog/sketches-go v1.4.1 // indirect
24+
github.com/DataDog/appsec-internal-go v1.9.0 // indirect
25+
github.com/DataDog/datadog-agent/pkg/obfuscate v0.61.0 // indirect
26+
github.com/DataDog/datadog-agent/pkg/proto v0.61.0 // indirect
27+
github.com/DataDog/datadog-agent/pkg/remoteconfig/state v0.61.0 // indirect
28+
github.com/DataDog/datadog-agent/pkg/trace v0.61.0 // indirect
29+
github.com/DataDog/datadog-agent/pkg/util/log v0.61.0 // indirect
30+
github.com/DataDog/datadog-agent/pkg/util/scrubber v0.61.0 // indirect
31+
github.com/DataDog/go-libddwaf/v3 v3.5.1 // indirect
32+
github.com/DataDog/go-runtime-metrics-internal v0.0.3 // indirect
33+
github.com/DataDog/go-sqllexer v0.0.20 // indirect
34+
github.com/DataDog/go-tuf v1.1.0-0.5.2 // indirect
35+
github.com/DataDog/opentelemetry-mapping-go/pkg/otlp/attributes v0.24.0 // indirect
36+
github.com/DataDog/sketches-go v1.4.6 // indirect
2937
github.com/KyleBanks/depth v1.2.1 // indirect
30-
github.com/Microsoft/go-winio v0.6.0 // indirect
31-
github.com/cespare/xxhash/v2 v2.2.0 // indirect
32-
github.com/containerd/containerd v1.6.17 // indirect
33-
github.com/davecgh/go-spew v1.1.1 // indirect
34-
github.com/dgraph-io/ristretto v0.1.1 // indirect
38+
github.com/Microsoft/go-winio v0.6.2 // indirect
39+
github.com/cespare/xxhash/v2 v2.3.0 // indirect
40+
github.com/cihub/seelog v0.0.0-20170130134532-f561c5e57575 // indirect
41+
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
3542
github.com/dustin/go-humanize v1.0.1 // indirect
36-
github.com/fsnotify/fsnotify v1.6.0 // indirect
37-
github.com/go-openapi/jsonpointer v0.19.6 // indirect
38-
github.com/go-openapi/jsonreference v0.20.2 // indirect
39-
github.com/go-openapi/spec v0.20.8 // indirect
40-
github.com/go-openapi/swag v0.22.3 // indirect
41-
github.com/golang/glog v1.0.0 // indirect
43+
github.com/eapache/queue/v2 v2.0.0-20230407133247-75960ed334e4 // indirect
44+
github.com/ebitengine/purego v0.8.2 // indirect
45+
github.com/fsnotify/fsnotify v1.8.0 // indirect
46+
github.com/go-ole/go-ole v1.3.0 // indirect
47+
github.com/go-openapi/jsonpointer v0.21.0 // indirect
48+
github.com/go-openapi/jsonreference v0.21.0 // indirect
49+
github.com/go-openapi/spec v0.21.0 // indirect
50+
github.com/go-openapi/swag v0.23.0 // indirect
51+
github.com/gogo/protobuf v1.3.2 // indirect
52+
github.com/golang/protobuf v1.5.4 // indirect
4253
github.com/golang/snappy v0.0.4 // indirect
43-
github.com/google/uuid v1.3.0 // indirect
54+
github.com/google/uuid v1.6.0 // indirect
4455
github.com/hashicorp/errwrap v1.1.0 // indirect
4556
github.com/hashicorp/go-multierror v1.1.1 // indirect
46-
github.com/hashicorp/hcl v1.0.0 // indirect
57+
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.9 // indirect
58+
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
59+
github.com/hashicorp/go-sockaddr v1.0.7 // indirect
60+
github.com/hashicorp/hcl v1.0.1-vault-7 // indirect
4761
github.com/josharian/intern v1.0.0 // indirect
48-
github.com/klauspost/compress v1.16.0 // indirect
49-
github.com/magiconair/properties v1.8.7 // indirect
50-
github.com/mailru/easyjson v0.7.7 // indirect
51-
github.com/montanaflynn/stats v0.7.0 // indirect
52-
github.com/opencontainers/image-spec v1.0.3-0.20211202183452-c5a74bcca799 // indirect
53-
github.com/pelletier/go-toml/v2 v2.0.6 // indirect
54-
github.com/philhofer/fwd v1.1.2 // indirect
62+
github.com/json-iterator/go v1.1.12 // indirect
63+
github.com/klauspost/compress v1.17.11 // indirect
64+
github.com/lufia/plan9stats v0.0.0-20240909124753-873cd0166683 // indirect
65+
github.com/magiconair/properties v1.8.9 // indirect
66+
github.com/mailru/easyjson v0.9.0 // indirect
67+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
68+
github.com/modern-go/reflect2 v1.0.2 // indirect
69+
github.com/montanaflynn/stats v0.7.1 // indirect
70+
github.com/nxadm/tail v1.4.11 // indirect
71+
github.com/outcaste-io/ristretto v0.2.3 // indirect
72+
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
73+
github.com/philhofer/fwd v1.1.3-0.20240916144458-20a13a1f6b7c // indirect
5574
github.com/pkg/errors v0.9.1 // indirect
56-
github.com/pmezard/go-difflib v1.0.0 // indirect
57-
github.com/secure-systems-lab/go-securesystemslib v0.4.0 // indirect
58-
github.com/spf13/afero v1.9.3 // indirect
59-
github.com/spf13/cast v1.5.0 // indirect
60-
github.com/spf13/jwalterweatherman v1.1.0 // indirect
75+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
76+
github.com/power-devops/perfstat v0.0.0-20240221224432-82ca36839d55 // indirect
77+
github.com/ryanuber/go-glob v1.0.0 // indirect
78+
github.com/sagikazarmark/locafero v0.7.0 // indirect
79+
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
80+
github.com/secure-systems-lab/go-securesystemslib v0.9.0 // indirect
81+
github.com/shirou/gopsutil/v3 v3.24.5 // indirect
82+
github.com/shoenig/go-m1cpu v0.1.6 // indirect
83+
github.com/sourcegraph/conc v0.3.0 // indirect
84+
github.com/spf13/afero v1.12.0 // indirect
85+
github.com/spf13/cast v1.7.1 // indirect
6186
github.com/spf13/pflag v1.0.5 // indirect
62-
github.com/subosito/gotenv v1.4.2 // indirect
63-
github.com/swaggo/files v1.0.0 // indirect
64-
github.com/swaggo/swag v1.8.10 // indirect
65-
github.com/tinylib/msgp v1.1.8 // indirect
87+
github.com/subosito/gotenv v1.6.0 // indirect
88+
github.com/swaggo/files v1.0.1 // indirect
89+
github.com/swaggo/swag v1.16.4 // indirect
90+
github.com/tinylib/msgp v1.2.5 // indirect
91+
github.com/tklauser/go-sysconf v0.3.14 // indirect
92+
github.com/tklauser/numcpus v0.9.0 // indirect
6693
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
6794
github.com/xdg-go/scram v1.1.2 // indirect
6895
github.com/xdg-go/stringprep v1.0.4 // indirect
69-
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
70-
go.uber.org/atomic v1.10.0 // indirect
71-
go4.org/intern v0.0.0-20230205224052-192e9f60865c // indirect
72-
go4.org/unsafe/assume-no-moving-gc v0.0.0-20230209150437-ee73d164e760 // indirect
73-
golang.org/x/mod v0.8.0 // indirect
74-
golang.org/x/sync v0.1.0 // indirect
75-
golang.org/x/sys v0.6.0 // indirect
76-
golang.org/x/time v0.3.0 // indirect
77-
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
78-
google.golang.org/grpc v1.53.0 // indirect
79-
google.golang.org/protobuf v1.29.1 // indirect
96+
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
97+
github.com/yusufpapurcu/wmi v1.2.4 // indirect
98+
go.opentelemetry.io/collector/component v0.117.0 // indirect
99+
go.opentelemetry.io/collector/config/configtelemetry v0.117.0 // indirect
100+
go.opentelemetry.io/collector/pdata v1.23.0 // indirect
101+
go.opentelemetry.io/collector/pdata/pprofile v0.117.0 // indirect
102+
go.opentelemetry.io/collector/semconv v0.117.0 // indirect
103+
go.opentelemetry.io/otel v1.34.0 // indirect
104+
go.opentelemetry.io/otel/metric v1.34.0 // indirect
105+
go.opentelemetry.io/otel/trace v1.34.0 // indirect
106+
go.uber.org/atomic v1.11.0 // indirect
107+
go.uber.org/multierr v1.11.0 // indirect
108+
go.uber.org/zap v1.27.0 // indirect
109+
golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 // indirect
110+
golang.org/x/mod v0.22.0 // indirect
111+
golang.org/x/sync v0.10.0 // indirect
112+
golang.org/x/sys v0.29.0 // indirect
113+
golang.org/x/time v0.9.0 // indirect
114+
golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect
115+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect
116+
google.golang.org/grpc v1.69.4 // indirect
117+
google.golang.org/protobuf v1.36.3 // indirect
80118
gopkg.in/ini.v1 v1.67.0 // indirect
119+
gopkg.in/yaml.v2 v2.4.0 // indirect
81120
gopkg.in/yaml.v3 v3.0.1 // indirect
82-
inet.af/netaddr v0.0.0-20220811202034-502d2d690317 // indirect
83121
)
84122

85123
require (
86-
github.com/gorilla/mux v1.8.0 // indirect
87-
github.com/nicksnyder/go-i18n/v2 v2.2.1
88-
github.com/swaggo/http-swagger v1.3.3
124+
github.com/gorilla/mux v1.8.1 // indirect
125+
github.com/nicksnyder/go-i18n/v2 v2.4.1
126+
github.com/swaggo/http-swagger v1.3.4
89127
github.com/urfave/negroni v1.0.0
90-
golang.org/x/crypto v0.7.0 // indirect
91-
golang.org/x/net v0.8.0 // indirect
92-
golang.org/x/text v0.8.0
93-
golang.org/x/tools v0.6.0 // indirect
94-
gopkg.in/DataDog/dd-trace-go.v1 v1.47.0
128+
golang.org/x/crypto v0.32.0 // indirect
129+
golang.org/x/net v0.34.0 // indirect
130+
golang.org/x/text v0.21.0
131+
golang.org/x/tools v0.29.0 // indirect
132+
gopkg.in/DataDog/dd-trace-go.v1 v1.70.3
95133
)

0 commit comments

Comments
 (0)