Skip to content

Commit

Permalink
prod (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
xappyyy authored Jan 2, 2024
2 parents b3bc7a2 + c762a67 commit 7ed1371
Show file tree
Hide file tree
Showing 32 changed files with 2,563 additions and 215 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/test-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ jobs:

steps:
- name: Checkout Repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Set up Docker
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v3
- name: Build Docker Image
run: docker build -t gearfest-backend .
uses: docker/build-push-action@v5
with:
context: .
push: false
tags: test
30 changes: 30 additions & 0 deletions .github/workflows/unit-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "Pull request/Push: Unit test"

on:
pull_request:
branches:
- dev
- main
push:
branches:
- dev
- main
jobs:
test:
runs-on: "ubuntu-latest"

steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21.5"
- name: Install dependencies
run: go mod download
- name: Vet
run: go vet ./...
- name: Test
run: |
go test -v -coverpkg ./src/... -coverprofile coverage.out -covermode count ./tests/...
go tool cover -func="./coverage.out"
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@
.temp

.env
config.yaml
config.yaml

# coverage report
coverage.out
coverage.html
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Backend interface for the GearFestival website.

1. Clone this repo.
2. Copy `config.local.yaml` in `config` and paste it in the same directory with `.local` removed from its name.
3. Run `go mod download` to download all the dependencies.
3. Replace `<client_id>` with your Google OAuth client id in `config.yaml`.
4. Run `go mod download` to download all the dependencies.

## Running

Expand All @@ -21,7 +22,9 @@ Backend interface for the GearFestival website.
> Note: You have to install [Docker](https://docs.docker.com/get-docker/) and [Supabase CLI](https://github.com/supabase/cli) before running this command.
2. Run `go run ./src/` to start server.
3. Server should be running on `localhost:8080` and `localhost:54323/project/default/editor` for database editor.
3. The server should be running on `localhost:8080`, `localhost:8080/swagger/index.html` for Swagger UI, and `localhost:54323/project/default/editor` for database editor.

> Note: If there are no tables on the database, please run `supabase db reset` to apply migrations.
Ensure to run `supabase stop` to close supabase after finishing your code. If there are migrations that haven't been applied to supabase, please run `supabase db reset` to apply migrations.

Expand Down
5 changes: 3 additions & 2 deletions config/config.local.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
database:
supabase:
host: 127.0.0.1
user: postgres
password: postgres
dbname: postgres
port: "54322"
sslmode: disable
timezone: Asia/Shanghai
schema: public
google:
client_id: <client_id>
Loading

0 comments on commit 7ed1371

Please sign in to comment.