https://github.com/wheatandcat/memoir-backend
memoirのバックエンド
https://github.com/wheatandcat/memoir-backend
go golang graphql
Last synced: 9 months ago
JSON representation
memoirのバックエンド
- Host: GitHub
- URL: https://github.com/wheatandcat/memoir-backend
- Owner: wheatandcat
- License: mit
- Created: 2021-03-07T11:32:16.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-01-16T13:48:29.000Z (over 3 years ago)
- Last Synced: 2025-04-01T04:32:41.077Z (over 1 year ago)
- Topics: go, golang, graphql
- Language: Go
- Homepage: https://www.memoir-app.dev/
- Size: 470 KB
- Stars: 14
- Watchers: 1
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# memoir-backend

## ローカル実行
### 導入
```
$ make install
```
### 起動
```
$ air
```
### ローカル環境で Firesbase エミュレータ起動して使用する
```
$ npx firebase --config ./e2e/simulator/firebase.json emulators:start
```
## GraphQL スキーマドキュメント
```
$ yarn graphql-markdown http://localhost:8080/query > schema.md
```
## GraphQL スキーマ更新
```zsh
$ go run github.com/99designs/gqlgen generate
```
## ユニットテスト
### 実行
moq を生成
```zsh
$ make moqgen
```
テストを実行
```zsh
$ go test ./...
```
## カバレッジ表示
### インストール
```zsh
$ brew install k1LoW/tap/octocov
```
### 実行
```zsh
$ go test ./... -coverprofile=coverage.out
$ octocov
```
### 各ファイルカバレッジ確認
```zsh
$ octocov ls-files
```
```zsh
$ octocov view graph/invite.go
```
## E2E テスト
```zsh
$ FIRESTORE_EMULATOR_HOST=localhost:3600 air
```
```zsh
$ cd e2e
$ make create_login_yaml
$ make local_scenarigo
```
## 環境変数を更新
```zsh
$ gcloud run services describe SERVICE --format export > service.yaml
# 環境変数を追加して以下を実行
$ gcloud run services replace service.yaml
```
## 本番デプロイ
```zsh
$ git checkout main
$ git pull --ff-only origin main
$ git tag -a v1.0.0 -m 'リリース内容'
$ git push origin v1.0.0
```
## CI 環境
### Firebase トークン
```zsh
$ firebase login:ci
```
### レビュー環境
```zsh
$ base64 -i serviceAccount.review.json | pbcopy
```
```zsh
$ base64 -i gcpServiceAccount.review.json | pbcopy
```
### E2E
```zsh
$ base64 -i .env | pbcopy
```
```zsh
$ base64 -i envenb.go | pbcopy
```
```zsh
$ base64 -i e2e/.env | pbcopy
```
### 本番環境
```zsh
$ base64 -i serviceAccount.production.json | pbcopy
```
```zsh
$ base64 -i gcpServiceAccount.production.json | pbcopy
```
## 静的解析
```zsh
$ go install github.com/wheatandcat/memoir-static-analytics/checkcustomerror/cmd/checkcustomerror@v0.0.7
$ go vet -vettool=$(which checkcustomerror) ./...
```