Skip to content

Update and rename test.yml to django-tests.yml #1

Update and rename test.yml to django-tests.yml

Update and rename test.yml to django-tests.yml #1

Workflow file for this run

name: Django Test Suite
on:
push:
branches:
- development
pull_request:
branches:
- development
jobs:
test:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:latest
env:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_USER: selina
MYSQL_PASSWORD: selina_password
MYSQL_DATABASE: test_movie_data
options: >-
--health-cmd "mysqladmin ping -h localhost"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 3306:3306
steps:
- name: Check out the code
uses: actions/checkout@v2
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r code/requirements.txt
- name: Wait for MySQL to be healthy
run: |
until [ "$(docker inspect -f '{{.State.Health.Status}}' mysql)" == "healthy" ]; do
echo "Waiting for MySQL to be healthy..."
sleep 5
done
echo "MySQL is healthy."
- name: Run migrations
run: |
python code/my_project/manage.py migrate
- name: Run Django Tests
run: |
python code/my_project/manage.py test --no-input --verbosity=2
env:
DJANGO_DB_HOST: localhost
DJANGO_DB_NAME: test_movie_data
DJANGO_DB_USER: selina
DJANGO_DB_PASSWORD: selina_password
- name: Upload Test Report
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results
path: test-report.txt