Skip to content

Commit

Permalink
Merge pull request #203 from 2023-Winter-Bootcamp-Team-N/BE/feat/#202
Browse files Browse the repository at this point in the history
[test] backend CI test
  • Loading branch information
wndjs803 committed Jan 20, 2024
2 parents 3b3caf2 + 6e9153a commit dbd8e7e
Showing 1 changed file with 28 additions and 27 deletions.
55 changes: 28 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,47 @@ on:
pull_request:
branches: ["develop"]

env:
SECRET_KEY: ${{ secrets.SECRET_KEY }}
POSTGRES_DB: ${{ secrets.DB_USERNAME }}
POSTGRES_USER: ${{ secrets.DB_DATABASE }}
POSTGRES_PASSWORD: ${{ secrets.DB_USER_PASSWORD }}
DEVELOPER_KEY: ${{ secrets.DB_ROOT_PASSWORD }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}

jobs:
backend:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: ${{ secrets.DB_USERNAME }}
POSTGRES_PASSWORD: ${{ secrets.DB_USER_PASSWORD }}
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v2

- name: Set up Python 3.11
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
python-version: 3.11.0

- name: Install pipenv
run: python -m pip install pipenv

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
restore-keys: ${{ runner.os }}-pipenv-
- name: Setting .env
run: |
echo "${{ secrets.ENV }}" >> .env
cat .env
- name: Install dependencies
working-directory: backend
run: pipenv install
run: |
cd backend
pip install -r requirements.txt
- name: Run Django migrations
run: |
cd backend
python manage.py makemigrations
python manage.py migrate
- name: Run tests
working-directory: backend
- name: Run Django tests
run: |
pipenv run python manage.py makemigrations
pipenv run python manage.py migrate
pipenv run python manage.py test
cd backend
python manage.py test
frontend:
runs-on: ubuntu-latest
Expand Down

0 comments on commit dbd8e7e

Please sign in to comment.