Skip to content

Merge pull request #18 from HangHae-plus-2-9/feature-order #37

Merge pull request #18 from HangHae-plus-2-9/feature-order

Merge pull request #18 from HangHae-plus-2-9/feature-order #37

Workflow file for this run

name: ci-cd-pipeline
on:
push:
branches:
- dev
permissions:
id-token: write
contents: read
env:
SHA: ${{ github.sha }}
ECR_REPOSITORY_NESTJS: 'hh-nestjs'
DATABASE_CONNECTION: ${{ secrets.DATABASE_CONNECTION }}
DATABASE_HOST: ${{ secrets.DATABASE_HOST }}
DATABASE_PORT: ${{ secrets.DATABASE_PORT }}
DATABASE_USERNAME: ${{ secrets.DATABASE_USERNAME }}
DATABASE_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
DATABASE_NAME: ${{ secrets.DATABASE_NAME }}
jobs:
test:
name: test nestjs
runs-on: ubuntu-22.04
services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: postgres
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- name: checkout
uses: actions/[email protected]
- name: setup node
uses: actions/[email protected]
with:
node-version: '18'
cache: 'npm'
- name: Cache node modules
uses: actions/[email protected]
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: install dependencies
run: npm install
- name: run lint
run: npm run lint
- name: run tests
run: npm run test
- name: run e2e tests
env:
GITHUB_ACTIONS: true # TODO: 너무 지저분하다.. Github Actions의 postgres는 ssl을 사용하는듯
run: npm run migration:run && npm run test:e2e
- name: Notify Slack on Failure
if: failure()
uses: 8398a7/[email protected]
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
author_name: ${{ github.actor }}
channel: ${{ secrets.SLACK_CHANNEL }}
username: ${{ secrets.SLACK_USERNAME }}
text: 'Tests failed! :x:'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- name: Notify Slack on Success
if: success()
uses: 8398a7/[email protected]
with:
status: ${{ job.status }}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
author_name: ${{ github.actor }}
channel: ${{ secrets.SLACK_CHANNEL }}
username: ${{ secrets.SLACK_USERNAME }}
text: 'Tests passed! :white_check_mark:'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}