77 lines
2.5 KiB
YAML
77 lines
2.5 KiB
YAML
name: Django CI
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
# Service containers to run with `container-job`
|
|
services:
|
|
# Label used to access the service container
|
|
postgres:
|
|
# Docker Hub image
|
|
image: postgres
|
|
ports:
|
|
- 5432:5432
|
|
# Provide the password for postgres
|
|
env:
|
|
POSTGRES_DB: test_myapp
|
|
POSTGRES_USER: testuser
|
|
POSTGRES_PASSWORD: s3cretPass
|
|
# Set health checks to wait until postgres has started
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
strategy:
|
|
max-parallel: 4
|
|
matrix:
|
|
python-version: [3.6]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v1
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt-get update -qy
|
|
sudo apt-get -y install python3-dev libxml2 libxml2-dev libxslt-dev bind9utils ca-certificates gettext libcrack2-dev libxml2-dev libxslt1-dev ssh-client wget xvfb zlib1g-dev git iceweasel dnsutils postgresql-contrib libgirepository1.0-dev
|
|
python -m pip install --upgrade pip
|
|
pip install wheel
|
|
pip install -r total_requirements.txt
|
|
pip install -e .
|
|
- name: Lint with flake8
|
|
run: |
|
|
# stop the build if there are Python syntax errors or undefined names
|
|
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
|
# exit-zero treats all errors as warnings.
|
|
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics
|
|
- name: Run Tests
|
|
run: |
|
|
# orchestra-admin startproject panel
|
|
django-admin.py startproject panel --template=orchestra/conf/ribaguifi_template -v3
|
|
#python panel/manage.py test orchestra --noinput -v3
|
|
coverage run --source='orchestra' panel/manage.py test orchestra --noinput -v3
|
|
coverage report
|
|
coverage xml
|
|
|
|
env:
|
|
SECRET_KEY: zrhnooq6)sb+0+xb)(o0rvbf5)a(vc8ncv&1&kng@3i_pmx3oy
|
|
DEBUG: True
|
|
ALLOWED_HOSTS: .localhost,127.0.0.1
|
|
DATABASE_URL: postgres://testuser:s3cretPass@localhost:5432/test_myapp
|
|
POSTGRES_HOST: postgres
|
|
POSTGRES_PORT: 5432
|
|
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@v1
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|