-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
0b00b3d
commit 8b2bf26
Showing
1 changed file
with
83 additions
and
0 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 |
---|---|---|
@@ -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 }} |