From a9e11ecf9da45d943bfba7daf0603880a6ac3b38 Mon Sep 17 00:00:00 2001 From: Vitor Hideyoshi Date: Tue, 23 Sep 2025 03:58:14 -0300 Subject: [PATCH] chore: updates project config --- ...test-and-build.yml => build-and-uplod.yml} | 30 +++------------- .github/workflows/run-tests.yml | 36 +++++++++++++++++++ poetry.toml | 2 ++ pyproject.toml | 26 +++++++++++--- 4 files changed, 64 insertions(+), 30 deletions(-) rename .github/workflows/{python-test-and-build.yml => build-and-uplod.yml} (66%) create mode 100644 .github/workflows/run-tests.yml create mode 100644 poetry.toml diff --git a/.github/workflows/python-test-and-build.yml b/.github/workflows/build-and-uplod.yml similarity index 66% rename from .github/workflows/python-test-and-build.yml rename to .github/workflows/build-and-uplod.yml index 857101f..201a3e0 100644 --- a/.github/workflows/python-test-and-build.yml +++ b/.github/workflows/build-and-uplod.yml @@ -1,40 +1,20 @@ # This workflow will install Python dependencies, run tests and lint with a single version of Python # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python -name: Upload DicePlayer to PyPI +name: Build and Upload to PyPI on: - push + push: + tags: + - 'v*' permissions: contents: read jobs: - - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: Install poetry - run: pipx install poetry - - - name: Set up Python 3.10 - uses: actions/setup-python@v3 - with: - python-version: "3.10" - - name: Install dependencies - run: | - poetry self add "poetry-dynamic-versioning[plugin]" - if [ -f pyproject.toml ]; then poetry install; fi - - name: Run unittest - run: | - poetry run python -m unittest - pypi-upload: needs: [test] - if: startsWith(github.ref, 'refs/tags/v') + if: github.ref == 'refs/heads/main' runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml new file mode 100644 index 0000000..9994e67 --- /dev/null +++ b/.github/workflows/run-tests.yml @@ -0,0 +1,36 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: Run Tests + +on: + push + +permissions: + contents: read + +jobs: + + test: + runs-on: ubuntu-latest + strategy: + matrix: + python: ["3.10", "3.11", "3.12"] + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Install poetry + run: pipx install poetry + + - name: Set up Python 3.10 + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: | + poetry self add "poetry-dynamic-versioning[plugin]" + if [ -f pyproject.toml ]; then poetry install; fi + - name: Run unittest + run: | + poetry run python -m unittest diff --git a/poetry.toml b/poetry.toml new file mode 100644 index 0000000..ab1033b --- /dev/null +++ b/poetry.toml @@ -0,0 +1,2 @@ +[virtualenvs] +in-project = true diff --git a/pyproject.toml b/pyproject.toml index 3ee0aec..d9e3c51 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,10 +1,27 @@ -[tool.poetry] +[project] name = "diceplayer" version = "0.0.0" description = "" -authors = ["Vitor Hideyoshi ", "Herbert Georg "] +authors = [ + {name="Vitor Hideyoshi", email="vitor.h.n.batista@gmail.com"}, + {name="Herbert Georg", email="hcgeorg@ufg.br"} +] license = "GPL-2.0-only" readme = "README.md" +dynamic = [ + "dependencies", + "requires-python" +] + +[project.scripts] +diceplayer = "diceplayer.__main__:main" + + +# POETRY +[tool.poetry] +packages = [ + { include = "diceplayer" } +] [tool.poetry.dependencies] python = ">=3.9,<4.0" @@ -14,9 +31,6 @@ setproctitle = "^1.3.2" pyyaml = "^6.0" nptyping = "^2.5.0" -[tool.poetry.scripts] -diceplayer = "diceplayer.__main__:main" - [tool.poetry.group.dev.dependencies] coverage = "^7.2.7" isort = "^5.13.2" @@ -32,6 +46,8 @@ vcs = "git" requires = ["poetry-core"] build-backend = "poetry_dynamic_versioning.backend" + +# UTILS [tool.poe.tasks] hooks = "pre-commit install --config .pre-commit-config.yaml"