FEAT: improve on workflows and makefile (#276)

* FEAT: improve on workflows and makefile

* update to poetry 1.5.1

* caching needs newer python task

quickfix
This commit is contained in:
dni ⚡
2023-07-18 00:13:39 +02:00
committed by GitHub
parent 8a9b0662a1
commit c7dd582b56
5 changed files with 54 additions and 51 deletions

View File

@@ -1,10 +1,6 @@
name: checks name: checks
on: on: [push, pull_request]
push:
branches: [main]
pull_request:
branches: [main]
jobs: jobs:
formatting: formatting:
@@ -12,41 +8,43 @@ jobs:
strategy: strategy:
matrix: matrix:
python-version: ["3.9"] python-version: ["3.9"]
poetry-version: ["1.3.1"] poetry-version: ["1.5.1"]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry ${{ matrix.poetry-version }} - name: Set up Poetry ${{ matrix.poetry-version }}
uses: abatilo/actions-poetry@v2 uses: abatilo/actions-poetry@v2
with: with:
poetry-version: ${{ matrix.poetry-version }} poetry-version: ${{ matrix.poetry-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- name: Install packages - name: Install packages
run: poetry install --with dev run: poetry install
- name: Check black - name: Check black
run: poetry run black --check . run: make black-check
- name: Check isort - name: Check isort
run: poetry run isort --profile black --check-only . run: make isort-check
linting: linting:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
python-version: ["3.9"] python-version: ["3.9"]
poetry-version: ["1.3.1"] poetry-version: ["1.5.1"]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry ${{ matrix.poetry-version }} - name: Set up Poetry ${{ matrix.poetry-version }}
uses: abatilo/actions-poetry@v2 uses: abatilo/actions-poetry@v2
with: with:
poetry-version: ${{ matrix.poetry-version }} poetry-version: ${{ matrix.poetry-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- name: Install packages - name: Install packages
run: poetry install --with dev run: poetry install
- name: Setup mypy - name: Setup mypy
run: yes | poetry run mypy cashu --install-types || true run: yes | poetry run mypy cashu --install-types || true
- name: Run mypy - name: Run mypy

View File

@@ -9,32 +9,33 @@ jobs:
matrix: matrix:
os: [ubuntu-latest] os: [ubuntu-latest]
python-version: ["3.9.13"] python-version: ["3.9.13"]
poetry-version: ["1.4.2"] poetry-version: ["1.5.1"]
steps: steps:
- name: Checkout repository and submodules - name: Checkout repository and submodules
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
submodules: recursive submodules: recursive
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up Poetry ${{ matrix.poetry-version }} - name: Set up Poetry ${{ matrix.poetry-version }}
uses: abatilo/actions-poetry@v2 uses: abatilo/actions-poetry@v2
with: with:
poetry-version: ${{ matrix.poetry-version }} poetry-version: ${{ matrix.poetry-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: "poetry"
- name: Install dependencies - name: Install dependencies
run: | run: |
poetry install --with dev poetry install
shell: bash shell: bash
- name: Run tests - name: Run tests
env: env:
LIGHTNING: False LIGHTNING: false
WALLET_NAME: test_wallet WALLET_NAME: test_wallet
MINT_HOST: localhost MINT_HOST: localhost
MINT_PORT: 3337 MINT_PORT: 3337
TOR: False TOR: false
run: | run: |
poetry run pytest tests --cov-report xml --cov cashu make test
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
uses: codecov/codecov-action@v3 uses: codecov/codecov-action@v3

View File

@@ -1,9 +1,15 @@
isort: isort:
poetry run isort --profile black . --skip cashu/nostr poetry run isort --profile black . --skip cashu/nostr
isort-check:
poetry run isort --profile black --check-only . --skip cashu/nostr
black: black:
poetry run black . --exclude cashu/nostr poetry run black . --exclude cashu/nostr
black-check:
poetry run black --check . --exclude cashu/nostr
format: format:
make isort make isort
make black make black
@@ -24,7 +30,9 @@ package:
python setup.py sdist bdist_wheel python setup.py sdist bdist_wheel
test: test:
pytest tests/ LIGHTNING=false \
TOR=false \
poetry run pytest tests --cov-report xml --cov cashu
install: install:
make clean make clean

23
poetry.lock generated
View File

@@ -471,7 +471,7 @@ tests = ["dj-database-url", "dj-email-url", "django-cache-url", "pytest"]
name = "exceptiongroup" name = "exceptiongroup"
version = "1.1.0" version = "1.1.0"
description = "Backport of PEP 654 (exception groups)" description = "Backport of PEP 654 (exception groups)"
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [ files = [
@@ -599,7 +599,7 @@ testing = ["flake8 (<5)", "flufl.flake8", "importlib-resources (>=1.3)", "packag
name = "iniconfig" name = "iniconfig"
version = "2.0.0" version = "2.0.0"
description = "brain-dead simple config-ini parsing" description = "brain-dead simple config-ini parsing"
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [ files = [
@@ -783,7 +783,7 @@ test = ["appdirs (==1.4.4)", "covdefaults (>=2.2.2)", "pytest (>=7.2.1)", "pytes
name = "pluggy" name = "pluggy"
version = "1.0.0" version = "1.0.0"
description = "plugin and hook calling mechanisms for python" description = "plugin and hook calling mechanisms for python"
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.6" python-versions = ">=3.6"
files = [ files = [
@@ -1002,18 +1002,17 @@ files = [
[[package]] [[package]]
name = "pytest" name = "pytest"
version = "7.2.2" version = "7.4.0"
description = "pytest: simple powerful testing with Python" description = "pytest: simple powerful testing with Python"
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [ files = [
{file = "pytest-7.2.2-py3-none-any.whl", hash = "sha256:130328f552dcfac0b1cec75c12e3f005619dc5f874f0a06e8ff7263f0ee6225e"}, {file = "pytest-7.4.0-py3-none-any.whl", hash = "sha256:78bf16451a2eb8c7a2ea98e32dc119fd2aa758f1d5d66dbf0a59d69a3969df32"},
{file = "pytest-7.2.2.tar.gz", hash = "sha256:c99ab0c73aceb050f68929bc93af19ab6db0558791c6a0715723abe9d0ade9d4"}, {file = "pytest-7.4.0.tar.gz", hash = "sha256:b4bf8c45bd59934ed84001ad51e11b4ee40d40a1229d2c79f9c592b0a3f6bd8a"},
] ]
[package.dependencies] [package.dependencies]
attrs = ">=19.2.0"
colorama = {version = "*", markers = "sys_platform == \"win32\""} colorama = {version = "*", markers = "sys_platform == \"win32\""}
exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""}
importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""}
@@ -1023,13 +1022,13 @@ pluggy = ">=0.12,<2.0"
tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""}
[package.extras] [package.extras]
testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "xmlschema"] testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"]
[[package]] [[package]]
name = "pytest-asyncio" name = "pytest-asyncio"
version = "0.19.0" version = "0.19.0"
description = "Pytest support for asyncio" description = "Pytest support for asyncio"
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [ files = [
@@ -1326,7 +1325,7 @@ full = ["itsdangerous", "jinja2", "python-multipart", "pyyaml", "requests"]
name = "tomli" name = "tomli"
version = "2.0.1" version = "2.0.1"
description = "A lil' TOML parser" description = "A lil' TOML parser"
category = "main" category = "dev"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [ files = [
@@ -1486,4 +1485,4 @@ pgsql = ["psycopg2-binary"]
[metadata] [metadata]
lock-version = "2.0" lock-version = "2.0"
python-versions = "^3.7" python-versions = "^3.7"
content-hash = "8ac516f63a6f6538a7cc1ed4b1db8a34b1fe1eaa174ae50b5979ce1ef42ec705" content-hash = "b33d82f1d4b58a39ab9fe6c887cf88a3246e9c99dc7bfe5df93923ad00d79814"

View File

@@ -8,7 +8,6 @@ license = "MIT"
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = "^3.7" python = "^3.7"
requests = "^2.27.1" requests = "^2.27.1"
pytest-asyncio = "^0.19.0"
SQLAlchemy = "^1.3.24" SQLAlchemy = "^1.3.24"
click = "^8.0.4" click = "^8.0.4"
pydantic = "^1.10.2" pydantic = "^1.10.2"
@@ -36,15 +35,13 @@ httpx = "0.23.0"
[tool.poetry.extras] [tool.poetry.extras]
pgsql = ["psycopg2-binary"] pgsql = ["psycopg2-binary"]
[tool.poetry.dev-dependencies]
black = {version = "^22.8.0", allow-prereleases = true}
isort = "^5.10.1"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
mypy = "^0.971" mypy = "^0.971"
black = {version = "^22.8.0", allow-prereleases = true} black = {version = "^22.8.0", allow-prereleases = true}
isort = "^5.10.1" isort = "^5.10.1"
pytest-asyncio = "^0.19.0"
pytest-cov = "^4.0.0" pytest-cov = "^4.0.0"
pytest = "^7.4.0"
[build-system] [build-system]
requires = ["poetry-core>=1.0.0"] requires = ["poetry-core>=1.0.0"]