Skip to content

Commit

Permalink
[qa/ci] Maintenance to formatting of code, docs, ci settings, setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier authored Jul 31, 2024
1 parent c745e64 commit dc85a36
Show file tree
Hide file tree
Showing 23 changed files with 109 additions and 111 deletions.
6 changes: 0 additions & 6 deletions .coveragerc

This file was deleted.

44 changes: 19 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
build:
name: Python==${{ matrix.python-version }} | ${{ matrix.django-version }}
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

strategy:
fail-fast: false
Expand All @@ -36,26 +36,23 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Install system packages
run: |
sudo apt-get update
sudo apt-get -qq install \
sqlite3 \
gdal-bin \
libproj-dev \
libgeos-dev \
libspatialite-dev \
spatialite-bin \
libsqlite3-mod-spatialite
- name: Install Dependencies
id: deps
run: |
sudo apt update
sudo apt -qq install \
sqlite3 \
gdal-bin \
libproj-dev \
libgeos-dev \
libspatialite-dev \
spatialite-bin \
libsqlite3-mod-spatialite
pip install -U pip wheel setuptools
pip install -U -r requirements-test.txt
sudo npm install -g jshint stylelint
pip install -U -e .
pip install ${{ matrix.django-version }}
sudo npm install -g jshint stylelint
- name: QA checks
run: |
Expand All @@ -64,9 +61,10 @@ jobs:
- name: Tests
if: ${{ !cancelled() && steps.deps.conclusion == 'success' }}
run: |
coverage run -a --source=openwisp_firmware_upgrader runtests.py
# SAMPLE_APP tests do not affect coverage so can be run in parallel to speed up
SAMPLE_APP=1 ./runtests.py --parallel
coverage run runtests.py --parallel
SAMPLE_APP=1 coverage run ./runtests.py --parallel
coverage combine
coverage xml
- name: Upload Coverage
if: ${{ success() }}
Expand All @@ -78,14 +76,10 @@ jobs:
COVERALLS_PARALLEL: true

coveralls:
name: Finish Coveralls
needs: build
runs-on: ubuntu-latest
container: python:3-slim
steps:
- name: Finished
run: |
pip3 install --upgrade coveralls
coveralls --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
50 changes: 27 additions & 23 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,16 @@ Bugfixes

- Fixed `hardcoded storage backend of the "FirmwareImage.file" field
<https://github.com/openwisp/openwisp-firmware-upgrader/issues/195>`_.
``FirmwareImage.file`` was configured to use ``PrivateFileSystemStorage``,
which made it impossible to use other private storage backends.
The `"OPENWISP_FIRMWARE_PRIVATE_STORAGE_INSTANCE"
``FirmwareImage.file`` was configured to use
``PrivateFileSystemStorage``, which made it impossible to use other
private storage backends. The
`"OPENWISP_FIRMWARE_PRIVATE_STORAGE_INSTANCE"
<https://github.com/openwisp/openwisp-firmware-upgrader#openwisp_firmware_private_storage_instance>`_
setting is added to make the ``FirmwareImage.file`` storage configurable.
- Fixed `inconsistent URL keyword argument in "serve_private_file"
URL pattern <https://github.com/openwisp/openwisp-firmware-upgrader/issues/197>`_.
setting is added to make the ``FirmwareImage.file`` storage
configurable.
- Fixed `inconsistent URL keyword argument in "serve_private_file" URL
pattern
<https://github.com/openwisp/openwisp-firmware-upgrader/issues/197>`_.
This broke the reverse proxy feature of `django-private-storage
<https://github.com/edoburu/django-private-storage>`_.

Expand Down Expand Up @@ -93,15 +96,15 @@ Changes
-------

Backward incompatible changes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- REST APIs are enabled by default. You can disable them by setting
``OPENWISP_FIRMWARE_UPGRADER_API`` to ``False``.
- Changed REST API prefix from ``/upgrader/`` to ``/firmware-upgrader/``.
This makes it consistent with REST API endpoints of other modules

Dependencies
^^^^^^^^^^^^
~~~~~~~~~~~~

- Dropped support for Python 3.6
- Dropped support for Django 2.2
Expand All @@ -110,32 +113,33 @@ Dependencies
- Upgraded openwisp-controller to 1.0.x

Other changes
^^^^^^^^^^^^^
~~~~~~~~~~~~~

- Avoid deletion of ``UpgradeOperation`` when related
``Firmware Image`` is deleted
- Increased default retries in OpenWRT upgrader from
``15`` to ``40``
- Avoid deletion of ``UpgradeOperation`` when related ``Firmware Image``
is deleted
- Increased default retries in OpenWRT upgrader from ``15`` to ``40``
- Made firmware upgrade logs translatable
- Changed the default API throttle rate from ``400/hour`` to ``1000/minute``
- Added time limits to ``openwisp_firmware_upgrader.tasks.create_device_firmware``
and ``openwisp_firmware_upgrader.tasks.create_all_device_firmwares`` celery tasks
- Changed the default API throttle rate from ``400/hour`` to
``1000/minute``
- Added time limits to
``openwisp_firmware_upgrader.tasks.create_device_firmware`` and
``openwisp_firmware_upgrader.tasks.create_all_device_firmwares`` celery
tasks

Bugfixes
--------

- Fixed firmware checksum check
- Improved error handling for upgrade operations
- Remove openwisp-config persistent checksum:
openwisp-config 0.6.0 makes the checksum persistent,
but this causes upgraded devices to not download the configuration
again after the upgrade, which is an issue if the configuration
contains any file which is not stored in ``/etc/``.
- Remove openwisp-config persistent checksum: openwisp-config 0.6.0 makes
the checksum persistent, but this causes upgraded devices to not
download the configuration again after the upgrade, which is an issue if
the configuration contains any file which is not stored in ``/etc/``.
- Fixed a bug which caused ``Server 500`` error on creating a new
``Build`` object if ``category`` field was left empty
- Fixed bugs in restoring deleted devices using ``django-reversion``
- Fixed migrations referencing non-swappable OpenWISP modules
that broke OpenWISP's extensibility
- Fixed migrations referencing non-swappable OpenWISP modules that broke
OpenWISP's extensibility

Version 0.1.1 [2021-01-08]
--------------------------
Expand Down
3 changes: 2 additions & 1 deletion CONTRIBUTING.rst
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Please refer to the `OpenWISP contributing guidelines <http://openwisp.io/docs/developer/contributing.html>`_.
Please refer to the `OpenWISP contributing guidelines
<http://openwisp.io/docs/developer/contributing.html>`_.
13 changes: 7 additions & 6 deletions openwisp_firmware_upgrader/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
from django.db import migrations, models
import uuid

import django.db.models.deletion
import django.utils.timezone
import model_utils.fields
import openwisp_users.mixins
import uuid
import swapper
from ..swapper import get_model_name
from swapper import dependency, split
from django.conf import settings
from django.db import migrations, models
from swapper import dependency, split

import openwisp_users.mixins

from ..hardware import FIRMWARE_IMAGE_TYPE_CHOICES
from ..swapper import get_model_name


class Migration(migrations.Migration):

initial = True

dependencies = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ def create_permissions_for_default_groups_helper(apps, schema_editor):


class Migration(migrations.Migration):

dependencies = [
('firmware_upgrader', '0001_initial'),
]
Expand Down
6 changes: 3 additions & 3 deletions openwisp_firmware_upgrader/migrations/0003_private_media.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Generated by Django 3.0.5 on 2020-04-14 18:12

from django.db import migrations
import openwisp_firmware_upgrader.base.models
import private_storage.fields
import private_storage.storage.files
from django.db import migrations

import openwisp_firmware_upgrader.base.models

class Migration(migrations.Migration):

class Migration(migrations.Migration):
dependencies = [
('firmware_upgrader', '0002_default_permissions'),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('firmware_upgrader', '0003_private_media'),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('firmware_upgrader', '0004_batch_upgrade_operation_idle_status'),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ def create_device_firmware_for_connections_helper(apps, schema_editor):


class Migration(migrations.Migration):

dependencies = [
('firmware_upgrader', '0005_build_os_identifier'),
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
# Generated by Django 3.1.5 on 2021-01-21 16:57

import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('firmware_upgrader', '0006_create_device_firmware'),
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# Generated by Django 3.1.7 on 2021-03-27 14:39

from django.db import migrations
import openwisp_firmware_upgrader.base.models
from urllib.parse import urljoin

import private_storage.fields
import private_storage.storage.files
from django.db import migrations

import openwisp_firmware_upgrader.base.models

from ..settings import FIRMWARE_API_BASEURL, IMAGE_URL_PATH
from urllib.parse import urljoin


class Migration(migrations.Migration):

dependencies = [
('firmware_upgrader', '0007_nullable_upgrade_operation_image'),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
('firmware_upgrader', '0008_firmware_image_baseurl'),
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# Generated by Django 4.2.13 on 2024-05-30 07:38

from urllib.parse import urljoin
from ..settings import FIRMWARE_API_BASEURL, IMAGE_URL_PATH
from django.db import migrations
import openwisp_firmware_upgrader.base.models

import private_storage.fields
import private_storage.storage.files
from django.db import migrations

import openwisp_firmware_upgrader.base.models

class Migration(migrations.Migration):
from ..settings import FIRMWARE_API_BASEURL, IMAGE_URL_PATH


class Migration(migrations.Migration):
dependencies = [
("firmware_upgrader", "0009_upgrade_options"),
]
Expand Down
5 changes: 1 addition & 4 deletions openwisp_firmware_upgrader/migrations/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
from django.contrib.auth.models import Permission

from django.contrib.auth.management import create_permissions

from django.contrib.auth.models import Permission
from swapper import load_model


DeviceConnection = load_model('connection', 'DeviceConnection')
DeviceFirmware = load_model('firmware_upgrader', 'DeviceFirmware')

Expand Down
2 changes: 0 additions & 2 deletions openwisp_firmware_upgrader/tests/test_openwrt_upgrader.py
Original file line number Diff line number Diff line change
Expand Up @@ -710,8 +710,6 @@ def test_upgrade_free_memory_failure(self, exec_command, is_alive, putfo):
self.assertIn(line, upgrade_op.log)
self.assertFalse(device_fw.installed)

test_upgrade_free_memory_aborted = None

@patch('scp.SCPClient.putfo')
@patch.object(OpenWrt, 'RECONNECT_DELAY', 0)
@patch.object(OpenWrt, 'RECONNECT_RETRY_DELAY', 0)
Expand Down
22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[tool.coverage.run]
source = ["openwisp_firmware_upgrader"]
parallel = true
concurrency = ["multiprocessing"]
omit = [
"openwisp_firmware_upgrader/__init__.py",
"*/tests/*",
"*/upgraders/openwisp.py"
]

[tool.docstrfmt]
extend_exclude = ["**/*.py", "README.rst"]

[tool.isort]
known_third_party = ["django", "django_x509"]
known_first_party = ["openwisp_users", "openwisp_utils", "openwisp_controller"]
default_section = "THIRDPARTY"
line_length = 88
multi_line_output = 3
use_parentheses = true
include_trailing_comma = true
force_grid_wrap = 0
11 changes: 0 additions & 11 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,3 @@ max-line-length=110
# W504: line break after or after operator
# W605: invalid escape sequence
ignore=W605, W503, W504

[isort]
known_third_party=django, django_x509
known_first_party=openwisp_users, openwisp_utils, openwisp_controller
line_length=88
default_section=THIRDPARTY
skip=migrations
multi_line_output=3
use_parentheses=True
include_trailing_comma=True
force_grid_wrap=0
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
name='openwisp-firmware-upgrader',
version=get_version(),
license='GPL3',
author='Federico Capoano',
author='OpenWISP',
author_email='[email protected]',
description='Firmware upgrader module of OpenWISP',
long_description=open('README.rst').read(),
Expand All @@ -39,7 +39,7 @@
'django-private-storage~=3.1.0',
],
classifiers=[
'Development Status :: 3 - Alpha',
'Development Status :: 5 - Production/Stable ',
'Environment :: Web Environment',
'Topic :: Internet :: WWW/HTTP',
'Topic :: System :: Networking',
Expand Down
Loading

0 comments on commit dc85a36

Please sign in to comment.