2021-01-05 13:04:42 +00:00
|
|
|
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
|
2021-02-22 13:35:06 +00:00
|
|
|
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
|
2021-01-05 13:04:42 +00:00
|
|
|
python -m pip install --upgrade pip
|
2021-01-05 13:11:03 +00:00
|
|
|
pip install wheel
|
|
|
|
pip install -e .
|
2021-01-05 13:04:42 +00:00
|
|
|
pip install -r requirements.txt
|
|
|
|
pip install -r requirements-testing.txt
|
|
|
|
- name: Lint with flake8
|
|
|
|
run: |
|
|
|
|
# stop the build if there are Python syntax errors or undefined names
|
2021-01-06 07:11:44 +00:00
|
|
|
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
2021-01-05 13:04:42 +00:00
|
|
|
# exit-zero treats all errors as warnings.
|
|
|
|
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=120 --statistics
|
|
|
|
- name: Run Tests
|
|
|
|
run: |
|
2021-01-06 07:49:50 +00:00
|
|
|
# orchestra-admin startproject panel
|
|
|
|
django-admin.py startproject panel --template=orchestra/conf/project_template -v3
|
2021-02-22 13:35:06 +00:00
|
|
|
coverage run --source='orchestra' panel/manage.py test orchestra --noinput -v3
|
|
|
|
coverage report
|
|
|
|
coverage xml
|
2021-01-05 13:04:42 +00:00
|
|
|
|
|
|
|
env:
|
|
|
|
DATABASE_URL: postgres://testuser:s3cretPass@localhost:5432/test_myapp
|
|
|
|
POSTGRES_HOST: postgres
|
|
|
|
POSTGRES_PORT: 5432
|
|
|
|
|
2021-02-22 13:35:06 +00:00
|
|
|
- name: Upload coverage to Codecov
|
|
|
|
uses: codecov/codecov-action@v1
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|