diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index b16b94b..158238d 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -45,9 +45,7 @@ jobs: shell: bash run: | python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade \ - -r requirements.txt \ - -r requirements-dev.txt + python -m pip install --upgrade -e ".[dev]" - name: Install Node Dependencies shell: bash @@ -78,18 +76,7 @@ jobs: echo "::endgroup::" echo "::group::Run Python Tests" - python -m pytest \ - -rxXs \ - --tb=native \ - --verbose \ - --color=yes \ - --cov=actions \ - --cov-report=term \ - --cov-report=xml:coverage/python-coverage.xml \ - --cov-report=json:coverage/python-coverage.json \ - --junitxml=junit-python.xml \ - -o junit_family=legacy \ - tests + python -m pytest echo "::endgroup::" - name: Test with Jest diff --git a/actions/facebook_post/Dockerfile b/actions/facebook_post/Dockerfile index 0d934ad..d8f1b08 100644 --- a/actions/facebook_post/Dockerfile +++ b/actions/facebook_post/Dockerfile @@ -5,7 +5,7 @@ RUN python -m pip install --no-cache-dir --upgrade pip setuptools wheel COPY . /app WORKDIR /app -RUN python -m pip install --no-cache-dir --upgrade -r requirements.txt +RUN python -m pip install --no-cache-dir --upgrade . # github will mount the `GITHUB_WORKSPACE` directory to /github/workspace # https://docs.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions#workdir diff --git a/actions/facebook_post/pyproject.toml b/actions/facebook_post/pyproject.toml new file mode 100644 index 0000000..5c23850 --- /dev/null +++ b/actions/facebook_post/pyproject.toml @@ -0,0 +1,18 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "lizardbyte-actions-facebook-post" +version = "0.0.0" +description = "Facebook post action for GitHub workflows." +requires-python = ">=3.12" + +dependencies = [ + "python-dotenv==1.2.1", + "requests==2.32.5", +] + +[tool.setuptools.packages.find] +where = ["."] +include = [] diff --git a/actions/facebook_post/requirements.txt b/actions/facebook_post/requirements.txt deleted file mode 100644 index d2c6cda..0000000 --- a/actions/facebook_post/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -python-dotenv==1.2.1 -requests==2.32.5 diff --git a/actions/release_homebrew/action.yml b/actions/release_homebrew/action.yml index 008c125..f0058ab 100644 --- a/actions/release_homebrew/action.yml +++ b/actions/release_homebrew/action.yml @@ -138,7 +138,7 @@ runs: run: | echo "::group::Install Python Requirements" # install requirements required for this action to complete - "${{ steps.venv.outputs.python-path }}" -m pip install -r requirements.txt + "${{ steps.venv.outputs.python-path }}" -m pip install . echo "::endgroup::" - name: Checkout (org homebrew repo) diff --git a/actions/release_homebrew/pyproject.toml b/actions/release_homebrew/pyproject.toml new file mode 100644 index 0000000..23f25a0 --- /dev/null +++ b/actions/release_homebrew/pyproject.toml @@ -0,0 +1,17 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "lizardbyte-actions-release-homebrew" +version = "0.0.0" +description = "Release Homebrew action for GitHub workflows." +requires-python = ">=3.11" + +dependencies = [ + "python-dotenv==1.2.1", +] + +[tool.setuptools.packages.find] +where = ["."] +include = [] diff --git a/actions/release_homebrew/requirements.txt b/actions/release_homebrew/requirements.txt deleted file mode 100644 index af16912..0000000 --- a/actions/release_homebrew/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -python-dotenv==1.2.1 diff --git a/actions/release_setup/Dockerfile b/actions/release_setup/Dockerfile index 0d934ad..d8f1b08 100644 --- a/actions/release_setup/Dockerfile +++ b/actions/release_setup/Dockerfile @@ -5,7 +5,7 @@ RUN python -m pip install --no-cache-dir --upgrade pip setuptools wheel COPY . /app WORKDIR /app -RUN python -m pip install --no-cache-dir --upgrade -r requirements.txt +RUN python -m pip install --no-cache-dir --upgrade . # github will mount the `GITHUB_WORKSPACE` directory to /github/workspace # https://docs.github.com/en/actions/creating-actions/dockerfile-support-for-github-actions#workdir diff --git a/actions/release_setup/pyproject.toml b/actions/release_setup/pyproject.toml new file mode 100644 index 0000000..4076439 --- /dev/null +++ b/actions/release_setup/pyproject.toml @@ -0,0 +1,18 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "lizardbyte-actions-release-setup" +version = "0.0.0" +description = "Release setup action for GitHub workflows." +requires-python = ">=3.12" + +dependencies = [ + "python-dotenv==1.2.1", + "requests==2.32.5", +] + +[tool.setuptools.packages.find] +where = ["."] +include = [] diff --git a/actions/release_setup/requirements.txt b/actions/release_setup/requirements.txt deleted file mode 100644 index d2c6cda..0000000 --- a/actions/release_setup/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -python-dotenv==1.2.1 -requests==2.32.5 diff --git a/actions/setup_python/post-ci.sh b/actions/setup_python/post-ci.sh index cb8b42c..10c8092 100644 --- a/actions/setup_python/post-ci.sh +++ b/actions/setup_python/post-ci.sh @@ -26,13 +26,14 @@ if [[ -n "$WITH_PARAMS" ]]; then # setup python python -m pip install --upgrade pip setuptools wheel - python -m pip install --upgrade -r requirements-dev.txt + python -m pip install --upgrade "${SCRIPT_DIR}[dev]" python -m pytest \ -rxXs \ --tb=native \ --verbose \ --color=yes \ + -c "${SCRIPT_DIR}/pyproject.toml" \ tests/setup_python else echo "Error: WITH_PARAMS environment variable not set" >&2 diff --git a/actions/setup_python/pyproject.toml b/actions/setup_python/pyproject.toml new file mode 100644 index 0000000..41c0939 --- /dev/null +++ b/actions/setup_python/pyproject.toml @@ -0,0 +1,23 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "lizardbyte-actions-setup-python" +version = "0.0.0" +description = "Setup Python action for GitHub workflows." + +dependencies = [] + +[project.optional-dependencies] +dev = [ + "pytest==4.6.11;python_version<'3.5'", + "pytest==6.1.2;python_version>='3.5' and python_version<'3.6'", + "pytest==7.0.1;python_version>='3.6' and python_version<'3.7'", + "pytest==8.3.5;python_version>='3.7' and python_version<'3.9'", + "pytest==9.0.2;python_version>='3.9'", +] + +[tool.setuptools.packages.find] +where = ["."] +include = [] diff --git a/actions/setup_python/setup.py b/actions/setup_python/setup.py new file mode 100644 index 0000000..08e2954 --- /dev/null +++ b/actions/setup_python/setup.py @@ -0,0 +1,13 @@ +from setuptools import setup + +setup( + extras_require={ + "dev": [ + "pytest==4.6.11;python_version<'3.5'", + "pytest==6.1.2;python_version>='3.5' and python_version<'3.6'", + "pytest==7.0.1;python_version>='3.6' and python_version<'3.7'", + "pytest==8.3.5;python_version>='3.7' and python_version<'3.9'", + "pytest==9.0.2;python_version>='3.9'", + ], + }, +) diff --git a/actions/setup_virtual_desktop/pyproject.toml b/actions/setup_virtual_desktop/pyproject.toml new file mode 100644 index 0000000..ff35aeb --- /dev/null +++ b/actions/setup_virtual_desktop/pyproject.toml @@ -0,0 +1,19 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "lizardbyte-actions-setup-virtual-desktop" +version = "0.0.0" +description = "Setup virtual desktop action for GitHub workflows." +requires-python = ">=3.12" + +dependencies = [ + # PyGObject provides Python bindings for GObject-based libraries like GTK and AppIndicator + # Only install on Linux where AppIndicator/Ayatana is available + "pygobject==3.54.5;sys_platform=='linux'", +] + +[tool.setuptools.packages.find] +where = ["."] +include = [] diff --git a/actions/setup_virtual_desktop/requirements.txt b/actions/setup_virtual_desktop/requirements.txt deleted file mode 100644 index 92bc560..0000000 --- a/actions/setup_virtual_desktop/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Python dependencies for test_appindicator.py -# PyGObject provides Python bindings for GObject-based libraries like GTK and AppIndicator -# Only install on Linux where AppIndicator/Ayatana is available -pygobject==3.54.5; sys_platform == 'linux' diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b38c182 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,70 @@ +[build-system] +requires = ["setuptools", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "lizardbyte-actions" +version = "0.0.0" +description = "Reusable actions for GitHub workflows." +readme = "README.md" +license = "MIT" +authors = [ + {name = "LizardByte", email = "lizardbyte@users.noreply.github.com"} +] + +dependencies = [ + "lizardbyte-actions-facebook-post @ file:./actions/facebook_post", + "lizardbyte-actions-release-homebrew @ file:./actions/release_homebrew", + "lizardbyte-actions-release-setup @ file:./actions/release_setup", +] + +[project.optional-dependencies] +dev = [ + "pytest==9.0.2", + "pytest-cov==7.0.0", +] + +[project.urls] +Homepage = "https://github.com/LizardByte/actions#readme" +Repository = "https://github.com/LizardByte/actions" +Issues = "https://github.com/LizardByte/actions/issues" + +[tool.setuptools.packages.find] +include = ["actions*"] + +[tool.pytest.ini_options] +testpaths = ["tests"] +pythonpath = ["."] +python_files = ["test_*.py"] +python_classes = ["Test*"] +python_functions = ["test_*"] +addopts = [ + "-rxXs", + "--tb=native", + "--verbose", + "--color=yes", + "--cov=actions", + "--cov-report=term", + "--cov-report=xml:coverage/python-coverage.xml", + "--cov-report=json:coverage/python-coverage.json", + "--junitxml=junit-python.xml", + "-o", "junit_family=legacy", +] + +[tool.coverage.run] +source = ["actions"] +omit = [ + "*/tests/*", + "*/__pycache__/*", +] + +[tool.coverage.report] +exclude_lines = [ + "pragma: no cover", + "def __repr__", + "raise AssertionError", + "raise NotImplementedError", + "if __name__ == .__main__.:", + "if TYPE_CHECKING:", + "@abstractmethod", +] diff --git a/requirements-dev.txt b/requirements-dev.txt deleted file mode 100644 index cb9c340..0000000 --- a/requirements-dev.txt +++ /dev/null @@ -1,6 +0,0 @@ -pytest==4.6.11;python_version<"3.5" -pytest==6.1.2;python_version>="3.5" and python_version<"3.6" -pytest==7.0.1;python_version>="3.6" and python_version<"3.7" -pytest==8.3.5;python_version>="3.7" and python_version<"3.9" -pytest==9.0.2;python_version>="3.9" -pytest-cov==7.0.0;python_version>="3.9" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index aa225b6..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ --r ./actions/facebook_post/requirements.txt --r ./actions/release_homebrew/requirements.txt --r ./actions/release_setup/requirements.txt