Merge pull request #292 from 2023-Winter-Bootcamp-Team-N/suha0523-pat… #179
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: ["develop"] | |
pull_request: | |
branches: ["develop"] | |
jobs: | |
backend: | |
runs-on: ubuntu-latest | |
services: | |
db: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: ${{ secrets.DB_USERNAME }} | |
POSTGRES_PASSWORD: ${{ secrets.DB_USER_PASSWORD }} | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.11.0 | |
- name: Setting .env | |
run: | | |
echo "${{ secrets.ENV }}" >> .env | |
cat .env | |
- name: Install dependencies | |
run: | | |
cd backend | |
pip install -r requirements.txt | |
- name: Run Django migrations | |
run: | | |
cd backend | |
python manage.py makemigrations --settings=nTeamProject.actions | |
python manage.py migrate --settings=nTeamProject.actions | |
- name: Run Django tests | |
run: | | |
cd backend | |
python manage.py test --settings=nTeamProject.actions | |
frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache frontend packages | |
uses: actions/cache@v3 | |
with: | |
path: frontend/node_modules | |
key: ${{ runner.os }}-frontend-${{ hashFiles('frontend/package-lock.json') }} | |
restore-keys: ${{ runner.os }}-frontend- | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Install packages | |
working-directory: frontend | |
run: npm install |