Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies and supported systems in CI #122

Merged
merged 25 commits into from
Jun 13, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ on:
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [macos-11, macos-12, ubuntu-20.04, ubuntu-22.04]
os: [macos-11, macos-12, macos-13, macos-14, ubuntu-20.04, ubuntu-22.04, ubuntu-24.04]
runs-on: ${{ matrix.os }}

steps:
Expand Down Expand Up @@ -52,17 +53,22 @@ jobs:

- name: Install Hatch
run: |
python3 -m pip install --upgrade hatch
python3 -m venv /tmp/venv
/tmp/venv/bin/python3 -m pip install --upgrade hatch

- name: Build source and wheel packages
run: |
python3 -m hatch build
/tmp/venv/bin/python3 -m hatch build

- name: Install the Python wheel
run: |
python3 -m pip install dist/aleph_sdk_python-*.whl
/tmp/venv/bin/python3 -m pip install dist/aleph_sdk_python-*.whl

- name: Install `setuptools` on systems where it is missing by default
run: /tmp/venv/bin/python3 -m pip install --upgrade setuptools
if: matrix.os == 'ubuntu-24.04'

- name: Import and use the package
run: |
python3 -c "import aleph.sdk"
python3 -c "from aleph.sdk.chains.ethereum import get_fallback_account; get_fallback_account()"
/tmp/venv/bin/python3 -c "import aleph.sdk"
/tmp/venv/bin/python3 -c "from aleph.sdk.chains.ethereum import get_fallback_account; get_fallback_account()"
15 changes: 8 additions & 7 deletions .github/workflows/code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,17 @@ on:

jobs:
code-quality:
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4

- name: Workaround github issue https://github.com/actions/runner-images/issues/7192
run: sudo echo RESET grub-efi/install_devices | sudo debconf-communicate grub-pc

- name: Install pip and hatch
- name: Install system dependencies
run: |
sudo apt-get install -y python3-pip
pip3 install hatch
sudo apt-get install -y python3-pip libsecp256k1-dev

- name: Cache dependencies
uses: actions/cache@v4
Expand All @@ -29,8 +28,10 @@ jobs:
restore-keys: |
${{ runner.os }}-code-quality-

- name: Install required system packages only for Ubuntu Linux
run: sudo apt-get install -y libsecp256k1-dev
- name: Install python dependencies
run: |
python3 -m venv /tmp/venv
/tmp/venv/bin/pip install hatch

- name: Run Hatch lint
run: hatch run linting:all
run: /tmp/venv/bin/hatch run linting:all
22 changes: 15 additions & 7 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ name: Test/Coverage with Python

on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
# Run every night at 04:00 (GitHub Actions timezone)
# Run every night at 04:00 (GitHub Actions timezone)
# in order to catch when unfrozen dependency updates
# break the use of the library.
- cron: '4 0 * * *'
Expand All @@ -17,20 +15,30 @@ jobs:
build:
strategy:
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11" ]
python-version: [ "3.9", "3.10", "3.11", "3.12" ]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- run: sudo apt-get install -y python3-pip libsecp256k1-dev
- run: python -m pip install --upgrade pip hatch coverage
- run: hatch run testing:test

- run: |
python3 -m venv /tmp/venv
/tmp/venv/bin/python -m pip install --upgrade pip hatch coverage

- run: |
/tmp/venv/bin/pip freeze
/tmp/venv/bin/hatch run testing:pip freeze
/tmp/venv/bin/hatch run testing:test
if: matrix.python-version != '3.11'
- run: hatch run testing:cov

- run: /tmp/venv/bin/hatch run testing:cov
if: matrix.python-version == '3.11'

- uses: codecov/[email protected]
if: matrix.python-version == '3.11'
with:
Expand Down
13 changes: 9 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ dependencies = [
"aiohttp>=3.8.3",
"aleph-message~=0.4.4",
"coincurve; python_version<\"3.11\"",
"coincurve>=17.0.0; python_version>=\"3.11\"",
"coincurve>=19.0.0; python_version>=\"3.11\"",
"eth_abi>=4.0.0; python_version>=\"3.11\"",
"eth_account>=0.4.0,<0.11.0",
"python-magic",
Expand Down Expand Up @@ -67,13 +67,18 @@ tezos = [
"pynacl",
]
encryption = [
"eciespy; python_version<\"3.11\"",
"eciespy>=0.3.13; python_version>=\"3.11\"",
# "eciespy; python_version<'3.11'",
# "eciespy @ git+https://github.com/ecies/py.git@4b4256cde1d8acd773dff76fd8ab855a8e9faa4f#egg=eciespy; python_version>='3.11'"
"eciespy@git+https://github.com/ecies/py.git@4b4256cde1d8acd773dff76fd8ab855a8e9faa4f#egg=eciespy"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be a version from Pypi


]
all = [
"aleph-sdk-python[cosmos,dns,docs,ledger,mqtt,nuls2,polkadot,solana,tezos,encryption]",
]

[tool.hatch.metadata]
allow-direct-references = true

[project.urls]
Documentation = "https://aleph.im/"
Homepage = "https://github.com/aleph-im/aleph-sdk-python"
Expand Down Expand Up @@ -231,4 +236,4 @@ exclude_lines = [

# Don't complain about ineffective code:
"pass",
]
]
16 changes: 8 additions & 8 deletions tests/unit/test_asynchronous.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async def test_create_post(mock_session_with_post_success):
sync=False,
)

assert mock_session_with_post_success.http_session.post.called_once
assert mock_session_with_post_success.http_session.post.assert_called_once
assert isinstance(post_message, PostMessage)
assert message_status == MessageStatus.PENDING

Expand All @@ -47,7 +47,7 @@ async def test_create_aggregate(mock_session_with_post_success):
channel="TEST",
)

assert mock_session_with_post_success.http_session.post.called_once
assert mock_session_with_post_success.http_session.post.assert_called_once
assert isinstance(aggregate_message, AggregateMessage)


Expand Down Expand Up @@ -83,7 +83,7 @@ async def test_create_store(mock_session_with_post_success):
storage_engine=StorageEnum.storage,
)

assert mock_session_with_post_success.http_session.post.called
assert mock_session_with_post_success.http_session.post.assert_called
assert isinstance(store_message, StoreMessage)


Expand All @@ -98,7 +98,7 @@ async def test_create_program(mock_session_with_post_success):
metadata={"tags": ["test"]},
)

assert mock_session_with_post_success.http_session.post.called_once
assert mock_session_with_post_success.http_session.post.assert_called_once
assert isinstance(program_message, ProgramMessage)


Expand All @@ -118,7 +118,7 @@ async def test_create_instance(mock_session_with_post_success):
hypervisor=HypervisorType.qemu,
)

assert mock_session_with_post_success.http_session.post.called_once
assert mock_session_with_post_success.http_session.post.assert_called_once
assert isinstance(instance_message, InstanceMessage)


Expand All @@ -139,7 +139,7 @@ async def test_create_instance_no_payment(mock_session_with_post_success):
assert instance_message.content.payment.type == PaymentType.hold
assert instance_message.content.payment.chain == Chain.ETH

assert mock_session_with_post_success.http_session.post.called_once
assert mock_session_with_post_success.http_session.post.assert_called_once
assert isinstance(instance_message, InstanceMessage)


Expand All @@ -159,7 +159,7 @@ async def test_create_instance_no_hypervisor(mock_session_with_post_success):

assert instance_message.content.environment.hypervisor == HypervisorType.firecracker

assert mock_session_with_post_success.http_session.post.called_once
assert mock_session_with_post_success.http_session.post.assert_called_once
assert isinstance(instance_message, InstanceMessage)


Expand All @@ -172,7 +172,7 @@ async def test_forget(mock_session_with_post_success):
channel="TEST",
)

assert mock_session_with_post_success.http_session.post.called_once
assert mock_session_with_post_success.http_session.post.assert_called_once
assert isinstance(forget_message, ForgetMessage)


Expand Down
Loading