From 1197d2490810fc43e75331f3642f4e2634b9a7aa Mon Sep 17 00:00:00 2001 From: Hugo Herter Date: Thu, 13 Jun 2024 17:41:04 +0200 Subject: [PATCH] Update dependencies and supported systems in CI (#122) Fix: Latest OS and Python were not tested Add comment regarding eciespy --- .github/workflows/build-wheels.yml | 18 ++++++++++++------ .github/workflows/code-quality.yml | 15 ++++++++------- .github/workflows/pytest.yml | 22 +++++++++++++++------- pyproject.toml | 11 ++++++++--- 4 files changed, 43 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml index 5155bc7e..c07479e8 100644 --- a/.github/workflows/build-wheels.yml +++ b/.github/workflows/build-wheels.yml @@ -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: @@ -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()" diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 79a3ac5b..16ec4e91 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -8,7 +8,7 @@ on: jobs: code-quality: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 @@ -16,10 +16,9 @@ jobs: - 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 @@ -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 diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 89c3dabd..efe667ea 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -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 * * *' @@ -17,7 +15,7 @@ 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: @@ -25,12 +23,22 @@ jobs: - 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/codecov-action@v4.0.1 if: matrix.python-version == '3.11' with: diff --git a/pyproject.toml b/pyproject.toml index 63fa6d35..d255c22a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", @@ -67,13 +67,18 @@ tezos = [ "pynacl", ] encryption = [ - "eciespy; python_version<\"3.11\"", - "eciespy>=0.3.13; python_version>=\"3.11\"", + # Blocked by https://github.com/ecies/py/issues/356 + # "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" ] 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"