Skip to content

feat: ci

feat: ci #4

Workflow file for this run

name: Continue Integration
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
unit-test:
name: unit testing
runs-on: ubuntu-latest
services:
postgres-integration:
image: postgres:16
env:
POSTGRES_USER: ${{ secrets.PGUSER }}
POSTGRES_PASSWORD: ${{ secrets.PGPASSWORD }}
POSTGRES_DB: ${{ secrets.PGDATABASE }}
ports:
- 5433:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
postgres-test:
image: postgres:16
env:
POSTGRES_USER: ${{ secrets.PGUSER_TEST }}
POSTGRES_PASSWORD: ${{ secrets.PGPASSWORD_TEST }}
POSTGRES_DB: ${{ secrets.PGDATABASE_TEST }}
ports:
- 5434:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: create env
run: |
touch .env
PGHOST=${{ secrets.HOST }} >> .env
PGUSER=${{ secrets.PGUSER }} >> .env
PGDATABASE=${{ secrets.PGDATABASE }} >> .env
PGPASSWORD=${{ secrets.PGPASSWORD }} >> .env
PGPORT=${{ secrets.PGPORT }} >> .env
PGHOST_TEST=${{ secrets.PGHOST_TEST }} >> .env
PGUSER_TEST=${{ secrets.PGUSER_TEST }} >> .env
PGDATABASE_TEST=${{ secrets.PGDATABASE_TEST }} >> .env
PGPASSWORD_TEST=${{ secrets.PGPASSWORD_TEST }} >> .env
PGPORT_TEST=${{ secrets.PGPORT_TEST }} >> .env
ACCESS_TOKEN_KEY=${{ secrets.ACCESS_TOKEN_KEY }} >> .env
REFRESH_TOKEN_KEY=${{ secrets.REFRESH_TOKEN_KEY}} >> .env
ACCCESS_TOKEN_AGE=${{secrets.ACCCESS_TOKEN_AGE}} >> .env
- name: set up Node.js 21
uses: actions/setup-node@v4
with:
node-version: "21"
- name: checkout code into the source code directory
uses: actions/checkout@v4
- run: npm install
- name: database migrate integration
run: npm run migrate
- name: database migrate test
run: npm run migrate:test
- name: test
run: npm run test