-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #141 from Tibz-Dankan/refactor/dir-structure
Refactor/dir structure
- Loading branch information
Showing
23 changed files
with
924 additions
and
78 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
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,37 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
APPCRONS_STAG_DSN: ${{ secrets.APPCRONS_STAG_DSN }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: "1.23" | ||
|
||
- name: Install dependencies | ||
run: make install | ||
|
||
- name: Run tests | ||
run: make stage # Runs tests in the staging environment | ||
|
||
- name: Trigger deployment | ||
if: success() | ||
run: | | ||
curl -X POST \ | ||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
https://api.github.com/repos/${{ github.repository }}/actions/workflows/deploy-to-render.com.yml/dispatches \ | ||
-d '{"ref": "${{ github.ref_name }}"}' |
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,63 +1,28 @@ | ||
# Variables | ||
APP_NAME := Appcrons | ||
CMD_DIR := ./cmd | ||
BIN_DIR := ./bin | ||
TEST_DIR := ./test | ||
TEST_DIR := ./tests | ||
|
||
# Ensure bin directory exists | ||
$(BIN_DIR): | ||
@mkdir -p $(BIN_DIR) | ||
|
||
# Default target | ||
.PHONY: all | ||
all: install run | ||
|
||
# Run the development server | ||
# Runs the development server | ||
.PHONY: run | ||
run: | ||
@echo "Starting development server..." | ||
@go run $(CMD_DIR) | ||
@GO_ENV=development go run $(CMD_DIR) | ||
|
||
# Run tests | ||
# Runs tests in the development environment | ||
.PHONY: test | ||
test: | ||
@echo "Running tests..." | ||
@go test $(TEST_DIR) -v | ||
@echo "Running tests with GO_ENV=testing..." | ||
@GO_ENV=testing go test -v $(TEST_DIR)/... | ||
|
||
# Install dependencies | ||
# Runs tests in the staging environment | ||
.PHONY: stage | ||
stage: | ||
@echo "Running tests with GO_ENV=staging..." | ||
@GO_ENV=staging go test -v $(TEST_DIR)/... | ||
|
||
# Installs the packages | ||
.PHONY: install | ||
install: | ||
@echo "Installing dependencies..." | ||
@go mod tidy | ||
@go mod download | ||
|
||
# Clean up | ||
.PHONY: clean | ||
clean: | ||
@echo "Cleaning up..." | ||
@go clean | ||
@rm -rf $(BIN_DIR) | ||
|
||
# Format code | ||
.PHONY: fmt | ||
fmt: | ||
@echo "Formatting code..." | ||
@go fmt $(CMD_DIR) $(TEST_DIR) | ||
|
||
# Build the application | ||
.PHONY: build | ||
build: $(BIN_DIR) | ||
@echo "Building application..." | ||
@go build -o $(BIN_DIR)/$(APP_NAME) $(CMD_DIR) | ||
|
||
# Run application in the background | ||
.PHONY: start | ||
start: $(BIN_DIR) | ||
@echo "Starting application in the background..." | ||
@nohup $(BIN_DIR)/$(APP_NAME) & | ||
|
||
# Stop the application | ||
.PHONY: stop | ||
stop: | ||
@echo "Stopping application..." | ||
@pkill -f "$(BIN_DIR)/$(APP_NAME)" |
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 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 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 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
Oops, something went wrong.