-
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 #5 from isd-sgcu/dev
update main
- Loading branch information
Showing
31 changed files
with
1,779 additions
and
0 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,51 @@ | ||
root = "." | ||
testdata_dir = "testdata" | ||
tmp_dir = "tmp" | ||
|
||
[build] | ||
args_bin = [] | ||
bin = "./tmp/main" | ||
cmd = "go build -o ./tmp/main ./cmd/main.go" | ||
delay = 1000 | ||
exclude_dir = ["assets", "tmp", "vendor", "testdata"] | ||
exclude_file = [] | ||
exclude_regex = ["_test.go"] | ||
exclude_unchanged = false | ||
follow_symlink = false | ||
full_bin = "" | ||
include_dir = [] | ||
include_ext = ["go", "tpl", "tmpl", "html"] | ||
include_file = [] | ||
kill_delay = "0s" | ||
log = "build-errors.log" | ||
poll = false | ||
poll_interval = 0 | ||
post_cmd = [] | ||
pre_cmd = [] | ||
rerun = false | ||
rerun_delay = 500 | ||
send_interrupt = false | ||
stop_on_error = false | ||
|
||
[color] | ||
app = "" | ||
build = "yellow" | ||
main = "magenta" | ||
runner = "green" | ||
watcher = "cyan" | ||
|
||
[log] | ||
main_only = false | ||
time = false | ||
|
||
[misc] | ||
clean_on_exit = false | ||
|
||
[proxy] | ||
app_port = 0 | ||
enabled = false | ||
proxy_port = 0 | ||
|
||
[screen] | ||
clear_on_rebuild = false | ||
keep_scroll = true |
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,9 @@ | ||
APP_PORT=3005 | ||
APP_ENV=development | ||
APP_MAX_FILE_SIZE_MB= | ||
|
||
STORE_ENDPOINT= | ||
STORE_ACCESS_KEY= | ||
STORE_SECRET_KEY= | ||
STORE_USE_SSL= | ||
STORE_BUCKET_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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
## Change made | ||
|
||
- [ ] New features | ||
- [ ] Bug fixes | ||
- [ ] Breaking changes | ||
- [ ] Refactor | ||
## Describe what you have done | ||
- | ||
### New Features | ||
- | ||
### Fix | ||
- | ||
### Others | ||
- |
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,93 @@ | ||
name: Build | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
types: | ||
- closed | ||
branches: | ||
- main | ||
- dev | ||
|
||
env: | ||
SERVICE_NAME: rpkm67-store | ||
IMAGE_NAME: ghcr.io/${{ github.repository }} | ||
IMAGE_TAG: <WILL_BE_SET> | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' | ||
outputs: | ||
IMAGE_TAG: ${{ steps.tag_action.outputs.new_tag }} | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: '0' | ||
|
||
- name: Bump version and push tag | ||
uses: anothrNick/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
WITH_V: true | ||
RELEASE_BRANCHES: dev | ||
DEFAULT_BUMP: patch | ||
id: tag_action | ||
|
||
- name: Set IMAGE_TAG | ||
run: echo "IMAGE_TAG=${{ steps.tag_action.outputs.new_tag }}" >> $GITHUB_ENV | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log in to the Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ github.token }} | ||
|
||
- name: Build and Push Docker Image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
push: true | ||
tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }},${{ env.IMAGE_NAME }}:latest | ||
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache | ||
cache-to: type=registry,ref=${{ env.IMAGE_NAME }}:buildcache,mode=max | ||
|
||
cd: | ||
name: Continuous Deployment | ||
needs: build | ||
runs-on: ubuntu-latest | ||
env: | ||
IMAGE_TAG: ${{ needs.build.outputs.IMAGE_TAG }} | ||
|
||
steps: | ||
- name: Checkout DevOps repository | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: isd-sgcu/rpkm67-devops | ||
token: ${{ secrets.RPKM67_DEVOPS_TOKEN }} | ||
|
||
- name: Update image tag in dev | ||
uses: mikefarah/yq@master | ||
with: | ||
cmd: yq -i '.[0].value = "${{ env.IMAGE_NAME }}:" + strenv(IMAGE_TAG)' isd/${{ env.SERVICE_NAME }}/deployment.yaml | ||
|
||
- name: Update image tag in prod | ||
uses: mikefarah/yq@master | ||
if: github.ref == 'refs/heads/main' | ||
with: | ||
cmd: yq -i '.[0].value = "${{ env.IMAGE_NAME }}:" + strenv(IMAGE_TAG)' prod/${{ env.SERVICE_NAME }}/deployment.yaml | ||
|
||
- name: Commit & Push changes | ||
uses: actions-js/[email protected] | ||
with: | ||
repository: isd-sgcu/rpkm67-devops | ||
github_token: ${{ secrets.RPKM67_DEVOPS_TOKEN }} |
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,36 @@ | ||
name: Lint | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- main | ||
- dev | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
tags: | ||
- v* | ||
|
||
permissions: | ||
contents: read | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
golangci: | ||
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.22.4' | ||
cache: false | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: v1.55 |
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: Unit Tests | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- main | ||
- dev | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.22 | ||
|
||
- name: Download dependencies | ||
run: go mod download | ||
|
||
- name: Vet | ||
run: | | ||
go vet ./... | ||
- name: Test | ||
run: | | ||
go test -v -coverpkg ./internal/... -coverprofile coverage.out -covermode count ./internal/... | ||
go tool cover -func="./coverage.out" |
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,35 @@ | ||
### Go template | ||
# Binaries for programs and plugins | ||
*.exe | ||
*.exe~ | ||
*.dll | ||
*.so | ||
*.dylib | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
# Output of the go coverage tool, specifically when used with LiteIDE | ||
*.out | ||
|
||
# Dependency directories (remove the comment below to include it) | ||
# vendor/ | ||
|
||
# config file | ||
config.yaml | ||
.env | ||
.env.prod | ||
|
||
# idea | ||
.idea | ||
|
||
# volumes | ||
volumes | ||
|
||
# coverage report | ||
coverage.out | ||
coverage.html | ||
|
||
tmp | ||
staff.json | ||
docker-compose.qa.yml |
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,22 @@ | ||
FROM golang:1.22.4-alpine3.20 as builder | ||
WORKDIR /app | ||
|
||
COPY go.mod go.sum ./ | ||
|
||
RUN go mod download | ||
|
||
COPY . . | ||
|
||
RUN go build -o server ./cmd/main.go | ||
|
||
|
||
FROM alpine AS runner | ||
WORKDIR /app | ||
|
||
COPY --from=builder /app/server ./ | ||
|
||
ENV GO_ENV production | ||
|
||
EXPOSE 3000 | ||
|
||
CMD ["./server"] |
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,46 @@ | ||
pull-latest-mac: | ||
docker pull --platform linux/x86_64 ghcr.io/isd-sgcu/rpkm67-gateway:latest | ||
docker pull --platform linux/x86_64 ghcr.io/isd-sgcu/rpkm67-auth:latest | ||
docker pull --platform linux/x86_64 ghcr.io/isd-sgcu/rpkm67-backend:latest | ||
docker pull --platform linux/x86_64 ghcr.io/isd-sgcu/rpkm67-checkin:latest | ||
docker pull --platform linux/x86_64 ghcr.io/isd-sgcu/rpkm67-store:latest | ||
|
||
pull-latest-windows: | ||
docker pull ghcr.io/isd-sgcu/rpkm67-gateway:latest | ||
docker pull ghcr.io/isd-sgcu/rpkm67-auth:latest | ||
docker pull ghcr.io/isd-sgcu/rpkm67-backend:latest | ||
docker pull ghcr.io/isd-sgcu/rpkm67-checkin:latest | ||
docker pull ghcr.io/isd-sgcu/rpkm67-store:latest | ||
|
||
docker: | ||
docker rm -v -f $$(docker ps -qa) || echo "No containers found. Skipping removal." | ||
docker-compose up | ||
|
||
docker-qa: | ||
docker rm -v -f $$(docker ps -qa) || echo "No containers found. Skipping removal." | ||
docker-compose -f docker-compose.qa.yml up | ||
|
||
server: | ||
go run cmd/main.go | ||
|
||
watch: | ||
air | ||
|
||
mock-gen: | ||
mockgen -source ./internal/object/object.repository.go -destination ./mocks/object/object.repository.go | ||
mockgen -source ./internal/object/object.service.go -destination ./mocks/object/object.service.go | ||
mockgen -source ./internal/client/http/http.client.go -destination ./mocks/client/http/http.client.go | ||
mockgen -source ./internal/client/store/store.client.go -destination ./mocks/client/store/store.client.go | ||
mockgen -source ./internal/utils/random.utils.go -destination ./mocks/utils/random/random.utils.go | ||
|
||
test: | ||
go vet ./... | ||
go test -v -coverpkg ./internal/... -coverprofile coverage.out -covermode count ./internal/... | ||
go tool cover -func=coverage.out | ||
go tool cover -html=coverage.out -o coverage.html | ||
|
||
proto: | ||
go get github.com/isd-sgcu/rpkm67-go-proto@latest | ||
|
||
swagger: | ||
swag init -d ./internal/file -g ../../cmd/main.go -o ./docs -md ./docs/markdown --parseDependency --parseInternal |
Oops, something went wrong.