-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
47 additions
and
495 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,46 +5,25 @@ help: | |
@echo "Usage: make [target]" | ||
@echo "" | ||
@echo "Targets:" | ||
@echo " build - Build the application" | ||
@echo " clear-db - Clear the database" | ||
@echo " setup-db - Setup the database" | ||
@echo " build - Build the application, swagger document will be generated" | ||
@echo " check - Run go vet" | ||
@echo " test - Run tests" | ||
|
||
.PHONY: get-front | ||
get-front: | ||
./scripts/update-frontend-dist.sh artifacts/oj-lab-front/dist | ||
|
||
.PHONY: install-tools | ||
install-tools: | ||
go install github.com/swaggo/swag/cmd/swag@latest | ||
@# Referencing https://grpc.io/docs/protoc-installation/ | ||
@./scripts/install-protoc.sh | ||
@# Track https://grpc.io/docs/languages/go/quickstart/ for update | ||
go install google.golang.org/protobuf/cmd/[email protected] | ||
go install google.golang.org/grpc/cmd/[email protected] | ||
|
||
.PHONY: gen-proto | ||
gen-proto: install-tools | ||
protoc --go_out=. --go_opt=paths=source_relative \ | ||
--go-grpc_out=. --go-grpc_opt=paths=source_relative \ | ||
src/service/proto/*.proto | ||
|
||
.PHONY: gen-swagger | ||
gen-swagger: install-tools | ||
swag fmt -d src/application/server | ||
swag init -d src/application/server,src/service/model -ot go -o src/application/server/swaggo-gen | ||
|
||
@echo " test - Run tests, database will be setup" | ||
@echo " run - Run the application" | ||
@echo " setup-db - Setup the database" | ||
@echo " clear-db - Clear the database" | ||
|
||
.PHONY: build | ||
build: gen-proto gen-swagger | ||
build: gen-swagger | ||
@echo "Building on $(OS)" | ||
go mod tidy | ||
go build -o artifacts/bin/migrate_db src/application/migrate_db/main.go | ||
go build -o artifacts/bin/service src/application/server/main.go | ||
go build -o artifacts/bin/asynq_worker src/application/asynq_worker/main.go | ||
go build -o artifacts/bin/rpc_server src/application/rpc_server/main.go | ||
go build -o artifacts/bin/schedule src/application/schedule/main.go | ||
|
||
.PHONY: build-image | ||
build-image: | ||
docker build -f docker/oj-lab-platform.dockerfile -t oj-lab-platform:latest . | ||
|
||
.PHONY: clear-db | ||
clear-db: | ||
docker-compose -f environment/docker-compose.yml -p oj-lab-platform stop | ||
|
@@ -57,6 +36,11 @@ setup-db: clear-db build | |
sleep 10s | ||
./artifacts/bin/migrate_db | ||
|
||
.PHONY: gen-swagger | ||
gen-swagger: install-swaggo | ||
swag fmt -d src/application/server | ||
swag init -d src/application/server,src/service/model -ot go -o src/application/server/swaggo-gen | ||
|
||
.PHONY: check | ||
check: gen-proto | ||
go vet ./... | ||
|
@@ -65,10 +49,6 @@ check: gen-proto | |
test: gen-swagger check setup-db | ||
go test -cover -v ./... | ||
|
||
.PHONY: run-task-worker | ||
run-task-worker: build check | ||
./artifacts/bin/asynq_worker | ||
|
||
.PHONY: run-schedule | ||
run-schedule: build check | ||
./artifacts/bin/schedule | ||
|
@@ -77,18 +57,31 @@ run-schedule: build check | |
run-server: build check | ||
./artifacts/bin/service | ||
|
||
.PHONY: run-rpc-server | ||
run-rpc-server: build check | ||
./artifacts/bin/rpc_server | ||
.PHONY: run | ||
run: build check | ||
make -j run-server run-schedule | ||
|
||
.PHONY: get-front | ||
get-front: | ||
./scripts/update-frontend-dist.sh artifacts/oj-lab-front/dist | ||
|
||
.PHONY: install-swaggo | ||
install-swaggo: | ||
go install github.com/swaggo/swag/cmd/swag@latest | ||
|
||
.PHONY: run-background | ||
run-background: build check | ||
make -j run-schedule | ||
|
||
.PHONY: run-all | ||
run-all: build check | ||
make -j run-server run-schedule | ||
# Deprecated | ||
.PHONY: gen-proto | ||
gen-proto: install-proto | ||
protoc --go_out=. --go_opt=paths=source_relative \ | ||
--go-grpc_out=. --go-grpc_opt=paths=source_relative \ | ||
src/service/proto/*.proto | ||
|
||
.PHONY: build-docker | ||
build-docker: | ||
docker build -f docker/oj-lab-platform.dockerfile -t oj-lab-platform:latest . | ||
# Deprecated | ||
.PHONY: install-proto | ||
install-proto: | ||
@# Referencing https://grpc.io/docs/protoc-installation/ | ||
@./scripts/install-protoc.sh | ||
@# Track https://grpc.io/docs/languages/go/quickstart/ for update | ||
go install google.golang.org/protobuf/cmd/[email protected] | ||
go install google.golang.org/grpc/cmd/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
// Deprecated currently | ||
// Keep it for future use | ||
package main | ||
|
||
import ( | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.