Skip to content

Commit

Permalink
Merge pull request #29 from Bernardo-MG/release
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
Bernardo-MG authored Feb 28, 2022
2 parents a50e163 + 2cc8ea0 commit ae74231
Show file tree
Hide file tree
Showing 12 changed files with 128 additions and 104 deletions.
1 change: 0 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[report]
omit =
*/python?.?/*
*/site-packages/nose/*
*__init__*
29 changes: 6 additions & 23 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,9 @@ on:
- master

jobs:
deploy_docs:

runs-on: ubuntu-latest

steps:
- name: Check-out
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Build distribution
run: python setup.py sdist bdist_wheel
- name: Deploy
run: twine upload -r pypi dist/*
env:
TWINE_USERNAME: ${{ secrets.DEPLOY_USER }}
TWINE_PASSWORD: ${{ secrets.DEPLOY_PASSWORD }}
pypi:
name: Pypi
uses: Bernardo-MG/github-workflow/.github/workflows/python_deploy_pypi.yml@v1
secrets:
username: ${{ secrets.DEPLOY_USER }}
password: ${{ secrets.DEPLOY_PASSWORD }}
45 changes: 0 additions & 45 deletions .github/workflows/deploy_docs.yml

This file was deleted.

78 changes: 66 additions & 12 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,80 @@
name: Testing and validation
name: Tests and docs

on: [push, pull_request]

jobs:
test:
tests:
name: Tests
uses: Bernardo-MG/github-workflow/.github/workflows/python_testing.yml@develop

setup_docs:
name: Doc deployment preparation
needs: tests
outputs:
branchName: ${{ steps.extract_branch.outputs.branchName }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- name: Install sshpass
run: sudo apt-get install sshpass
- name: Extract branch name
uses: bernardo-mg/extract-branch-name-action@v1
id: extract_branch

deploy_docs:
name: Deploy development docs
environment: deployment_site
needs: setup_docs
runs-on: ubuntu-latest
if: ${{ needs.setup_docs.outputs.branchName == 'master' }}
steps:
- name: Check-out
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
cache: 'pip'
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install dependencies
run: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install sshpass
run: sudo apt-get install sshpass
- name: Tests docs
run: python setup.py test -p docs
- name: Build docs
run: python setup.py build_docs
- name: Deploy docs
run: |
cd ./build/sphinx/html
sshpass -p ${{ secrets.DEPLOY_DOCS_PASSWORD }} scp -o StrictHostKeyChecking=no -P ${{ secrets.DEPLOY_DOCS_PORT }} -r ./* ${{ secrets.DEPLOY_DOCS_USER }}'@'${{ secrets.DEPLOY_DOCS_HOST }}':'${{ secrets.DEPLOY_DOCS_PATH }};
deploy_develop_docs:
name: Deploy development docs
environment: deployment_site
needs: setup_docs
runs-on: ubuntu-latest
if: ${{ needs.setup_docs.outputs.branchName == 'develop' }}
steps:
- name: Check-out
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
python-version: 3.9
cache: 'pip'
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install dependencies
run: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install sshpass
run: sudo apt-get install sshpass
- name: Tests docs
run: python setup.py test -p docs
- name: Build docs
run: python setup.py build_docs
- name: Deploy docs
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run all tests
run: python setup.py test -p py${{ matrix.python-version }}
cd ./build/sphinx/html
sshpass -p ${{ secrets.DEPLOY_DOCS_DEVELOP_PASSWORD }} scp -o StrictHostKeyChecking=no -P ${{ secrets.DEPLOY_DOCS_PORT }} -r ./* ${{ secrets.DEPLOY_DOCS_DEVELOP_USER }}'@'${{ secrets.DEPLOY_DOCS_HOST }}':'${{ secrets.DEPLOY_DOCS_DEVELOP_PATH }};
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml

# Translations
Expand Down
12 changes: 6 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ operating with it on any Python application.
:alt: Dice Notation Tools for Python Pypi package page

.. image:: https://img.shields.io/badge/docs-release-blue.svg
:target: http://docs.bernardomg.com/dice-notation-python
:target: https://docs.bernardomg.com/dice-notation-python
:alt: Dice Notation Tools for Python latest documentation
.. image:: https://img.shields.io/badge/docs-develop-blue.svg
:target: http://docs.bernardomg.com/development/dice-notation-python
:target: https://docs.bernardomg.com/development/dice-notation-python
:alt: Dice Notation Tools for Python development documentation

Features
Expand Down Expand Up @@ -146,9 +146,9 @@ License
The project has been released under the `MIT License`_.

.. _GitHub project page: https://github.com/Bernardo-MG/dice-notation-python
.. _latest docs: http://docs.bernardomg.com/dice-notation-python
.. _development docs: http://docs.bernardomg.com/development/dice-notation-python
.. _latest docs: https://docs.bernardomg.com/dice-notation-python
.. _development docs: https://docs.bernardomg.com/development/dice-notation-python
.. _Pypi package: https://pypi.python.org/pypi/dice-notation
.. _MIT License: http://www.opensource.org/licenses/mit-license.php
.. _MIT License: https://opensource.org/licenses/mit-license.php
.. _project issues tracker: https://github.com/Bernardo-MG/dice-notation-python/issues
.. _Sphinx: http://sphinx-doc.org/
.. _Sphinx: https://www.sphinx-doc.org
2 changes: 1 addition & 1 deletion dice_notation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
:license: MIT, see LICENSE for more details.
"""

__version__ = '1.2.0'
__version__ = '1.2.1'
__license__ = 'MIT'
4 changes: 2 additions & 2 deletions dice_notation/parser/DiceNotationListener.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from antlr4 import *

import logging
from dice_notation.dice import Dice
from dice_notation.dice import RollableDice
from dice_notation.algebra import BinaryOperation, Number

# This class defines a complete listener for a parse tree produced by DiceNotationParser.
Expand Down Expand Up @@ -125,7 +125,7 @@ def exitDice(self, ctx):

sides = int(next(digits).getText())

dice = Dice(quantity, sides)
dice = RollableDice(quantity, sides)
self._nodes.append(dice)


Expand Down
3 changes: 2 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@
html_theme_path = sphinx_docs_theme.get_html_theme_path()

# Removes permalink markers
html_add_permalinks = ''
html_permalinks = False
html_permalinks_icon = ''

# Theme options.
html_theme_options = {
Expand Down
18 changes: 9 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Installation and deployment
setuptools==54.2.0
wheel==0.36.2
twine==3.4.1
bernardomg.tox-test-command==1.1.6
bernardomg.version-extractor==1.0.3
setuptools==59.6.0
wheel==0.37.1
twine==3.8.0
bernardomg.tox-test-command==1.2.0
bernardomg.version-extractor==1.1.0

# Testing
tox==3.23.0
tox==3.24.5

# Documentation
Sphinx==3.5.3
Sphinx==4.4.0
sphinx-docs-theme==1.0.7
Pygments==2.8.1
Pygments==2.11.2

# Parsing
antlr4-python3-runtime==4.7.2
antlr4-python3-runtime==4.9.3
33 changes: 33 additions & 0 deletions tests/parser/dice/test_dice_parser_dice_roll.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-

import sys
import unittest

from dice_notation.parser import DiceParser

"""
Dice parser tests for expressions only containing dice.
"""

__author__ = 'Bernardo Martínez Garrido'
__license__ = 'MIT'


class TestSimpleDice(unittest.TestCase):
"""
Tests that simple dice expressions can be parsed.
"""

def setUp(self):
"""
Initializes parser.
"""
self.parser = DiceParser()

def test_minimalDice(self):
"""
Tests that the minimal dice can be rolled.
"""
result = self.parser.parse("1d1").roll()

self.assertEqual(1, result)
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py{3.6,3.7,3.8,3.9},
py{3.6,3.7,3.8,3.9,3.10},
check,
docs
skip_missing_interpreters =
Expand All @@ -10,9 +10,9 @@ skip_missing_interpreters =
# Default environment
deps =
-r{toxinidir}/requirements.txt
nose
pytest
commands =
nosetests
pytest

[testenv:check]
# Checks code rules
Expand Down

0 comments on commit ae74231

Please sign in to comment.