Skip to content

Commit

Permalink
refactor code according to clean architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
The-Gleb committed Mar 3, 2024
1 parent 65d68bf commit d39a4c4
Show file tree
Hide file tree
Showing 40 changed files with 2,409 additions and 992 deletions.
45 changes: 15 additions & 30 deletions .github/workflows/mertricstest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,7 @@ jobs:
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15'
github.head_ref == 'iter14'
run: |
metricstest -test.v -test.run=^TestIteration1$ \
-binary-path=cmd/server/server
Expand All @@ -104,8 +103,7 @@ jobs:
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15'
github.head_ref == 'iter14'
run: |
metricstest -test.v -test.run=^TestIteration2[AB]*$ \
-source-path=. \
Expand All @@ -125,8 +123,7 @@ jobs:
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15'
github.head_ref == 'iter14'
run: |
metricstest -test.v -test.run=^TestIteration3[AB]*$ \
-source-path=. \
Expand All @@ -146,8 +143,7 @@ jobs:
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15'
github.head_ref == 'iter14'
run: |
SERVER_PORT=$(random unused-port)
ADDRESS="localhost:${SERVER_PORT}"
Expand All @@ -170,8 +166,7 @@ jobs:
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15'
github.head_ref == 'iter14'
run: |
SERVER_PORT=$(random unused-port)
ADDRESS="localhost:${SERVER_PORT}"
Expand All @@ -193,8 +188,7 @@ jobs:
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15'
github.head_ref == 'iter14'
run: |
SERVER_PORT=$(random unused-port)
ADDRESS="localhost:${SERVER_PORT}"
Expand All @@ -215,8 +209,7 @@ jobs:
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15'
github.head_ref == 'iter14'
run: |
SERVER_PORT=$(random unused-port)
ADDRESS="localhost:${SERVER_PORT}"
Expand All @@ -236,8 +229,7 @@ jobs:
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15'
github.head_ref == 'iter14'
run: |
SERVER_PORT=$(random unused-port)
ADDRESS="localhost:${SERVER_PORT}"
Expand All @@ -256,8 +248,7 @@ jobs:
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15'
github.head_ref == 'iter14'
run: |
SERVER_PORT=$(random unused-port)
ADDRESS="localhost:${SERVER_PORT}"
Expand All @@ -276,8 +267,7 @@ jobs:
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15'
github.head_ref == 'iter14'
run: |
SERVER_PORT=$(random unused-port)
ADDRESS="localhost:${SERVER_PORT}"
Expand All @@ -295,8 +285,7 @@ jobs:
github.head_ref == 'iter11' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15'
github.head_ref == 'iter14'
run: |
SERVER_PORT=$(random unused-port)
ADDRESS="localhost:${SERVER_PORT}"
Expand All @@ -313,8 +302,7 @@ jobs:
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter12' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15'
github.head_ref == 'iter14'
run: |
SERVER_PORT=$(random unused-port)
ADDRESS="localhost:${SERVER_PORT}"
Expand All @@ -330,8 +318,7 @@ jobs:
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter13' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15'
github.head_ref == 'iter14'
run: |
SERVER_PORT=$(random unused-port)
ADDRESS="localhost:${SERVER_PORT}"
Expand All @@ -346,8 +333,7 @@ jobs:
- name: "Code increment #14"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15'
github.head_ref == 'iter14'
run: |
SERVER_PORT=$(random unused-port)
ADDRESS="localhost:${SERVER_PORT}"
Expand All @@ -363,7 +349,6 @@ jobs:
- name: "Code increment #14 (race detection)"
if: |
github.ref == 'refs/heads/main' ||
github.head_ref == 'iter14' ||
github.head_ref == 'iter15'
github.head_ref == 'iter14'
run: |
go test -v -race ./...
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
postgres:
docker run --name metric_db -e POSTGRES_USER=metric_db -e POSTGRES_PASSWORD=metric_db -p 5434:5432 -d postgres:alpine
postgresrm:
docker stop metric_db
docker rm metric_db

migrateup:
migrate -path internal/adapter/db/postgres/migration -database "postgres://metric_db:metric_db@localhost:5434/metric_db?sslmode=disable" -verbose up

migratedown:
migrate -path internal/adapter/db/postgres/migration -database "postgres://metric_db:metric_db@localhost:5434/metric_db?sslmode=disable" -verbose down
postgres:
docker run --name metric_db -e POSTGRES_USER=metric_db -e POSTGRES_PASSWORD=metric_db -p 5434:5432 -d postgres:alpine
postgresrm:
docker stop metric_db
docker rm metric_db

migrateup:
migrate -path internal/adapter/db/postgres/migration -database "postgres://metric_db:metric_db@localhost:5434/metric_db?sslmode=disable" -verbose up

migratedown:
migrate -path internal/adapter/db/postgres/migration -database "postgres://metric_db:metric_db@localhost:5434/metric_db?sslmode=disable" -verbose down
.PHONY: postgres postgresrm migrateup migratedown
Loading

0 comments on commit d39a4c4

Please sign in to comment.