From 795a6a63d388f1a9abc6a5c143845daaf450760e Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Tue, 5 Jan 2021 14:04:42 +0100 Subject: [PATCH] Configure GitHub CI to run tests --- .github/workflows/django.yml | 67 ++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 .github/workflows/django.yml diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml new file mode 100644 index 00000000..496cafb9 --- /dev/null +++ b/.github/workflows/django.yml @@ -0,0 +1,67 @@ +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 + python -m pip install --upgrade pip + pip install http://git.io/django-orchestra-dev + 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 + 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 + python panel/manage.py migrate + python panel/manage.py test orchestra --noinput + + env: + DATABASE_URL: postgres://testuser:s3cretPass@localhost:5432/test_myapp + POSTGRES_HOST: postgres + POSTGRES_PORT: 5432 + +