38 lines
1.1 KiB
YAML
38 lines
1.1 KiB
YAML
name: ci
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: self-hosted
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: install
|
|
run: pnpm install --frozen-lockfile
|
|
- name: build + typecheck
|
|
run: pnpm -r build
|
|
- name: test (unit + integration на временной БД llmtest_*)
|
|
env:
|
|
KHB_APP_DB_PASSWORD: ${{ secrets.KHB_APP_DB_PASSWORD }}
|
|
run: |
|
|
DB_IP=$(sudo -n docker inspect -f '{{.NetworkSettings.Networks.supabase_default.IPAddress}}' supabase-db)
|
|
export KHB_TEST_DATABASE_URL="postgres://khb_app:${KHB_APP_DB_PASSWORD}@${DB_IP}:5432/postgres"
|
|
pnpm test
|
|
|
|
deploy:
|
|
needs: test
|
|
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
|
runs-on: self-hosted
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: build image
|
|
run: |
|
|
TAG=$(git rev-parse --short=12 HEAD)
|
|
echo "$TAG" > .image_tag
|
|
sudo -n docker build --build-arg GIT_SHA="${TAG}" -t "khb-microservices:${TAG}" .
|
|
- name: deploy
|
|
run: sudo -n /y/services/khb-deploy/deploy.sh "$(cat .image_tag)"
|