Updates Versioning Pipeline
This commit is contained in:
35
.github/workflows/python-pypi-test-upload.yml
vendored
35
.github/workflows/python-pypi-test-upload.yml
vendored
@@ -1,35 +0,0 @@
|
|||||||
# 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 CrystalPol to PyPI Test
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ devel ]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
pypi-upload-test:
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Set up Python 3.8
|
|
||||||
uses: actions/setup-python@v3
|
|
||||||
with:
|
|
||||||
python-version: "3.8"
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip poetry
|
|
||||||
python -m poetry install
|
|
||||||
- name: Test with unittest
|
|
||||||
run: |
|
|
||||||
python -m poetry run python -m unittest -v
|
|
||||||
- name: Upload Pip Package
|
|
||||||
run: |
|
|
||||||
python -m poetry config repositories.testpypi https://test.pypi.org/legacy/
|
|
||||||
python -m poetry publish --build --username __token__ --password ${{secrets.PYPI_TEST_TOKEN}} --repository testpypi
|
|
||||||
35
.github/workflows/python-pypi-upload.yml
vendored
35
.github/workflows/python-pypi-upload.yml
vendored
@@ -1,35 +0,0 @@
|
|||||||
# 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 CrystalPol to PyPI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [ main ]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
pypi-upload:
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- name: Set up Python 3.8
|
|
||||||
uses: actions/setup-python@v3
|
|
||||||
with:
|
|
||||||
python-version: "3.8"
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip poetry
|
|
||||||
python -m poetry install
|
|
||||||
- name: Test with unittest
|
|
||||||
run: |
|
|
||||||
python -m poetry run python -m unittest -v
|
|
||||||
- name: Upload Pip Package
|
|
||||||
run: |
|
|
||||||
python -m poetry config repositories.pypi https://upload.pypi.org/legacy/
|
|
||||||
python -m poetry publish --build --username __token__ --password ${{secrets.PYPI_TOKEN}} --repository pypi
|
|
||||||
65
.github/workflows/python-test-and-build.yml
vendored
Normal file
65
.github/workflows/python-test-and-build.yml
vendored
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
# 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
|
||||||
|
|
||||||
|
on:
|
||||||
|
push
|
||||||
|
|
||||||
|
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')
|
||||||
|
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: Build Python Package
|
||||||
|
run: |
|
||||||
|
poetry build -f sdist
|
||||||
|
poetry install
|
||||||
|
echo "Builded yoshi-seals - $(poetry version)"
|
||||||
|
- name: Configure PyPI
|
||||||
|
run: |
|
||||||
|
poetry config repositories.pypi https://upload.pypi.org/legacy/
|
||||||
|
poetry config pypi-token.pypi ${{secrets.PYPI_TOKEN}}
|
||||||
|
- name: Upload Python Package
|
||||||
|
run: |
|
||||||
|
poetry publish --repository pypi
|
||||||
30
.github/workflows/python-tests.yml
vendored
30
.github/workflows/python-tests.yml
vendored
@@ -1,30 +0,0 @@
|
|||||||
# 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: Python application
|
|
||||||
|
|
||||||
on:
|
|
||||||
push
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
run-unitest:
|
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Set up Python 3.8
|
|
||||||
uses: actions/setup-python@v3
|
|
||||||
with:
|
|
||||||
python-version: "3.8"
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip poetry
|
|
||||||
python -m poetry install
|
|
||||||
- name: Test with unittest
|
|
||||||
run: |
|
|
||||||
poetry run python -m unittest -v
|
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
from diceplayer.shared.utils.logger import Logger
|
from diceplayer.shared.utils.logger import Logger
|
||||||
|
|
||||||
|
from importlib import metadata
|
||||||
|
|
||||||
|
VERSION = metadata.version("diceplayer")
|
||||||
|
|
||||||
logger = Logger(__name__)
|
logger = Logger(__name__)
|
||||||
|
|||||||
@@ -1,14 +1,8 @@
|
|||||||
from diceplayer import logger
|
from diceplayer import VERSION, logger
|
||||||
from diceplayer.player import Player
|
from diceplayer.player import Player
|
||||||
from diceplayer.shared.interface.dice_interface import DiceInterface
|
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
import pickle
|
|
||||||
import sys
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
__VERSION = "v0.0.1"
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@@ -22,7 +16,7 @@ def main():
|
|||||||
"-c", "--continue", dest="opt_continue", default=False, action="store_true"
|
"-c", "--continue", dest="opt_continue", default=False, action="store_true"
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-v", "--version", action="version", version="diceplayer-" + __VERSION
|
"-v", "--version", action="version", version="diceplayer-" + VERSION
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-i",
|
"-i",
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from diceplayer import logger
|
from diceplayer import VERSION, logger
|
||||||
from diceplayer.shared.config.dice_config import DiceConfig
|
from diceplayer.shared.config.dice_config import DiceConfig
|
||||||
from diceplayer.shared.config.gaussian_config import GaussianDTO
|
from diceplayer.shared.config.gaussian_config import GaussianDTO
|
||||||
from diceplayer.shared.config.player_config import PlayerConfig
|
from diceplayer.shared.config.player_config import PlayerConfig
|
||||||
@@ -118,9 +118,9 @@ class Player:
|
|||||||
logger.info(f"{key} = {getattr(config, key)}")
|
logger.info(f"{key} = {getattr(config, key)}")
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
"##########################################################################################\n"
|
f"##########################################################################################\n"
|
||||||
"############# Welcome to DICEPLAYER version 1.0 #############\n"
|
f"############# Welcome to DICEPLAYER version {VERSION} #############\n"
|
||||||
"##########################################################################################\n"
|
f"##########################################################################################\n"
|
||||||
)
|
)
|
||||||
logger.info("Your python version is {}\n".format(sys.version))
|
logger.info("Your python version is {}\n".format(sys.version))
|
||||||
logger.info("Program started on {}\n".format(weekday_date_time()))
|
logger.info("Program started on {}\n".format(weekday_date_time()))
|
||||||
|
|||||||
16
poetry.lock
generated
16
poetry.lock
generated
@@ -168,6 +168,20 @@ files = [
|
|||||||
{file = "distlib-0.3.8.tar.gz", hash = "sha256:1530ea13e350031b6312d8580ddb6b27a104275a31106523b8f123787f494f64"},
|
{file = "distlib-0.3.8.tar.gz", hash = "sha256:1530ea13e350031b6312d8580ddb6b27a104275a31106523b8f123787f494f64"},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "dunamai"
|
||||||
|
version = "1.21.2"
|
||||||
|
description = "Dynamic version generation"
|
||||||
|
optional = false
|
||||||
|
python-versions = ">=3.5"
|
||||||
|
files = [
|
||||||
|
{file = "dunamai-1.21.2-py3-none-any.whl", hash = "sha256:87db76405bf9366f9b4925ff5bb1db191a9a1bd9f9693f81c4d3abb8298be6f0"},
|
||||||
|
{file = "dunamai-1.21.2.tar.gz", hash = "sha256:05827fb5f032f5596bfc944b23f613c147e676de118681f3bb1559533d8a65c4"},
|
||||||
|
]
|
||||||
|
|
||||||
|
[package.dependencies]
|
||||||
|
packaging = ">=20.9"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "filelock"
|
name = "filelock"
|
||||||
version = "3.15.4"
|
version = "3.15.4"
|
||||||
@@ -591,4 +605,4 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess
|
|||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "2.0"
|
lock-version = "2.0"
|
||||||
python-versions = ">=3.9,<4.0"
|
python-versions = ">=3.9,<4.0"
|
||||||
content-hash = "80ecbda1b826475e5eef19c940136c907a9687c7f4a6a0577a65ddd9b8a3343b"
|
content-hash = "9725a4cd55a5fc1ae0ac3f5d8bb5c6f6a35275e50b30365843f7fa2e5a3b5037"
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "diceplayer"
|
name = "diceplayer"
|
||||||
version = "1.1a0"
|
version = "0.0.0"
|
||||||
description = ""
|
description = ""
|
||||||
authors = ["Vitor Hideyoshi <vitor.h.n.batista@gmail.com>", "Herbert Georg <hcgeorg@ufg.br>"]
|
authors = ["Vitor Hideyoshi <vitor.h.n.batista@gmail.com>", "Herbert Georg <hcgeorg@ufg.br>"]
|
||||||
license = "GPL-2.0-only"
|
license = "GPL-2.0-only"
|
||||||
@@ -13,6 +13,7 @@ argparse = "^1.4.0"
|
|||||||
setproctitle = "^1.3.2"
|
setproctitle = "^1.3.2"
|
||||||
pyyaml = "^6.0"
|
pyyaml = "^6.0"
|
||||||
nptyping = "^2.5.0"
|
nptyping = "^2.5.0"
|
||||||
|
dunamai = "^1.21.2"
|
||||||
|
|
||||||
[tool.poetry.scripts]
|
[tool.poetry.scripts]
|
||||||
diceplayer = "diceplayer.__main__:main"
|
diceplayer = "diceplayer.__main__:main"
|
||||||
@@ -24,26 +25,16 @@ black = "^24.4.2"
|
|||||||
pre-commit = "^3.7.1"
|
pre-commit = "^3.7.1"
|
||||||
poethepoet = "^0.27.0"
|
poethepoet = "^0.27.0"
|
||||||
|
|
||||||
|
[tool.poetry-dynamic-versioning]
|
||||||
|
enable = true
|
||||||
|
vcs = "git"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
requires = ["poetry-core"]
|
requires = ["poetry-core"]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "poetry_dynamic_versioning.backend"
|
||||||
|
|
||||||
[tool.poe.tasks]
|
[tool.poe.tasks]
|
||||||
hooks = "pre-commit install"
|
hooks = "pre-commit install --config .pre-commit-config.yaml"
|
||||||
|
|
||||||
[tool.coverage.run]
|
|
||||||
omit = [
|
|
||||||
"mega_conversao/src/utilidades/trata.py",
|
|
||||||
"mega_conversao/src/modulos/*",
|
|
||||||
"tests/*",
|
|
||||||
]
|
|
||||||
data_file = "coverage/.coverage"
|
|
||||||
|
|
||||||
[tool.coverage.html]
|
|
||||||
directory = "coverage/html"
|
|
||||||
|
|
||||||
[tool.coverage.lcov]
|
|
||||||
output = "coverage/lcov.info"
|
|
||||||
|
|
||||||
[tool.isort]
|
[tool.isort]
|
||||||
profile = "black"
|
profile = "black"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from diceplayer import logger
|
from diceplayer import VERSION, logger
|
||||||
from diceplayer.player import Player
|
from diceplayer.player import Player
|
||||||
from tests.mocks.mock_inputs import mock_open
|
from tests.mocks.mock_inputs import mock_open
|
||||||
|
|
||||||
@@ -51,9 +51,10 @@ class TestPlayer(unittest.TestCase):
|
|||||||
|
|
||||||
self.assertTrue(mock_path.called)
|
self.assertTrue(mock_path.called)
|
||||||
|
|
||||||
|
@mock.patch("builtins.open", mock_open)
|
||||||
|
@mock.patch("diceplayer.player.VERSION", "test")
|
||||||
@mock.patch("diceplayer.player.sys")
|
@mock.patch("diceplayer.player.sys")
|
||||||
@mock.patch("diceplayer.player.weekday_date_time")
|
@mock.patch("diceplayer.player.weekday_date_time")
|
||||||
@mock.patch("builtins.open", mock_open)
|
|
||||||
def test_print_keywords(self, mock_date_func, mock_sys):
|
def test_print_keywords(self, mock_date_func, mock_sys):
|
||||||
player = Player("control.test.yml")
|
player = Player("control.test.yml")
|
||||||
|
|
||||||
@@ -64,7 +65,7 @@ class TestPlayer(unittest.TestCase):
|
|||||||
player.print_keywords()
|
player.print_keywords()
|
||||||
|
|
||||||
expected_output = [
|
expected_output = [
|
||||||
"INFO:diceplayer:##########################################################################################\n############# Welcome to DICEPLAYER version 1.0 #############\n##########################################################################################\n",
|
"INFO:diceplayer:##########################################################################################\n############# Welcome to DICEPLAYER version test #############\n##########################################################################################\n",
|
||||||
"INFO:diceplayer:Your python version is TEST\n",
|
"INFO:diceplayer:Your python version is TEST\n",
|
||||||
"INFO:diceplayer:Program started on 00 Test 0000 at 00:00:00\n",
|
"INFO:diceplayer:Program started on 00 Test 0000 at 00:00:00\n",
|
||||||
"INFO:diceplayer:Environment variables:",
|
"INFO:diceplayer:Environment variables:",
|
||||||
|
|||||||
Reference in New Issue
Block a user