diff --git a/.github/workflows/build-py-wheel.yml b/.github/workflows/build-py-wheel.yml new file mode 100644 index 0000000..e76f995 --- /dev/null +++ b/.github/workflows/build-py-wheel.yml @@ -0,0 +1,52 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Build python wheel + +on: + push: + branches: [beta] + pull_request: + branches: [beta] + +jobs: + ci: + strategy: + fail-fast: false + matrix: + python-version: ["3.12"] + os: [ubuntu-22.04] + runs-on: ${{matrix.os}} + steps: + - uses: actions/checkout@v4 + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: ${{matrix.python-version}} + - name: Install Poetry + uses: abatilo/actions-poetry@v2 + - name: Set up local virtual environment + run: | + poetry config virtualenvs.create true --local + poetry config virtualenvs.in-project true --local + - name: Cache packages + uses: actions/cache@v4 + with: + # This path is specific to ubuntu + path: ./.venv + key: venv-${{ hashFiles('poetry.lock') }} + - name: Install dependencies + run: | + sudo apt install qt6-base-dev libsystemd-dev gcc + poetry install + - name: Compile ui, translations and resources + run: poetry run ./scripts/build_ui.sh + - name: Lint with flake8 + run: | + # stop the build if there are Python syntax errors or undefined names + poetry run flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide + poetry run flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + - name: Test with pytest + run: | + poetry run pytest -v diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index c8e0e14..ded4215 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -5,21 +5,20 @@ name: Python application on: push: - branches: [ master ] + branches: [master] pull_request: - branches: [ master ] + branches: [master] jobs: build: - runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - - name: Set up Python 3.10 + - name: Set up Python 3.12 uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: "3.12" - name: Cache pip uses: actions/cache@v4 with: @@ -36,7 +35,7 @@ jobs: pip install flake8 pytest if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Compile ui, translations and resources - run: ./scripts/build_ui.sh + run: poetry run ./scripts/build_ui.sh - name: Lint with flake8 run: | # stop the build if there are Python syntax errors or undefined names diff --git a/poetry.lock b/poetry.lock index c240073..ec8b118 100644 --- a/poetry.lock +++ b/poetry.lock @@ -110,6 +110,22 @@ files = [ {file = "charset_normalizer-3.3.2-py3-none-any.whl", hash = "sha256:3e4d1f6587322d2788836a99c69062fbb091331ec940e02d12d179c1d53e25fc"}, ] +[[package]] +name = "flake8" +version = "7.0.0" +description = "the modular source code checker: pep8 pyflakes and co" +optional = false +python-versions = ">=3.8.1" +files = [ + {file = "flake8-7.0.0-py2.py3-none-any.whl", hash = "sha256:a6dfbb75e03252917f2473ea9653f7cd799c3064e54d4c8140044c5c065f53c3"}, + {file = "flake8-7.0.0.tar.gz", hash = "sha256:33f96621059e65eec474169085dc92bf26e7b2d47366b70be2f67ab80dc25132"}, +] + +[package.dependencies] +mccabe = ">=0.7.0,<0.8.0" +pycodestyle = ">=2.11.0,<2.12.0" +pyflakes = ">=3.2.0,<3.3.0" + [[package]] name = "idna" version = "3.6" @@ -121,6 +137,17 @@ files = [ {file = "idna-3.6.tar.gz", hash = "sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca"}, ] +[[package]] +name = "mccabe" +version = "0.7.0" +description = "McCabe checker, plugin for flake8" +optional = false +python-versions = ">=3.6" +files = [ + {file = "mccabe-0.7.0-py2.py3-none-any.whl", hash = "sha256:6c2d30ab6be0e4a46919781807b4f0d834ebdd6c6e3dca0bda5a15f863427b6e"}, + {file = "mccabe-0.7.0.tar.gz", hash = "sha256:348e0240c33b60bbdf4e523192ef919f28cb2c3d7d5c7794f74009290f236325"}, +] + [[package]] name = "psutil" version = "5.9.8" @@ -149,6 +176,28 @@ files = [ [package.extras] test = ["enum34", "ipaddress", "mock", "pywin32", "wmi"] +[[package]] +name = "pycodestyle" +version = "2.11.1" +description = "Python style guide checker" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pycodestyle-2.11.1-py2.py3-none-any.whl", hash = "sha256:44fe31000b2d866f2e41841b18528a505fbd7fef9017b04eff4e2648a0fadc67"}, + {file = "pycodestyle-2.11.1.tar.gz", hash = "sha256:41ba0e7afc9752dfb53ced5489e89f8186be00e599e712660695b7a75ff2663f"}, +] + +[[package]] +name = "pyflakes" +version = "3.2.0" +description = "passive checker of Python programs" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pyflakes-3.2.0-py2.py3-none-any.whl", hash = "sha256:84b5be138a2dfbb40689ca07e2152deb896a65c3a3e24c251c5c62489568074a"}, + {file = "pyflakes-3.2.0.tar.gz", hash = "sha256:1c61603ff154621fb2a9172037d84dca3500def8c8b630657d1701f026f8af3f"}, +] + [[package]] name = "pyside6-addons" version = "6.6.3.1" @@ -285,4 +334,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.0" python-versions = "^3.12,<3.13" -content-hash = "8c7f84db2e721ffb9024aa032d75e4010fa788f407fd6ed82c53152443114379" +content-hash = "3d512dc5993c5d1c45181c93e9de79c5b365756675fc60ddceeed5b3f6d71da6" diff --git a/pyproject.toml b/pyproject.toml index bd6a66f..d8704d8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,6 +20,9 @@ systemd-python = "235" requests = "2.31.0" +[tool.poetry.group.DEV.dependencies] +flake8 = "^7.0.0" + [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" \ No newline at end of file