-
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 #16 from isd-sgcu/dev
Update main
- Loading branch information
Showing
27 changed files
with
1,507 additions
and
76 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,54 @@ | ||
name: Build | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
- beta | ||
- dev | ||
- master | ||
|
||
env: | ||
IMAGE_NAME: ghcr.io/${{ github.repository }} | ||
IMAGE_TAG: ${{ github.sha }} | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
|
||
outputs: | ||
BRANCH: ${{ steps.branch.outputs.BRANCH }} | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Set branch | ||
id: branch | ||
run: | | ||
echo "::set-output name=BRANCH::${GITHUB_REF#refs/heads/}" | ||
- name: Log in to the Container Registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and Push Docker Image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
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 |
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,38 @@ | ||
name: 'Pull request/Push: Run unit test' | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- dev | ||
- master | ||
- main | ||
- beta | ||
push: | ||
branches: | ||
- dev | ||
- master | ||
- main | ||
- beta | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.21 | ||
|
||
- name: Download dependencies | ||
run: go mod download | ||
|
||
- name: Vet | ||
run: | | ||
go vet ./... | ||
- name: Test | ||
run: | | ||
go test -v -coverpkg ./src/app/... -coverprofile coverage.out -covermode count ./src/app/... | ||
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 @@ | ||
name: 'Pull request/Push: Build test' | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- dev | ||
- master | ||
- main | ||
- beta | ||
push: | ||
branches: | ||
- dev | ||
- master | ||
- main | ||
- beta | ||
|
||
jobs: | ||
docker-build: | ||
name: 'Docker build and create an image' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
- name: Build Docker image | ||
id: docker_build | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: false | ||
tags: test |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,43 @@ | ||
# johnjud-backend | ||
# Johnjud-backend | ||
|
||
Johnjud-backend handles data management and business logic for the Johnjud project. | ||
|
||
### What is Johnjud? | ||
Johnjud is a pet adoption web application of the [CUVET For Animal Welfare Club](https://www.facebook.com/CUVETforAnimalWelfareClub) | ||
|
||
## Stack | ||
|
||
- golang | ||
- gRPC | ||
- postgresql | ||
|
||
## Getting Started | ||
|
||
### Prerequisites | ||
|
||
- golang 1.21 or [later](https://go.dev) | ||
- docker | ||
- makefile | ||
|
||
### Installation | ||
|
||
1. Clone this repo | ||
2. Copy every `config.example.yaml` in `config` and paste it in the same directory with `.example` removed from its name. | ||
|
||
3. Run `go mod download` to download all the dependencies. | ||
|
||
### Running | ||
1. Run `docker-compose up -d` | ||
2. Run `make server` or `go run ./src/.` | ||
|
||
### Testing | ||
1. Run `make test` or `go test -v -coverpkg ./... -coverprofile coverage.out -covermode count ./...` | ||
|
||
## Other microservices/repositories of Johnjud | ||
- [Johnjud-gateway](https://github.com/isd-sgcu/johnjud-gateway): Routing and request handling | ||
- [Johnjud-auth](https://github.com/isd-sgcu/johnjud-auth): Authentication and authorization | ||
- [Johnjud-backend](https://github.com/isd-sgcu/johnjud-backend): Main business logic | ||
- [Johnjud-file](https://github.com/isd-sgcu/johnjud-file): File management service | ||
- [Johnjud-proto](https://github.com/isd-sgcu/johnjud-proto): Protobuf files generator | ||
- [Johnjud-go-proto](https://github.com/isd-sgcu/johnjud-go-proto): Generated protobuf files for golang | ||
- [Johnjud-frontend](https://github.com/isd-sgcu/johnjud-frontend): Frontend web application |
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 |
---|---|---|
|
@@ -8,3 +8,6 @@ database: | |
name: johnjud_db | ||
username: root | ||
password: root | ||
|
||
service: | ||
file: localhost:3004 |
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 @@ | ||
app: | ||
port: 3004 | ||
debug: true | ||
|
||
database: | ||
host: local-db | ||
port: 5432 | ||
name: johnjud_db | ||
username: root | ||
password: root | ||
|
||
s3: | ||
bucket_name: <bucket name> | ||
region: <region> |
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 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
Oops, something went wrong.