Skip to content

Commit 56e80fe

Browse files
committed
ci: make sure the build fails on failing unit tests
Also refactored tests
1 parent bec4f01 commit 56e80fe

File tree

18 files changed

+400
-74
lines changed

18 files changed

+400
-74
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ jobs:
6767
- name: 🚀 Run test suite
6868
run: |
6969
pytest | tee report.txt
70+
pytest_exit=${PIPESTATUS[0]}
7071
7172
# generate summary
7273
python=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:3])))')
@@ -89,6 +90,9 @@ jobs:
8990
</details>
9091
EOF
9192
93+
# make sure we fail if pytest fails!
94+
exit $pytest_exit
95+
9296
test-install:
9397
name: 🧪 Installation test
9498
strategy:
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include README.md
2+
recursive-include octoprint_requestspinner/templates *
3+
recursive-include octoprint_requestspinner/translations *
4+
recursive-include octoprint_requestspinner/static *
File renamed without changes.
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
2+
# Taskfile to be used with task: https://taskfile.dev
3+
#
4+
# A copy of task gets automatically installed as a "develop" dependency this plugin:
5+
#
6+
# pip install .[develop]
7+
# go-task --list-all
8+
#
9+
10+
version: "3"
11+
12+
env:
13+
LOCALES: [] # list your included locales here, e.g. ["de", "fr"]
14+
TRANSLATIONS: "octoprint_requestspinner/translations" # translations folder
15+
16+
17+
tasks:
18+
install:
19+
desc: Installs the plugin into the current venv
20+
cmds:
21+
- "python -m pip install -e .[develop]"
22+
23+
### Build related
24+
25+
build:
26+
desc: Builds sdist & wheel
27+
cmds:
28+
- python -m build --sdist --wheel
29+
30+
build-sdist:
31+
desc: Builds sdist
32+
cmds:
33+
- python -m build --sdist
34+
35+
build-wheel:
36+
desc: Builds wheel
37+
cmds:
38+
- python -m build --wheel
39+
40+
### Translation related
41+
42+
babel-new:
43+
desc: Create a new translation for a locale
44+
cmds:
45+
- task: babel-extract
46+
- pybabel init --input-file=translations/messages.pot --output-dir=translations --locale="{{ .CLI_ARGS }}"
47+
48+
babel-extract:
49+
desc: Update pot file from source
50+
cmds:
51+
- pybabel extract --mapping-file=babel.cfg --output-file=translations/messages.pot --msgid-bugs-address=i18n@octoprint.org --copyright-holder="The OctoPrint Project" .
52+
53+
babel-update:
54+
desc: Update translation files from pot file
55+
cmds:
56+
- for:
57+
var: LOCALES
58+
cmd: pybabel update --input-file=translations/messages.pot --output-dir=translations --locale={{ .ITEM }}
59+
60+
babel-refresh:
61+
desc: Update translation files from source
62+
cmds:
63+
- task: babel-extract
64+
- task: babel-update
65+
66+
babel-compile:
67+
desc: Compile translation files
68+
cmds:
69+
- pybabel compile --directory=translations
70+
71+
babel-bundle:
72+
desc: Bundle translations
73+
preconditions:
74+
- test -d {{ .TRANSLATIONS }}
75+
cmds:
76+
- for:
77+
var: LOCALES
78+
cmd: |
79+
locale="{{ .ITEM }}"
80+
source="translations/${locale}"
81+
target="{{ .TRANSLATIONS }}/${locale}"
82+
83+
[ ! -d "${target}" ] || rm -r "${target}"
84+
85+
echo "Copying translations for locale ${locale} from ${source} to ${target}..."
86+
cp -r "${source}" "${target}"
87+
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
[build-system]
2+
requires = [
3+
"setuptools>=68",
4+
]
5+
build-backend = "setuptools.build_meta"
6+
7+
[project]
8+
name = "OctoPrint-RequestSpinner"
9+
version = "0.2.0"
10+
description = "Shows a little spinner in the web frontend when background requests are active"
11+
authors = [
12+
{ name = "Gina Häußge", email = "osd@foosel.net" },
13+
]
14+
requires-python = ">=3.7,<4"
15+
dependencies = []
16+
dynamic = [
17+
"license",
18+
]
19+
20+
[project.entry-points."octoprint.plugin"]
21+
requestspinner = "octoprint_requestspinner"
22+
23+
[project.urls]
24+
Homepage = "https://github.com/OctoPrint/OctoPrint-RequestSpinner"
25+
26+
[project.optional-dependencies]
27+
develop = [
28+
"go-task-bin",
29+
]
30+
31+
[project.readme]
32+
file = "README.md"
33+
content-type = "text/markdown"
34+
35+
[tool.setuptools]
36+
include-package-data = true
37+
38+
[tool.setuptools.packages.find]
39+
include = [
40+
"octoprint_requestspinner",
41+
"octoprint_requestspinner.*",
42+
]
43+
44+
[tool.ruff]
45+
exclude = [
46+
".bzr",
47+
".direnv",
48+
".eggs",
49+
".git",
50+
".git-rewrite",
51+
".hg",
52+
".ipynb_checkpoints",
53+
".mypy_cache",
54+
".nox",
55+
".pants.d",
56+
".pyenv",
57+
".pytest_cache",
58+
".pytype",
59+
".ruff_cache",
60+
".svn",
61+
".tox",
62+
".venv",
63+
".vscode",
64+
"__pypackages__",
65+
"_build",
66+
"buck-out",
67+
"build",
68+
"dist",
69+
"node_modules",
70+
"site-packages",
71+
"venv",
72+
]
73+
line-length = 90
74+
indent-width = 4
75+
target-version = "py37"
76+
77+
[tool.ruff.lint]
78+
select = [
79+
"B",
80+
"C",
81+
"E",
82+
"F",
83+
"I",
84+
"W",
85+
"B9",
86+
]
87+
ignore = [
88+
"E203",
89+
"E231",
90+
"E265",
91+
"E266",
92+
"E402",
93+
"E501",
94+
"E731",
95+
"E741",
96+
"W605",
97+
"C901",
98+
]
99+
fixable = [
100+
"I",
101+
"C4",
102+
"E",
103+
]
104+
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
105+
106+
[tool.ruff.lint.isort]
107+
known-first-party = [
108+
"octoprint_file_check",
109+
]
110+
111+
[tool.ruff.format]
112+
quote-style = "double"
113+
indent-style = "space"
114+
skip-magic-trailing-comma = false
115+
line-ending = "lf"
116+
docstring-code-format = false
117+
docstring-code-line-length = "dynamic"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
import setuptools
3+
4+
# we define the license string like this to be backwards compatible to setuptools<77
5+
setuptools.setup(license="AGPL-3.0-or-later")
6+
File renamed without changes.

0 commit comments

Comments
 (0)