-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move it from tasks/ into test/ as it involves more than the tasks container, and could e.g. also grow integration tests for metrics. Also set up ruff and mypy static code checks, and add a pyproject.toml configuration for these.
- Loading branch information
1 parent
e7aaad9
commit 4148c63
Showing
9 changed files
with
796 additions
and
629 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,9 +10,11 @@ jobs: | |
- name: Install dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y make python3-pyflakes python3-pycodestyle | ||
sudo apt-get install -y make python3-pyflakes python3-pycodestyle python3-pip python3-pytest | ||
# `pip install .[test]` does not work properly on Ubuntu 22.04 | ||
sudo pip install ruff mypy types-PyYAML | ||
- name: Run unit tests | ||
- name: Run lint tests | ||
run: make check | ||
|
||
tasks: | ||
|
@@ -35,6 +37,11 @@ jobs: | |
git config user.email [email protected] | ||
git rebase origin/main | ||
- name: Install test dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y make python3-pytest | ||
# HACK: Ubuntu 22.04 has podman 3.4, which isn't compatible with podman-remote 4 in our tasks container | ||
# This PPA is a backport of podman 4.3 from Debian 12; drop this when moving `runs-on:` to ubuntu-24.04 | ||
- name: Update to newer podman | ||
|
@@ -57,6 +64,6 @@ jobs: | |
|
||
- name: Test local deployment | ||
run: | | ||
echo '${{ secrets.GITHUB_TOKEN }}' > ~/.config/github-token | ||
echo '${{ secrets.GITHUB_TOKEN }}' > github-token | ||
PRN=$(echo "$GITHUB_REF" | cut -f3 -d '/') | ||
tasks/run-local.sh -p $PRN -t ~/.config/github-token | ||
python3 -m pytest -vv --pr $PRN --pr-repository '${{ github.repository }}' --github-token=github-token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
[project] | ||
name = "cockpituous" | ||
description = "Cockpit CI infrastructure" | ||
classifiers = [ | ||
"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)" | ||
] | ||
|
||
dependencies = [ | ||
"pyyaml", | ||
] | ||
|
||
version = "1" | ||
|
||
[project.optional-dependencies] | ||
test = [ | ||
"ruff", | ||
"mypy", | ||
"pytest", | ||
"types-PyYAML", | ||
] | ||
|
||
[tool.setuptools] | ||
packages = [] | ||
|
||
[tool.pytest.ini_options] | ||
addopts = "-m 'not shell'" | ||
markers = [ | ||
"shell: interactive shell for development, skipped on normal runs", | ||
] | ||
|
||
[tool.ruff] | ||
exclude = [ | ||
".git/", | ||
] | ||
line-length = 118 | ||
src = [] | ||
|
||
[tool.ruff.lint] | ||
select = [ | ||
"A", # flake8-builtins | ||
"B", # flake8-bugbear | ||
"C4", # flake8-comprehensions | ||
"D300", # pydocstyle: Forbid ''' in docstrings | ||
"DTZ", # flake8-datetimez | ||
"E", # pycodestyle | ||
"EXE", # flake8-executable | ||
"F", # pyflakes | ||
"FBT", # flake8-boolean-trap | ||
"G", # flake8-logging-format | ||
"I", # isort | ||
"ICN", # flake8-import-conventions | ||
"ISC", # flake8-implicit-str-concat | ||
"PIE", # flake8-pie | ||
"PLE", # pylint errors | ||
"PGH", # pygrep-hooks | ||
"PT", # flake8-pytest-style | ||
"RSE", # flake8-raise | ||
"RUF", # ruff rules | ||
"T10", # flake8-debugger | ||
"TCH", # flake8-type-checking | ||
"UP032", # f-string | ||
"W", # warnings (mostly whitespace) | ||
"YTT", # flake8-2020 | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.