개요
사내에서 운영중인 ERP의 테스트 자동화를 위해 배포시에 단위 테스트 커버리지에 따라 배포를 승인/거부 하는 절차를 도입하려고 한다
현재 배포 프로세스
name: Deploy to Coolify
on:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: coolify-production-deploy
cancel-in-progress: true
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy client
env:
COOLIFY_TOKEN: ${{ secrets.COOLIFY_TOKEN }}
COOLIFY_WEBHOOK: ${{ secrets.COOLIFY_CLIENT_WEBHOOK }}
run: |
curl --fail --show-error --silent --request POST "$COOLIFY_WEBHOOK" \
--header "Authorization: Bearer $COOLIFY_TOKEN"
- name: Deploy server
env:
COOLIFY_TOKEN: ${{ secrets.COOLIFY_TOKEN }}
COOLIFY_WEBHOOK: ${{ secrets.COOLIFY_SERVER_WEBHOOK }}
run: |
curl --fail --show-error --silent --request POST "$COOLIFY_WEBHOOK" \
--header "Authorization: Bearer $COOLIFY_TOKEN"
현재 배포는 main push -> git actions -> coolify 의 구조로 coolify가 메인 배포 프로세스를 담당하며 actions는 배포 요청을 하는 구조이다
배포 프로세스에 Verify 로직 포함
verify:
runs-on: ubuntu-latest
env:
DATABASE_URL: postgresql://placeholder:placeholder@localhost:5432/placeholder?schema=public
steps:
- uses: actions/checkout@v5
- uses: pnpm/action-setup@v4
with:
version: 9.0.0
- uses: actions/setup-node@v4
with:
node-version: 24
cache: pnpm
- name: Install server dependencies
run: pnpm install --filter server... --frozen-lockfile
- name: Generate Prisma client
run: pnpm --filter @repo/db prisma:generate
- name: Build shared types
run: pnpm --filter @repo/types build
- name: Run server tests with coverage
run: pnpm --filter server test:cov
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: server-coverage
path: apps/server/coverage/
if-no-files-found: ignore
retention-days: 14
해당 로직을 작성하여 actions에 추가해주었다 이제 로직이 잘 작동하는지 확인해보겠다
결과

잘 작동하는 것을 확인했다