Skip to content
This repository was archived by the owner on Jun 2, 2023. It is now read-only.

Commit 8b5496b

Browse files
committed
make a monorepo
1 parent 65bbf8f commit 8b5496b

File tree

253 files changed

+6640
-559
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

253 files changed

+6640
-559
lines changed

.circleci/config.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ jobs:
77
- image: circleci/postgres:9.4
88
environment:
99
POSTGRES_USER: postgres
10-
POSTGRES_DB: api_prod
10+
POSTGRES_DB: api_test
1111

1212
working_directory: /go/src/github.com/golangci/golangci-api
1313
steps:
1414
- checkout
1515
- run: GO111MODULE=on go mod vendor
1616
- run: go get github.com/golangci/golangci-lint/cmd/golangci-lint
1717
- run: echo 'REDIS_URL="redis://localhost:6379"' >.env
18-
- run: echo 'DATABASE_URL="postgresql://postgres:test@localhost:5432/api_prod?sslmode=disable"' >.env.test
18+
- run: echo 'WEB_ROOT="https://golangci.com"' >>.env
19+
- run: echo 'DATABASE_URL="postgresql://postgres:test@localhost:5432/api_test?sslmode=disable"' >.env.test
1920
- run:
2021
name: install dockerize
2122
command: wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz && rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz

Makefile

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
.PHONY: test
22

3-
build:
4-
go build -v ./app/cmd/...
5-
63
gen: gen_services
74
go generate ./...
85

@@ -16,16 +13,39 @@ prepare_env:
1613
awslocal sqs create-queue --queue-name primary
1714
awslocal sqs list-queues
1815

19-
run_dev:
16+
run_api:
2017
godotenv go run cmd/golangci-api/main.go
2118

19+
run_worker:
20+
godotenv go run cmd/golangci-worker/main.go
21+
2222
migrate_force_version:
2323
godotenv -f .env.test sh -c 'migrate -database $${DATABASE_URL} -path ./migrations force $${V}'
2424

25-
test:
25+
test_api:
2626
go test -v -parallel 1 -p 1 ./test/
27+
28+
test_lint:
2729
golangci-lint run -v
2830

31+
test_lint_dev:
32+
go run ../golangci-lint/cmd/golangci-lint/main.go run -v
33+
34+
test_api_dev:
35+
echo "DROP DATABASE api_test;" | docker-compose exec -T pg psql -U postgres
36+
echo "CREATE DATABASE api_test;" | docker-compose exec -T pg psql -U postgres
37+
make test_api
38+
39+
test_worker:
40+
go test -v -parallel 1 -p 1 ./pkg/worker/...
41+
42+
test_worker_dev:
43+
echo "FLUSHALL" | docker-compose exec -T redis redis-cli
44+
make test_worker
45+
46+
test: test_api test_worker test_lint
47+
test_dev: test_api_dev test_worker_dev test_lint_dev
48+
2949
connect_to_local_db:
3050
dc exec pg psql -U postgres -d api_prod
3151

@@ -38,3 +58,15 @@ deploy_lambda: build_lambda
3858

3959
deploy_cloudformation:
4060
aws cloudformation deploy --template ./deployments/cloudformation.yml --region us-east-1 --capabilities CAPABILITY_IAM CAPABILITY_NAMED_IAM --stack-name golangci
61+
62+
worker_test_repo:
63+
# set env vars PR, REPO
64+
SLOW_TESTS_ENABLED=1 go test -v ./analyze -run TestAnalyzeRepo
65+
66+
worker_test_repo_fake_github:
67+
# set env vars PR, REPO
68+
SLOW_TESTS_ENABLED=1 go test -v ./analyze/processors -count=1 -run TestProcessRepoWithFakeGithub
69+
70+
mod_update:
71+
GO111MODULE=on go mod verify
72+
GO111MODULE=on go mod tidy

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
web: golangci-api
2+
worker: golangci-worker

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ PORT=3000
3434

3535
Tests need `.env.test` file, overriding options from `.env`. There can be something like this:
3636
```
37-
DATABASE_URL="postgresql://postgres:test@localhost:5432/api_prod?sslmode=disable"
37+
DATABASE_URL="postgresql://postgres:test@localhost:5432/api_test?sslmode=disable"
3838
DATABASE_DEBUG=1
3939
```
4040

4141
### How to run tests
4242
```
43-
echo "CREATE DATABASE api_prod;" | docker-compose exec -T pg psql -U postgres
43+
echo "CREATE DATABASE api_test;" | docker-compose exec -T pg psql -U postgres
4444
make test
4545
```
4646

cmd/buildrunner/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ package main
33
import (
44
"time"
55

6-
"github.com/golangci/golangci-api/pkg/app/buildagent/build"
7-
"github.com/golangci/golangci-shared/pkg/config"
8-
"github.com/golangci/golangci-shared/pkg/logutil"
6+
"github.com/golangci/golangci-api/internal/shared/config"
7+
"github.com/golangci/golangci-api/internal/shared/logutil"
8+
"github.com/golangci/golangci-api/pkg/buildagent/build"
99
)
1010

1111
func main() {

cmd/containers_orchestrator/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package main
22

33
import (
4-
"github.com/golangci/golangci-api/pkg/app/buildagent/containers"
5-
"github.com/golangci/golangci-shared/pkg/config"
6-
"github.com/golangci/golangci-shared/pkg/logutil"
4+
"github.com/golangci/golangci-api/internal/shared/config"
5+
"github.com/golangci/golangci-api/internal/shared/logutil"
6+
"github.com/golangci/golangci-api/pkg/buildagent/containers"
77
)
88

99
func main() {

cmd/ensuredeps/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import (
77
"log"
88
"os"
99

10-
"github.com/golangci/golangci-api/pkg/goenv/command"
11-
"github.com/golangci/golangci-api/pkg/goenv/result"
12-
"github.com/golangci/golangci-shared/pkg/logutil"
10+
"github.com/golangci/golangci-api/internal/shared/logutil"
11+
"github.com/golangci/golangci-api/pkg/goenvbuild/command"
12+
"github.com/golangci/golangci-api/pkg/goenvbuild/result"
1313

14-
"github.com/golangci/golangci-api/pkg/goenv/ensuredeps"
14+
"github.com/golangci/golangci-api/pkg/goenvbuild/ensuredeps"
1515
)
1616

1717
func main() {

cmd/genservices/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func encode{{.Name}}Response(ctx context.Context, w http.ResponseWriter, respons
160160
`
161161

162162
func main() {
163-
root := flag.String("root", "pkg/app/services", "root of services")
163+
root := flag.String("root", "pkg/api/services", "root of services")
164164
flag.Parse()
165165

166166
if err := generate(*root); err != nil {

cmd/getrepoinfo/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import (
66
"log"
77
"os"
88

9-
"github.com/golangci/golangci-shared/pkg/logutil"
9+
"github.com/golangci/golangci-api/internal/shared/logutil"
1010

11-
"github.com/golangci/golangci-api/pkg/goenv/repoinfo"
11+
"github.com/golangci/golangci-api/pkg/goenvbuild/repoinfo"
1212
"github.com/pkg/errors"
1313
)
1414

cmd/goenvbuild/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package main
22

33
import (
4-
"github.com/golangci/golangci-api/pkg/goenv"
5-
"github.com/golangci/golangci-shared/pkg/config"
6-
"github.com/golangci/golangci-shared/pkg/logutil"
4+
"github.com/golangci/golangci-api/internal/shared/config"
5+
"github.com/golangci/golangci-api/internal/shared/logutil"
6+
"github.com/golangci/golangci-api/pkg/goenvbuild"
77
)
88

99
func main() {

0 commit comments

Comments
 (0)