-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added the changes and github workflow
Signed-off-by: Dariksha <[email protected]>
- Loading branch information
1 parent
32b77a4
commit f7e3cc3
Showing
2 changed files
with
34 additions
and
4 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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: CI | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: '1.16' | ||
|
||
- name: Install dependencies | ||
run: go mod tidy | ||
|
||
- name: Check and update Swagger docs | ||
run: make docs |
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 |
---|---|---|
|
@@ -54,19 +54,29 @@ docs: check_docs # Generate swagger docs | |
|
||
.PHONY: check_docs | ||
check_docs: | ||
@server_mod_time=$$(stat -c %Y internal/server/server.go); \ | ||
swagger_mod_time=$$(stat -c %Y docs/swagger.json); \ | ||
if [ $$server_mod_time -gt $$swagger_mod_time ]; then \ | ||
@echo "Checking if Swagger documentation needs to be updated..." | ||
@temp_dir=$$(mktemp -d); \ | ||
mkdir -p $$temp_dir/docs; \ | ||
go install github.com/swaggo/swag/cmd/[email protected]; \ | ||
swag init -o $$temp_dir/docs -d internal/server -g server.go -pd > /dev/null 2>&1; \ | ||
if [ ! -f docs/swagger.json ]; then \ | ||
echo "Swagger documentation needs to be generated"; \ | ||
make update_docs; \ | ||
elif ! diff -q $$temp_dir/docs/swagger.json docs/swagger.json > /dev/null; then \ | ||
echo "Swagger documentation needs to be updated"; \ | ||
make update_docs; \ | ||
else \ | ||
echo "Swagger documentation is up to date"; \ | ||
fi | ||
fi; \ | ||
rm -rf $$temp_dir | ||
|
||
.PHONY: update_docs | ||
update_docs: | ||
@echo "Updating Swagger documentation..." | ||
@go install github.com/swaggo/swag/cmd/[email protected] | ||
@swag init -o docs -d internal/server -g server.go -pd | ||
@echo "Swagger documentation updated" | ||
|
||
|
||
|
||
.PHONY: db-migrations | ||
|