Skip to content
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 23 additions & 32 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,6 @@ jobs:
name: Python==${{ matrix.python-version }} | ${{ matrix.django-version }}
runs-on: ubuntu-22.04

services:
redis:
image: redis
ports:
- 6379:6379
postgres:
image: postgis/postgis:13-3.3-alpine
env:
POSTGRES_PASSWORD: openwisp2
POSTGRES_USER: openwisp2
POSTGRES_DB: openwisp2
ports:
- 5432:5432

strategy:
fail-fast: false
matrix:
Expand All @@ -46,6 +32,19 @@ jobs:
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Cache APT packages
uses: actions/cache@v4
with:
path: /var/cache/apt/archives
key: apt-${{ runner.os }}-${{ hashFiles('.github/workflows/ci.yml') }}
restore-keys: |
apt-${{ runner.os }}-

- name: Disable man page auto-update
run: |
echo 'set man-db/auto-update false' | sudo debconf-communicate >/dev/null
sudo dpkg-reconfigure man-db

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
Expand All @@ -54,19 +53,6 @@ jobs:
cache-dependency-path: |
**/requirements*.txt

- uses: browser-actions/setup-chrome@v1
# Using a fixed version, see here for more information on why:
# https://github.com/openwisp/openwisp-controller/issues/902#issuecomment-2266219715
# TODO: find a solution to allow using recent versions
with:
chrome-version: 125
install-chromedriver: true
id: setup-chrome

- run: |
${{ steps.setup-chrome.outputs.chrome-path }} --version
chromedriver --version

- name: Install Dependencies
id: deps
run: |
Expand All @@ -80,23 +66,28 @@ jobs:
pip install -U -e .
pip install ${{ matrix.django-version }}

- name: Start postgres and redis
if: ${{ !cancelled() && steps.deps.conclusion == 'success' }}
run: docker compose up -d postgres redis

- name: QA checks
run: ./run-qa-checks

- name: Tests
if: ${{ !cancelled() && steps.deps.conclusion == 'success' }}
run: |
coverage run runtests.py --parallel
# the following command runs tests with Postgres/PostGIS but
# only for specific test cases which are tagged with "db_tests"
POSTGRESQL=1 coverage run runtests.py --parallel --keepdb
# tests the extension capability
SAMPLE_APP=1 coverage run ./runtests.py --parallel --keepdb
SAMPLE_APP=1 coverage run ./runtests.py --parallel --keepdb --exclude-tag=selenium_tests
coverage combine
coverage xml
env:
SELENIUM_HEADLESS: 1
CHROME_BIN: ${{ steps.setup-chrome.outputs.chrome-path }}
GECKO_LOG: 1

- name: Show gecko web driver log on failures
if: ${{ failure() }}
run: cat geckodriver.log

- name: Upload Coverage
if: ${{ success() }}
Expand Down
12 changes: 5 additions & 7 deletions docs/developer/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Launch Redis and PostgreSQL:

.. code-block:: shell

docker-compose up -d redis postgres
docker compose up -d redis postgres

Setup and activate a virtual-environment (we'll be using `virtualenv
<https://pypi.org/project/virtualenv/>`_):
Expand Down Expand Up @@ -92,7 +92,8 @@ Launch development server:

You can access the admin interface at ``http://127.0.0.1:8000/admin/``.

Run tests with:
Run tests with (make sure you have the :ref:`selenium dependencies
<selenium_dependencies>` installed locally first):

.. code-block:: shell

Expand All @@ -106,9 +107,6 @@ specific tests as follows:

.. code-block:: shell

# Run database tests against PostgreSQL backend
POSTGRESQL=1 ./runtests.py --parallel

# Run only specific selenium tests classes
cd tests/
DJANGO_SETTINGS_MODULE=openwisp2.postgresql_settings ./manage.py test openwisp_controller.config.tests.test_selenium.TestDeviceAdmin
Expand Down Expand Up @@ -162,13 +160,13 @@ Build from the Dockerfile:

.. code-block:: shell

docker-compose build
docker compose build

Run the docker container:

.. code-block:: shell

docker-compose up
docker compose up

Troubleshooting Steps for Common Installation Issues
----------------------------------------------------
Expand Down
Loading
Loading