Skip to content

Commit

Permalink
Prepare-release/v12 (#689)
Browse files Browse the repository at this point in the history
* Increment version of TRD
* Change virtual environment folder to .venv as recommended
* Add .env.example for pytest and note in documentation
* Updated copyright to 2024
* Update Constants.py
* Set Python 3.8 as minimum
* Exended new protocol date
* Update ci workflow action versions and used uniform requirements installation procedure, removed Python 3.7 as out of support
* Contributor: jdsika, Effort=2h
---------

Signed-off-by: jdsika <[email protected]>
  • Loading branch information
jdsika authored Feb 9, 2024
1 parent 4f97afe commit eb8b6ad
Show file tree
Hide file tree
Showing 13 changed files with 74 additions and 56 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TZPRO_API_KEY = "XXXXXXXXXX"
42 changes: 24 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Install linter and formatter dependencies
run: pip install -r requirements_developers.txt
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements_developers.txt
- name: Lint with flake8
run: flake8 src/ tests/
Expand All @@ -37,28 +39,28 @@ jobs:
fail-fast: false
matrix:
runs-on: [ubuntu-latest]
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

name: "🐍 ${{ matrix.python-version }} • ${{ matrix.runs-on }}"
runs-on: ${{ matrix.runs-on }}

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install software dependencies
shell: bash
run: |
python -m pip install --upgrade pip
sudo apt-get update -y
sudo apt-get install graphviz -y
pip install -r requirements.txt
pip install -r requirements_developers.txt
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install -r requirements_developers.txt
- name: Test with pytest
env:
Expand All @@ -72,19 +74,23 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Generate diagrams
- name: Install dependencies
run: |
sudo apt-get install graphviz -y
pip install -r requirements.txt
pip install -r requirements_developers.txt
python docs/fsm/graphviz/draw_state_diagrams.py
sudo apt-get update -y
sudo apt-get install graphviz -y
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install -r requirements_developers.txt
- name: Generate diagrams
run: python docs/fsm/graphviz/draw_state_diagrams.py

- name: Build documentation
uses: ammaraskar/sphinx-action@master
Expand All @@ -93,7 +99,7 @@ jobs:
pre-build-command: |
mkdir -p docs/build/
touch docs/build/.nojekyll
pip install -r requirements_developers.txt
python -m pip install -r requirements_developers.txt
build-command: sphinx-build -b html . build

build-docker:
Expand All @@ -103,7 +109,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Build the docker image
run: docker build -t trdo/tezos-reward-distributor .
8 changes: 4 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@v1
uses: docker/login-action@v3.0.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v5
with:
images: trdo/tezos-reward-distributor
tags: |
Expand All @@ -32,7 +32,7 @@ jobs:
type=match,pattern=v(.*),group=1
- name: Push to Docker Hub
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
push: ${{ GitHub.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
Expand Down
26 changes: 15 additions & 11 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,23 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python 3.10
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Generate diagrams
- name: Install requirements
run: |
sudo apt-get update -y
sudo apt-get install graphviz -y
pip install -r requirements.txt
pip install -r requirements_developers.txt
python docs/fsm/graphviz/draw_state_diagrams.py
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
python -m pip install -r requirements_developers.txt
- name: Generate diagrams
run: python docs/fsm/graphviz/draw_state_diagrams.py

- name: Build documentation
uses: ammaraskar/sphinx-action@master
Expand All @@ -35,12 +39,12 @@ jobs:
pre-build-command: |
mkdir -p docs/build/
touch docs/build/.nojekyll
pip install -r requirements_developers.txt
python -m pip install -r requirements_developers.txt
build-command: sphinx-build -b html . build

- name: Deploy documentation
uses: JamesIves/github-pages-deploy-action@4.1.0
uses: JamesIves/github-pages-deploy-action@v4.5.0
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages
FOLDER: docs/build
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: docs/build
6 changes: 3 additions & 3 deletions .github/workflows/github-registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Login to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository_owner }}/tezos-reward-distributor
tags: |
Expand All @@ -23,7 +23,7 @@ jobs:
type=match,pattern=v(.*),group=1
- name: Push to GHCR
uses: docker/build-push-action@v2
uses: docker/build-push-action@v5
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@

# General information about the project.
project = "Tezos Reward Distributor (TRD)"
copyright = "2021, see contributors.csv"
copyright = "2021-2024, see contributors.csv"
author = "TRD Organization"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = "9.0"
version = "12.0"
# The full version, including alpha/beta/rc tags.
release = "9.0"
release = "12.0"

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Blockwatch: TZPRO

The terms_ of TZPRO note that an account and API key are needed for the use of the API. Please review the [pricing](https://tzpro.io/#pricing) information. For further help contact [email protected] for more information.

In order to use your API key in the application copy and rename the .env.example to .env and add the API key for TZPRO.
In order to use your API key in the application add it to your configuration like tzpro_api_key: XXXXXXXXXX.

TzKT
-----------
Expand Down
16 changes: 15 additions & 1 deletion docs/testing.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Tests
========
In order to run test which rely on the TZPRO API you have to copy the `.env.example` file to `.env` and add your personal TZPRO API Key.

Test Execution
---------------
Expand Down Expand Up @@ -78,7 +79,20 @@ Check the `pytest documentation and tutorials <https://docs.pytest.org/en/7.1.x/
Visual Studio Code Test Execution (optional)
----------------------------------------------

If you are using `Visual Studio Code <https://code.visualstudio.com/>`_, you want to use it with the extensions installed in the previous section and check them here:
If you are using `Visual Studio Code <https://code.visualstudio.com/>`_, then copy this into your settings:

.. code-block:: json

Check warning on line 84 in docs/testing.rst

View workflow job for this annotation

GitHub Actions / deploy-documentation

Error in "code-block" directive:

Check warning on line 84 in docs/testing.rst

View workflow job for this annotation

GitHub Actions / build-documentation

Error in "code-block" directive:
{
"python.testing.pytestArgs": [
"tests"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"python.envFile": "${workspaceFolder}/.env",
"esbonio.sphinx.confDir": ""
}
In addition you want to use it with the extensions installed in the previous section and check them here:

.. image:: img/extension_vscode.png
:width: 350
Expand Down
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ TRD supports complex payments, pays in batches, and supports three backends for

The [terms and conditions](https://tzpro.io/terms) of TZPRO note that an account and API key are needed for the use of the API. Please review the [pricing](https://tzpro.io/#pricing) information. For further help contact [email protected] for more information.

In order to use your API key in the application copy and rename the .env.example to .env and add the API key for TZPRO.
In order to use your API key in the application add it to your configuration like tzpro_api_key: XXXXXXXXXX.

### TzKT

Expand Down Expand Up @@ -53,8 +53,8 @@ git clone https://github.com/tezos-reward-distributor-organization/tezos-reward-
To install required modules, use pip with `requirements.txt` provided. Follow the instructions to create a virtual environment for your project specific python installation: https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/

```bash
python3 -m venv env
source env/bin/activate
python3 -m venv .venv
source .venv/bin/activate
```

```bash
Expand Down
8 changes: 4 additions & 4 deletions src/Constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
from datetime import date

# General
VERSION = 11.0
VERSION = 12.0
PYTHON_MAJOR = 3
PYTHON_MINOR = 7
PYTHON_MINOR = 8
LINER = "--------------------------------------------"

# Disabled or enabled options by developers
Expand All @@ -20,8 +20,8 @@
REQUIREMENTS_FILE_PATH = "requirements.txt"

# potentially the next upgrade
NEW_PROTOCOL_DATE = date(2024, 2, 28)
NEW_PROTOCOL_NAME = "Oxford"
NEW_PROTOCOL_DATE = date(2024, 6, 30)
NEW_PROTOCOL_NAME = "P_______"

LOCAL_HOST = "127.0.0.1"
EXIT_PAYMENT_TYPE = "exit"
Expand Down
6 changes: 0 additions & 6 deletions src/launch_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,6 @@ def installed(package):
print(e)
return False

# if hasattr(pip, "main"):
# status_code = pip.main(["install", package])
# else:
# status_code = pip._internal.main(["install", package])
# return not bool(status_code)


def requirements_installed(requirement_path=REQUIREMENTS_FILE_PATH):
print("Checking installed packages ...\n")
Expand Down
2 changes: 1 addition & 1 deletion src/util/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def add_argument_provider(argparser):
"Set to 'rpc' to use your own local node defined with the -A flag, "
"(it must be an ARCHIVE node in this case). "
"Set to 'prpc' to use a public RPC node defined with the -Ap flag. "
"An alternative for providing reward data is 'tzpro', but an API key associated with your account needs to be provided in the .env file!",
"An alternative for providing reward data is 'tzpro', but an API key associated with your account needs to be provided in your configuration!",
choices=["rpc", "prpc", "tzpro", "tzkt"],
default="tzkt",
)
Expand Down
1 change: 0 additions & 1 deletion tests/unit/test_BakingYamlConfParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from src.Constants import (
PUBLIC_NODE_URL,
PRIVATE_SIGNER_URL,
RewardsType,
DEFAULT_NETWORK_CONFIG_MAP,
)
from src.Constants import DryRun
Expand Down

0 comments on commit eb8b6ad

Please sign in to comment.