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 53ed64f
Showing 1 changed file with 17 additions and 20 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

0 comments on commit 53ed64f

Please sign in to comment.