Skip to content

Commit

Permalink
Add postgres database service for github action
Browse files Browse the repository at this point in the history
  • Loading branch information
dotpep committed Feb 29, 2024
1 parent 8771465 commit 1f2f06d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 22 deletions.
37 changes: 17 additions & 20 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ name: Build and Deploy Code

on: [push, pull_request]

env:
ACCESS_TOKEN_EXPIRE_MINUTES: ${{ vars.ACCESS_TOKEN_EXPIRE_MINUTES }}
ALGORITHM: HS256

jobs:
my_first_job:
environment:
Expand All @@ -17,6 +13,23 @@ jobs:
DATABASE_NAME: ${{ secrets.DATABASE_NAME }}
DATABASE_USERNAME: ${{ secrets.DATABASE_USERNAME }}
SECRET_KEY: ${{ secrets.SECRET_KEY }}
ALGORITHM: ${{ secrets.ALGORITHM }}
ACCESS_TOKEN_EXPIRE_MINUTES: ${{ secrets.ACCESS_TOKEN_EXPIRE_MINUTES }}

services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: ${{ secrets.DATABASE_PASSWORD }}
POSTGRES_DB: ${{ secrets.DATABASE_NAME }}_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
runs-on: ubuntu-20.04
steps:
- name: Pulling Git Repo
Expand All @@ -33,19 +46,3 @@ jobs:
run: |
pip install pytest
pytest -v
my_second_job:
runs-on: ubuntu-20.04
steps:
- name: Checking Github Actions global secrets and variables
run: |
echo "${{ secrets.DATABASE_HOSTNAME }}"
echo DATABASE_HOSTNAME
- name: Checking Github Environment secrets
run: |
echo DATABASE_PASSWORD
- name: Checking Github Environment variables
run: |
echo "${{ vars.ACCESS_TOKEN_EXPIRE_MINUTES }}"
echo ACCESS_TOKEN_EXPIRE_MINUTES
2 changes: 1 addition & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ psycopg2-binary = "^2.9.9"
gunicorn = "^21.2.0"
psycopg2 = "^2.9.9"
sqlalchemy-utils = "^0.41.1"
testing-postgresql = "^1.3.0"


[tool.poetry.group.dev.dependencies]
autopep8 = "^2.0.4"
pytest = "^8.0.2"
testing-postgresql = "^1.3.0"

[build-system]
requires = ["poetry-core"]
Expand Down
Binary file modified requirements.txt
Binary file not shown.

0 comments on commit 1f2f06d

Please sign in to comment.