Add GitHub Actions workflow for Django CI #5
Workflow file for this run
This file contains hidden or 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
| name: Run Tests CI | |
| on: | |
| push: | |
| branches: [ master ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-22.04 | |
| services: | |
| redis: | |
| image: redis | |
| ports: | |
| - 6379:6379 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Install Scilab, R, firefox and xvfb | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get update -qq | |
| sudo apt-get install -y scilab r-base xvfb firefox | |
| sudo apt-get install -y r-base | |
| - name: Start xvfb | |
| run: | | |
| Xvfb :99 -screen 0 1024x768x24 & | |
| echo "DISPLAY=:99" >> $GITHUB_ENV | |
| - name: Set up Python 3.6 venv | |
| run: | | |
| pip install -r requirements.txt | |
| pip install -r requirements/requirements-common.txt | |
| pip install codecov | |
| python setup.py develop | |
| - name: Run Django migrations | |
| run: | | |
| python manage.py makemigrations notifications_plugin | |
| python manage.py makemigrations stats | |
| python manage.py makemigrations | |
| python manage.py migrate auth | |
| python manage.py migrate | |
| - name: Run tests with coverage and Celery | |
| run: | | |
| coverage erase | |
| celery multi start 1 -A online_test worker -B | |
| coverage run -p manage.py test -v 2 yaksh | |
| coverage run -p manage.py test -v 2 stats | |
| coverage run -p manage.py test -v 2 grades | |
| coverage run -p manage.py test -v 2 yaksh.live_server_tests.load_test | |
| coverage run -p manage.py test -v 2 api | |
| celery multi stop 1 | |
| find . -type f -name "*.pid" -exec rm -f {} \; | |
| - name: Upload coverage to Codecov | |
| run: | | |
| coverage combine | |
| coverage report | |
| codecov | |
| - name: Generate HTML coverage report | |
| run: coverage html | |
| - name: Upload HTML coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: htmlcov | |
| path: htmlcov/ |