Skip to content

Commit

Permalink
Merge pull request #116 from hngprojects/devops-main
Browse files Browse the repository at this point in the history
added ci step test main.py, renamed cd pipelines accordinly and commented out alembic migration
  • Loading branch information
bolexs authored Jul 20, 2024
2 parents eb57a0b + 8d7179f commit 15836d0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 21 deletions.
10 changes: 5 additions & 5 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
PYTHON_ENV=dev

DB_TYPE=postgresql
DB_NAME=""
DB_USER=""
DB_PASSWORD=""
DB_HOST=""
DB_NAME=test
DB_USER=username
DB_PASSWORD=password
DB_HOST="localhost"
DB_PORT=5432
MYSQL_DRIVER=
DB_URL=postgresql://username:password@host:PORT/dbname
DB_URL=postgresql://username:password@localhost:5432/test
SECRET_KEY = ""
ALGORITHM = HS256
ACCESS_TOKEN_EXPIRE_MINUTES = 10
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cd.prod.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Dev Branch Deployment
name: Prod Branch Deployment

on:
workflow_run:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cd.staging.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Dev Branch Deployment
name: Staging Branch Deployment

on:
workflow_run:
Expand Down
34 changes: 20 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: CI

on:
push:
branches: [main, staging, dev]
branches: [main, staging, dev, devops-main]
pull_request:
branches: [main, staging, dev]
branches: [main, staging, dev, devops-main]

jobs:
build-and-test:
Expand All @@ -14,9 +14,9 @@ jobs:
postgres:
image: postgres:latest
env:
POSTGRES_USER:
POSTGRES_PASSWORD:
POSTGRES_DB:
POSTGRES_USER: 'username'
POSTGRES_PASSWORD: "password"
POSTGRES_DB: "test"
ports:
- 5432:5432

Expand All @@ -34,16 +34,22 @@ jobs:
run: |
pip install -r requirements.txt
# - name: Copy env file
# run: cp .env.sample .env
- name: Copy env file
run: cp .env.sample .env

- name: Run app
run: |
python3 main.py &
pid=$!
sleep 10
if ps -p $pid > /dev/null; then
echo "main.py started successfully"
kill $pid
else
echo "main.py failed to start"
exit 1
fi
# - name: Copy env file for main
# if: github.ref == 'refs/heads/main'
# run: cp .env.production .env

# - name: Copy env file for staging
# if: github.ref == 'refs/heads/staging'
# run: cp .env.staging .env
# - name: Run migrations
# run: |
Expand Down

0 comments on commit 15836d0

Please sign in to comment.