Skip to content

Commit

Permalink
Add .env variables to Github secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
Kabanosk committed May 8, 2024
1 parent fd36edf commit 37c7a32
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/database_test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and test web application
name: Build web application and test database

on:
push:
Expand Down Expand Up @@ -26,12 +26,21 @@ jobs:
pip install -r requirements.txt
- name: Run docker compose and wait until web server is up
env:
DB_HOST: ${{ secrets.DB_HOST }}
DB_NAME: ${{ secrets.DB_NAME }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASS: ${{ secrets.DB_PASS }}
run: |
docker-compose up -d
echo "DB_HOST=$DB_HOST" > .env
echo "DB_NAME=$DB_NAME" >> .env
echo "DB_USER=$DB_USER" >> .env
echo "DB_PASS=$DB_PASS" >> .env
docker-compose up --build -d
timeout 60 bash -c 'until echo > /dev/tcp/localhost/8000; do sleep 1; done'
- name: Run tests
run: pytest tests/database.py
run: docker exec hackathon-starter_web_1 pytest tests/database.py

- name: Stop and remove container
run: docker-compose down
11 changes: 10 additions & 1 deletion .github/workflows/webapp_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,17 @@ jobs:
pip install -r requirements.txt
- name: Run docker compose and wait until web server is up
env:
DB_HOST: ${{ secrets.DB_HOST }}
DB_NAME: ${{ secrets.DB_NAME }}
DB_USER: ${{ secrets.DB_USER }}
DB_PASS: ${{ secrets.DB_PASS }}
run: |
docker-compose up -d
echo "DB_HOST=$DB_HOST" > .env
echo "DB_NAME=$DB_NAME" >> .env
echo "DB_USER=$DB_USER" >> .env
echo "DB_PASS=$DB_PASS" >> .env
docker-compose up --build -d
timeout 60 bash -c 'until echo > /dev/tcp/localhost/8000; do sleep 1; done'
- name: Run tests
Expand Down

0 comments on commit 37c7a32

Please sign in to comment.