Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use tests from orange-ci-cd as other add-ons #702

Merged
merged 4 commits into from
Jan 17, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions .github/workflows/check_pylint_diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ UNCOMMITED_PATCH="$TMP_REPO/uncommited.patch"
SCRIPT=$(basename "$0")
PYLINT="$(command -v pylint 2>/dev/null || true)"
RADON="$(command -v radon 2>/dev/null || true)"
PYLINT_ARGS="--output-format=parseable"
PYLINT_ARGS="--msg-template='{path}:{line}: [{msg_id}({symbol}), {obj}] {msg}'"
RADON_ARGS='cc --min C --no-assert --show-closures --show-complexity --average'

trap "status=\$?; cd '$GIT_REPO'; rm -rf '$TMP_REPO'; exit \$status" EXIT
Expand Down Expand Up @@ -127,7 +127,7 @@ Number_of_issues ()
cached="$1"
{ cat "$cached" 2>/dev/null ||
echo "$CHANGED_FILES" |
xargs "$PYLINT" $PYLINT_ARGS |
xargs "$PYLINT" "$PYLINT_ARGS" |
tee "$cached"
} | awk -F'[\\. ]' '/^Your code has been rated at /{ print $7 }' || true
}
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/lint_workflow.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Lint workflow

on:
# Trigger the workflow on push or pull request, but only for the master branch
push:
branches:
- master
Expand All @@ -11,21 +10,15 @@ on:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: False
matrix:
python: [3.8]
os: [ubuntu-20.04]

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '2'
- name: Setup Python
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python }}
python-version: '3.10'

- name: Install Tox
run: pip install tox
Expand Down
110 changes: 11 additions & 99 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,104 +7,16 @@ on:
pull_request:
branches:
- master
workflow_dispatch:
schedule:
- cron: '0 6 1 * *'

jobs:
build:
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.experimental }}
timeout-minutes: 20
name: ${{ matrix.name }} (${{ matrix.os }}, ${{ matrix.python-version }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-11, windows-2019]
python-version: [3.8, 3.9]
tox_env: [py-orange-released]
experimental: [false]
name: [Released]
include:
- os: ubuntu-20.04
python-version: 3.9
tox_env: py-orange-dask
name: Dask
experimental: false

- os: windows-2019
python-version: 3.8
tox_env: py-orange-oldest
experimental: false
name: Oldest
- os: macos-11
python-version: 3.8
tox_env: py-orange-oldest
name: Oldest
experimental: false
- os: ubuntu-20.04
python-version: 3.8
tox_env: py-orange-oldest
name: Oldest
experimental: false

- os: windows-2019
python-version: 3.9
tox_env: py-orange-latest
experimental: false
name: Latest
- os: macos-11
python-version: 3.9
tox_env: py-orange-latest
experimental: false
name: Latest
- os: ubuntu-20.04
python-version: 3.9
tox_env: py-orange-latest
experimental: false
name: Latest

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install linux system dependencies
if: |
matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update
sudo apt-get install -y libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 libegl1-mesa libxcb-shape0

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade tox

- name: Set environment variable
# this step sets QT_QPA_PLATFORM env which is required on Ubuntu and
# it is skipped on Windows - QLabel font issues
if: runner.os != 'Windows'
run: |
echo "QT_QPA_PLATFORM=offscreen" >> $GITHUB_ENV

- name: Test with Tox
run: |
tox -e ${{ matrix.tox_env }}
env:
# Raise deprecations as errors in our tests only when testing orange-oldest and orange-released.
ORANGE_DEPRECATIONS_ERROR: "${{ matrix.tox_env != 'py-orange-latest' && '1' || '' }}"
# Need this otherwise unittest installs a warning filter that overrides
# our desire to have OrangeDeprecationWarnings raised
PYTHONWARNINGS: module

- name: Upload code coverage
if: |
matrix.python-version == '3.9' &&
matrix.os == 'ubuntu-20.04' &&
matrix.tox_env == 'py-orange-dask'
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: true
normal:
name: Usual
uses: biolab/orange-ci-cd/.github/workflows/test-addons.yml@master
dask:
name: Dask
uses: biolab/orange-ci-cd/.github/workflows/test-job.yml@master
with:
os: ubuntu-latest
python-version: '3.10'
tox_env: dask
pyqt: '5.15.*'
75 changes: 14 additions & 61 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ persistent=yes

# List of plugins (as comma separated values of python modules names) to load,
# usually to register additional checkers.
load-plugins=
load-plugins=pylint.extensions.eq_without_hash

# Use multiple processes to speed up Pylint.
jobs=0
Expand All @@ -28,16 +28,7 @@ unsafe-load-any-extension=no
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code
extension-pkg-whitelist=

# Allow optimization of some AST trees. This will activate a peephole AST
# optimizer, which will apply various small optimizations. For instance, it can
# be used to obtain the result of joining multiple strings with the addition
# operator. Joining a lot of strings can lead to a maximum recursion error in
# Pylint and this flag can prevent that. It has one side effect, the resulting
# AST will be different than the one from reality.
optimize-ast=no

extension-pkg-whitelist=Orange.distance._distance,Orange.data._variable,numpy.random.mtrand

[MESSAGES CONTROL]

Expand All @@ -60,19 +51,12 @@ confidence=
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=
global-statement,unnecessary-lambda,arguments-differ,unused-argument,
no-self-use,fixme,no-name-in-module,no-member,
round-builtin,next-method-called,cmp-builtin,filter-builtin-not-iterating,
nonzero-method,old-division,input-builtin,intern-builtin,
map-builtin-not-iterating,suppressed-message,buffer-builtin,
unpacking-in-except,no-absolute-import,range-builtin-not-iterating,
coerce-method,zip-builtin-not-iterating,reload-builtin,
standarderror-builtin,import-star-module-level,old-octal-literal,
metaclass-assignment,reduce-builtin,indexing-exception,
parameter-unpacking,long-suffix,cmp-method,using-cmp-argument,
useless-suppression,import-error,
empty-docstring,missing-docstring,redefined-outer-name,redefined-builtin,
attribute-defined-outside-init, no-else-return, len-as-condition, invalid-sequence-index
missing-docstring, # I guess not
no-name-in-module, no-member, # too many false positives from Qt
import-error, # false positives, and we don't expect any true positives
too-many-ancestors, # I don't think this is a problem
no-else-return, # else's may actually improve readability
duplicate-code # too strict; we're disciplined and don't do this by mistake


[REPORTS]
Expand All @@ -82,11 +66,6 @@ disable=
# mypackage.mymodule.MyReporterClass.
output-format=text

# Put messages in a separate file for each module / package specified on the
# command line instead of printing them on stdout. Reports (if any) will be
# written in a file name "pylint_global.[txt|html]".
files-output=no

# Tells whether to display a full report or only the messages
reports=yes

Expand Down Expand Up @@ -114,12 +93,6 @@ ignore-long-lines=^\s*(# )?<?https?://\S+>?$
# else.
single-line-if-stmt=yes

# List of optional constructs for which whitespace checking is disabled. `dict-
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
# `empty-line` allows space-only lines.
no-space-check=trailing-comma,dict-separator

# Maximum number of lines in a module
max-module-lines=1000

Expand Down Expand Up @@ -170,7 +143,7 @@ ignore-comments=yes
ignore-docstrings=yes

# Ignore imports when computing similarities.
ignore-imports=no
ignore-imports=yes


[VARIABLES]
Expand All @@ -193,9 +166,6 @@ callbacks=cb_,_cb,on_,_on_

[BASIC]

# List of builtins function names that should not be used, separated by a comma
bad-functions=print

# Good variable names which should always be accepted, separated by a comma
good-names=ex,Run,_,a,c,d,e,i,j,k,m,n,o,p,t,u,v,w,x,y,A,X,Y,M

Expand All @@ -212,53 +182,33 @@ include-naming-hint=yes
# Regular expression matching correct method names
# TODO: find a better way to allow long method names in test classes.
method-rgx=[a-z_][a-zA-Z0-9_]{2,80}$
# Naming hint for method names
method-name-hint=[a-z_][a-zA-Z0-9_]{2,30}$

# Regular expression matching correct class names
class-rgx=[A-Z_][a-zA-Z0-9]{2,30}$
# Naming hint for class names
class-name-hint=[A-Z_][a-zA-Z0-9]{2,30}$

# Regular expression matching correct module names
module-rgx=([a-z_][a-z0-9_]{2,30})$
# Naming hint for module names
module-name-hint=([a-z_][a-z0-9_]{2,30})$

# Regular expression matching correct class attribute names
class-attribute-rgx=[A-Za-z_][A-Za-z0-9_]{2,30}$
# Naming hint for class attribute names
class-attribute-name-hint=[A-Za-z_][A-Za-z0-9_]{2,30}$

# Regular expression matching correct constant names
const-rgx=[A-Za-z_][A-Za-z0-9_]+$
# Naming hint for constant names
const-name-hint=[A-Za-z_][A-Za-z0-9_]+$

# Regular expression matching correct function names
function-rgx=[a-z_][a-zA-Z0-9_]{2,30}$
# Naming hint for function names
function-name-hint=[a-z_][a-zA-Z0-9_]{2,30}$

# Regular expression matching correct variable names
variable-rgx=[a-zA-Z_][a-zA-Z0-9_]{0,30}$
# Naming hint for variable names
variable-name-hint=[a-zA-Z_][a-zA-Z0-9_]{0,30}$

# Regular expression matching correct attribute names
attr-rgx=[a-z_][a-zA-Z0-9_]*$
# Naming hint for attribute names
attr-name-hint=[a-z_][a-zA-Z0-9_]{2,30}$

# Regular expression matching correct inline iteration names
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
# Naming hint for inline iteration names
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$

# Regular expression matching correct argument names
argument-rgx=[a-z_][a-zA-Z0-9_]*$
# Naming hint for argument names
argument-name-hint=[a-z_][a-zA-Z0-9_]{2,30}$

# Regular expression which should only match function or class names that do
# not require a docstring.
Expand All @@ -279,7 +229,7 @@ max-nested-blocks=5

# Tells whether missing members accessed in mixin class should be ignored. A
# mixin class is detected if its name ends with "mixin" (case insensitive).
ignore-mixin-members=yes
ignored-checks-for-mixins=no-member

# List of module names for which member attributes should not be checked
# (useful for modules/projects where namespaces are manipulated during runtime
Expand Down Expand Up @@ -379,4 +329,7 @@ int-import-graph=

# Exceptions that will emit a warning when being caught. Defaults to
# "Exception"
overgeneral-exceptions=Exception
overgeneral-exceptions=builtins.Exception

[isort]
known-standard-library=
14 changes: 6 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
[tox]
envlist =
py{38,39}-orange-{oldest, latest, released}
orange-{oldest, latest, released}
pylint-ci
skip_missing_interpreters = true
isolated_build = true
toxworkdir={env:TOX_WORK_DIR:.tox}

[testenv]
# must use latest pip (version 20.3.1 enables Big Sur support - https://github.com/pypa/pip/issues/9138)
pip_version = pip
download = true
extras = test
passenv = *
# we MUST changedir to avoid installed being shadowed by working dir
Expand All @@ -21,8 +19,8 @@ setenv =
COVERAGE_FILE = {toxinidir}/.coverage
COVERAGE_RCFILE = {toxinidir}/.coveragerc
deps =
pyqt5==5.12.*
pyqtwebengine==5.12.*
{env:PYQT_PYPI_NAME:PyQt5}=={env:PYQT_PYPI_VERSION:5.15.*}
{env:WEBENGINE_PYPI_NAME:PyQtWebEngine}=={env:WEBENGINE_PYPI_VERSION:5.15.*}
oldest: orange3==3.34.0
oldest: orange-canvas-core==0.1.28
oldest: orange-widget-base==4.19.0
Expand All @@ -37,10 +35,10 @@ deps =
latest: https://github.com/biolab/orange-canvas-core/archive/refs/heads/master.zip#egg=orange-canvas-core
latest: https://github.com/biolab/orange-widget-base/archive/refs/heads/master.zip#egg=orange-widget-base
opusFC
# temporary util the new Orange is released
pandas<2.1
dask: https://github.com/biolab/orange3/archive/refs/heads/dask.zip#egg=orange3
commands_pre =
# check pip version in virtualenv
pip --version
# Verify installed packages have compatible dependencies
pip check
# freeze environment
Expand Down
Loading