mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-20 10:34:30 +00:00
Makefile: Move various tests into build system
- This allows those tests to be invoked on console and not just in CI pipelines. Tests: - Running make check works. - CI pipeline succeeds. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> [jvalleroy: Remove phony test target] Signed-off-by: James Valleroy <jvalleroy@mailbox.org> Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
ba55d8fe2e
commit
2788d6810d
@ -16,31 +16,25 @@ code-quality:
|
|||||||
stage: test
|
stage: test
|
||||||
needs: []
|
needs: []
|
||||||
script:
|
script:
|
||||||
- python3 -m flake8 container plinth actions/*
|
- make check-code
|
||||||
|
|
||||||
static-type-check:
|
static-type-check:
|
||||||
stage: test
|
stage: test
|
||||||
needs: []
|
needs: []
|
||||||
before_script:
|
|
||||||
- apt-get update
|
|
||||||
- apt-get install -y mypy
|
|
||||||
script:
|
script:
|
||||||
- mypy .
|
- make check-type
|
||||||
|
|
||||||
unit-tests:
|
unit-tests:
|
||||||
stage: test
|
stage: test
|
||||||
needs: []
|
needs: []
|
||||||
before_script:
|
before_script:
|
||||||
- export DEBIAN_FRONTEND=noninteractive
|
- make provision-dev
|
||||||
- apt-get update
|
|
||||||
- apt-get build-dep -y . # Dependencies of the freedombox Debian package
|
|
||||||
- apt-get install -y $(./run --list-dependencies) # Module dependencies
|
|
||||||
script:
|
script:
|
||||||
- adduser tester --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password
|
- adduser tester --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-password
|
||||||
- echo "tester:password" | chpasswd
|
- echo "tester:password" | chpasswd
|
||||||
- cp -r . /home/tester/plinth
|
- cp -r . /home/tester/plinth
|
||||||
- chown -R tester:tester /home/tester/plinth
|
- chown -R tester:tester /home/tester/plinth
|
||||||
- su -c "cd ~/plinth;PYTHONPATH='.' py.test-3 --cov=plinth --cov-report=html:/home/tester/plinth/htmlcov --cov-report=term" tester
|
- su -c "cd ~/plinth; make check-tests-cov" tester
|
||||||
- cp -r /home/tester/plinth/htmlcov test-coverage-report
|
- cp -r /home/tester/plinth/htmlcov test-coverage-report
|
||||||
coverage: '/^TOTAL\s+.*\s+(\d+\.\d+%)$/'
|
coverage: '/^TOTAL\s+.*\s+(\d+\.\d+%)$/'
|
||||||
artifacts:
|
artifacts:
|
||||||
@ -51,7 +45,7 @@ doc-tests:
|
|||||||
stage: test
|
stage: test
|
||||||
needs: []
|
needs: []
|
||||||
script:
|
script:
|
||||||
- doc/scripts/wikiparser.py
|
- make check-doc
|
||||||
|
|
||||||
app-server-stable:
|
app-server-stable:
|
||||||
variables:
|
variables:
|
||||||
|
|||||||
36
Makefile
36
Makefile
@ -119,9 +119,29 @@ install:
|
|||||||
# Documentation
|
# Documentation
|
||||||
$(MAKE) -C doc install
|
$(MAKE) -C doc install
|
||||||
|
|
||||||
check:
|
check: check-type check-code check-doc check-tests
|
||||||
|
|
||||||
|
# Run the main test suite
|
||||||
|
check-tests:
|
||||||
$(PYTHON) -m pytest $(PYTEST_ARGS)
|
$(PYTHON) -m pytest $(PYTEST_ARGS)
|
||||||
|
|
||||||
|
# Tests with coverage report
|
||||||
|
check-tests-cov:
|
||||||
|
$(PYTHON) -m pytest $(PYTEST_ARGS) --cov=plinth \
|
||||||
|
--cov-report=html:./htmlcov --cov-report=term
|
||||||
|
|
||||||
|
# Code quality checking using flake8
|
||||||
|
check-code:
|
||||||
|
$(PYTHON) -m flake8 plinth actions/actions container
|
||||||
|
|
||||||
|
# Static type checking using mypy
|
||||||
|
check-type:
|
||||||
|
$(PYTHON) -m mypy .
|
||||||
|
|
||||||
|
# Use doctest for check the wikiparser in doc directory
|
||||||
|
check-doc:
|
||||||
|
$(PYTHON) -m doctest doc/scripts/wikiparser.py
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
make -C doc clean
|
make -C doc clean
|
||||||
rm -rf Plinth.egg-info
|
rm -rf Plinth.egg-info
|
||||||
@ -158,4 +178,16 @@ provision-dev:
|
|||||||
DEBIAN_FRONTEND=noninteractive apt-get install --yes ncurses-term \
|
DEBIAN_FRONTEND=noninteractive apt-get install --yes ncurses-term \
|
||||||
sshpass bash-completion
|
sshpass bash-completion
|
||||||
|
|
||||||
.PHONY: update-translations configure build install check clean provision
|
.PHONY: \
|
||||||
|
build \
|
||||||
|
check \
|
||||||
|
check-code \
|
||||||
|
check-doc \
|
||||||
|
check-type \
|
||||||
|
check-tests \
|
||||||
|
check-tests-cov \
|
||||||
|
clean \
|
||||||
|
configure \
|
||||||
|
install \
|
||||||
|
provision \
|
||||||
|
update-translations
|
||||||
|
|||||||
@ -7,7 +7,6 @@ import importlib
|
|||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
import sys
|
import sys
|
||||||
from unittest.mock import patch
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
|||||||
2
debian/control
vendored
2
debian/control
vendored
@ -37,6 +37,7 @@ Build-Depends:
|
|||||||
python3-flake8,
|
python3-flake8,
|
||||||
python3-gi,
|
python3-gi,
|
||||||
python3-markupsafe,
|
python3-markupsafe,
|
||||||
|
python3-mypy,
|
||||||
python3-openssl,
|
python3-openssl,
|
||||||
python3-pampy,
|
python3-pampy,
|
||||||
python3-paramiko,
|
python3-paramiko,
|
||||||
@ -52,6 +53,7 @@ Build-Depends:
|
|||||||
python3-setuptools-git,
|
python3-setuptools-git,
|
||||||
# python3-tomli is not available in Bullseye
|
# python3-tomli is not available in Bullseye
|
||||||
python3-tomli | python3-coverage (<< 6.0),
|
python3-tomli | python3-coverage (<< 6.0),
|
||||||
|
python3-typeshed,
|
||||||
python3-yaml,
|
python3-yaml,
|
||||||
sshpass,
|
sshpass,
|
||||||
xmlto,
|
xmlto,
|
||||||
|
|||||||
2
debian/rules
vendored
2
debian/rules
vendored
@ -7,7 +7,7 @@ export PYBUILD_CONFIGURE_ARGS=make configure
|
|||||||
export PYBUILD_BUILD_ARGS=make PYTHON={interpreter} build
|
export PYBUILD_BUILD_ARGS=make PYTHON={interpreter} build
|
||||||
export PYBUILD_INSTALL_ARGS=make PYTHON={interpreter} DESTDIR={destdir} install
|
export PYBUILD_INSTALL_ARGS=make PYTHON={interpreter} DESTDIR={destdir} install
|
||||||
export PYBUILD_CLEAN_ARGS=make clean
|
export PYBUILD_CLEAN_ARGS=make clean
|
||||||
export PYBUILD_TEST_ARGS=make PYTHON={interpreter} check
|
export PYBUILD_TEST_ARGS=make PYTHON={interpreter} check-tests
|
||||||
|
|
||||||
%:
|
%:
|
||||||
dh $@ --with python3 --buildsystem=pybuild
|
dh $@ --with python3 --buildsystem=pybuild
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user