Skip to content

Commit

Permalink
ci: 빌드 가능 여부 테스트 (#585)
Browse files Browse the repository at this point in the history
* ci: docs job 이름을 deploy와 겹치지 않게 변경

* ci: PR 빌드 가능 여부 테스트

* test: NODE_ENV에서 test값 허용
  • Loading branch information
scarf005 committed Jul 23, 2023
1 parent d678271 commit e42d379
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 7 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,23 @@ permissions:
contents: write
defaults:
run:
working-directory: docs
working-directory: docs

jobs:
deploy:
docs:
name: Deploy Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v3
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
clear-keys: |
mkdocs-material-
- run: pip install mkdocs-material
- run: pip install mkdocs-material
- run: mkdocs gh-deploy --force
35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test

on:
pull_request:

jobs:
test:
name: Test PR
runs-on: ubuntu-latest
environment: development

steps:
- name: Checkout
uses: actions/checkout@v3

- name: setup node.js
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: setup pnpm
run: |
corepack enable
corepack prepare pnpm@latest-8 --activate
pnpm config set store-dir .pnpm-store
- name: install dependencies
working-directory: backend
run: pnpm install

- name: build backend
working-directory: backend
run: pnpm build

# TODO: 테스트 실행
2 changes: 1 addition & 1 deletion backend/src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dotenv.config();
const runtimeMode = getRuntimeMode(process.env);

// graceful shutdown시 서버 종료 대기 시간
export const gracefulTerminationTimeout = runtimeMode === 'development' ? 0 : 30 * 1000;
export const gracefulTerminationTimeout = runtimeMode === 'production' ? 30 * 1000 : 0;

export const logLevelOption = getLogLevelOption(runtimeMode);
export const connectMode = getModeOption(process.env);
Expand Down
2 changes: 1 addition & 1 deletion backend/src/config/logOption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const colors: Record<LogLevel, string> = {
} as const;

export const getLogLevelOption = (mode: RuntimeMode): LogLevelOption => {
const logLevel = (mode === 'development' ? 'debug' : 'http');
const logLevel = (mode === 'production' ? 'http' : 'debug');
const consoleLogLevel = (mode === 'production' ? 'error' : 'debug');

return { logLevel, consoleLogLevel } as const;
Expand Down
2 changes: 1 addition & 1 deletion backend/src/config/runtimeOption.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { z } from 'zod';

export type RuntimeMode = z.infer<typeof runtimeModeSchema>;
export const runtimeModeSchema = z.enum(['development', 'production']);
export const runtimeModeSchema = z.enum(['development', 'production', 'test']);

export const runtimeSchema = z.object({ NODE_ENV: runtimeModeSchema.default('development') });

Expand Down

0 comments on commit e42d379

Please sign in to comment.