-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c2e50f8
commit fff2e97
Showing
1 changed file
with
20 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,10 @@ name: jazztunes CI and Deployment | |
on: | ||
push: | ||
branches: [ "main" ] | ||
|
||
env: | ||
ADMIN_USER_ID: ${{ secrets.ADMIN_USER_ID }} | ||
ALLOWED_HOSTS: ${{ secrets.ALLOWED_HOSTS }} | ||
DATABASE_URL: ${{ secrets.DATABASE_URL }} | ||
DEBUG: ${{ secrets.DEBUG }} | ||
DEFAULT_FROM_EMAIL: ${{ secrets.DEFAULT_FROM_EMAIL }} | ||
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} | ||
|
@@ -24,6 +23,22 @@ jobs: | |
matrix: | ||
python-version: [3.11] | ||
|
||
# Define service containers for running tests | ||
services: | ||
postgres: | ||
image: postgres | ||
env: | ||
POSTGRES_USER: testuser | ||
POSTGRES_PASSWORD: testpass | ||
POSTGRES_DB: testdb | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
|
@@ -35,15 +50,14 @@ jobs: | |
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Run Tests | ||
|
||
|
||
env: | ||
# Set DATABASE_URL for Django to connect to the test database | ||
DATABASE_URL: postgres://testuser:testpass@localhost:5432/testdb | ||
run: | | ||
pytest | ||
- name: Deploy to Heroku | ||
env: | ||
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} | ||
run: | | ||
git fetch --unshallow || true | ||
git push https://heroku:[email protected]/${{ secrets.HEROKU_APP_NAME }}.git HEAD:main -f | ||