Skip to content

Fix Embeddingの情報を日記詳細トップに出すことで概要見やすくする #249

Fix Embeddingの情報を日記詳細トップに出すことで概要見やすくする

Fix Embeddingの情報を日記詳細トップに出すことで概要見やすくする #249

name: 【backend】Go Tests
on:
pull_request:
paths:
- "backend/**"
- ".github/**"
jobs:
test:
runs-on: ubuntu-latest
services:
postgres:
image: pgvector/pgvector:pg15
env:
POSTGRES_PASSWORD: dev-pass
POSTGRES_USER: postgres
POSTGRES_DB: umi_mikan
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:7
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v6
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version-file: "backend/go.mod"
cache: false # setup-go の組み込みキャッシュを無効化し、直後の actions/cache で一元管理する
- name: Cache Go modules
uses: actions/cache@v5
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install dependencies
working-directory: ./backend
run: go mod download
- name: Initialize database
run: |
for file in schema/*.sql; do
if [[ "$(basename "$file")" != *"_."* ]]; then
echo "Applying schema: $(basename "$file")"
psql "$DATABASE_URL" -f "$file"
fi
done
env:
DATABASE_URL: postgres://postgres:dev-pass@localhost:5432/umi_mikan?sslmode=disable
- name: Run tests
working-directory: ./backend
run: go test -v ./...
env:
DATABASE_URL: postgres://postgres:dev-pass@localhost:5432/umi_mikan?sslmode=disable
JWT_SECRET: test-secret-for-ci
TEST_DB_HOST: localhost
TEST_DB_USER: postgres
TEST_DB_PASSWORD: dev-pass
TEST_DB_NAME: umi_mikan
DB_HOST: localhost
DB_PORT: 5432
DB_USER: postgres
DB_PASS: dev-pass
DB_NAME: umi_mikan
REDIS_HOST: localhost
REDIS_PORT: 6379
- name: Run tests with coverage
working-directory: ./backend
run: go test -coverprofile=coverage.out ./...
env:
DATABASE_URL: postgres://postgres:dev-pass@localhost:5432/umi_mikan?sslmode=disable
JWT_SECRET: test-secret-for-ci
TEST_DB_HOST: localhost
TEST_DB_USER: postgres
TEST_DB_PASSWORD: dev-pass
TEST_DB_NAME: umi_mikan
DB_HOST: localhost
DB_PORT: 5432
DB_USER: postgres
DB_PASS: dev-pass
DB_NAME: umi_mikan
REDIS_HOST: localhost
REDIS_PORT: 6379
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
files: ./backend/coverage.out
flags: backend
name: backend-coverage