Skip to content

Commit

Permalink
Create test-and-deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronspindler committed Jun 1, 2024
1 parent 0b00b3d commit 8b2bf26
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Test and Deploy

on: [ push, pull_request ]

env:
SECRET_KEY: "FAKE_SECRET_KEY"
DATABASE_URL: ${{secrets.DATABASE_URL}}
REDIS_URL: ${{secrets.REDIS_URL}}
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}

jobs:
test:
services:
redis:
image: redis
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
postgres:
image: postgres
env:
POSTGRES_DB: teambio
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.12.2
cache: 'pip'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install coverage
- name: Collect Static
run: |
python manage.py collectstatic --no-input
- name: Run Tests
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432/teambio
REDIS_URL: redis://redis:6379
run: |
coverage run --source='.' manage.py test --no-input
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install pre-commit
run: pip install pre-commit
- name: Lint with pre-commit
run: |
pre-commit run -a
# deploy:
# runs-on: ubuntu-latest
# needs: [test, lint]
# if: github.ref == 'refs/heads/main'
# steps:
# - name: Deploy App Webhook
# uses: joelwmale/webhook-action@master
# with:
# url: ${{ secrets.RENDER_APP_DEPLOY_HOOK }}
# - name: Deploy Celery Webhook
# uses: joelwmale/webhook-action@master
# with:
# url: ${{ secrets.RENDER_CELERY_DEPLOY_HOOK }}

0 comments on commit 8b2bf26

Please sign in to comment.