-
Notifications
You must be signed in to change notification settings - Fork 32
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
52 changed files
with
160 additions
and
41,040 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# This workflow will build a golang project | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | ||
|
||
name: Go | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
||
build_ubuntu: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: ./api | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.20' | ||
cache-dependency-path: "**/go.sum" | ||
|
||
- name: Setup | ||
run: make setup | ||
|
||
- name: Check | ||
run: make check | ||
|
||
- name: Build | ||
run: make build | ||
|
||
build_windows: | ||
runs-on: windows-latest | ||
defaults: | ||
run: | ||
working-directory: .\api | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.20' | ||
cache-dependency-path: "**\\go.sum" | ||
|
||
- name: Check & Build | ||
run: .\build.bat |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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,27 @@ | ||
|
||
EXEC_NAME?=go-api | ||
DOCKER_RUNNER?=docker | ||
REGISTRY?=localhost:5000 | ||
RELEASE_TAG=$(shell git rev-parse --short HEAD) | ||
BASE_TAG=$(REGISTRY)/utdnebula/api/go-api | ||
|
||
setup: | ||
go install honnef.co/go/tools/cmd/staticcheck@latest | ||
go install golang.org/x/tools/cmd/goimports@latest | ||
|
||
check: | ||
go mod tidy | ||
go vet ./... | ||
staticcheck ./... | ||
gofmt -w ./.. | ||
goimports -w ./.. | ||
|
||
build: server.go | ||
go build -o $(EXEC_NAME) server.go | ||
|
||
clean: $(EXEC_NAME) | ||
rm $(EXEC_NAME) | ||
|
||
docker: Dockerfile configs/ controllers/ models/ responses/ routes/ server.go | ||
$(DOCKER_RUNNER) build -t $(BASE_TAG):$(RELEASE_TAG) . | ||
$(DOCKER_RUNNER) tag $(BASE_TAG):$(RELEASE_TAG) $(BASE_TAG):latest |
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,29 @@ | ||
@echo off | ||
|
||
::vars | ||
set EXEC_NAME=go-api.exe | ||
|
||
::setup | ||
echo Performing setup... | ||
go install honnef.co/go/tools/cmd/staticcheck@latest && ^ | ||
go install golang.org/x/tools/cmd/goimports@latest | ||
if ERRORLEVEL 1 exit /b %ERRORLEVEL% :: fail if error occurred | ||
echo Setup done! | ||
echo[ | ||
|
||
::checks | ||
echo Performing checks... | ||
go mod tidy && ^ | ||
go vet ./... && ^ | ||
staticcheck ./... && ^ | ||
gofmt -w ./.. && ^ | ||
goimports -w ./.. | ||
if ERRORLEVEL 1 exit /b %ERRORLEVEL% :: fail if error occurred | ||
echo Checks done! | ||
echo[ | ||
|
||
::build | ||
echo Building... | ||
go build -o %EXEC_NAME% server.go | ||
if ERRORLEVEL 1 exit /b %ERRORLEVEL% :: fail if error occurred | ||
echo Build complete! |
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.