Skip to content

Add support for Python 3.12 #4292

Add support for Python 3.12

Add support for Python 3.12 #4292

Workflow file for this run

name: Checks
env:
STARKNET_VERSION: "0.13.0"
RPC_SPEC_VERSION: "0.6.0"
DEVNET_SHA: "1bd447d"
on:
push:
branches:
- master
- development
pull_request:
workflow_dispatch:
jobs:
# ---------------------------------------------------------- #
# ...................LINT-FORMAT-TYPECHECK.................. #
# ---------------------------------------------------------- #
lint-format-typecheck:
name: Lint - Format - Typecheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config installer.modern-installation false
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"
cache: 'poetry'
- name: Install dependencies
run: |
poetry install
- name: Check poetry.lock
run: |
poetry lock --check
- name: Lint
run: |
poetry run poe lint
- name: Format
run: |
poetry run poe format_check
- name: Typecheck
run: |
poetry run poe typecheck
# ---------------------------------------------------------- #
# .......................SETUP-TESTS........................ #
# ---------------------------------------------------------- #
setup-tests:
name: Setup Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.12" ]
steps:
# ====================== SETUP ====================== #
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.12"
cache: 'pip'
- name: Install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config installer.modern-installation false
- name: Install deprecated cairo compiler
run: |
pip install --upgrade setuptools
pip install cairo-lang==0.13.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install dependencies
run: |
poetry install
# ====================== CONTRACTS v0 ====================== #
- name: Cache contracts
id: cache-contracts
uses: actions/cache@v3
with:
path: starknet_py/tests/e2e/mock/contracts_compiled
key: ${{ runner.os }}-contracts-${{ hashFiles('starknet_py/tests/e2e/mock/contracts', 'poetry.lock') }}
- name: Compile contracts
if: steps.cache-contracts.outputs.cache-hit != 'true'
run: |
poetry run poe compile_contracts
- name: Upload contracts
uses: actions/upload-artifact@v3
with:
name: contract-artifacts
path: starknet_py/tests/e2e/mock/
# ---------------------------------------------------------- #
# ........................RUN-TESTS......................... #
# ---------------------------------------------------------- #
run-tests:
name: Tests
needs: setup-tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: Swatinem/rust-cache@v2
- name: Download contracts
uses: actions/download-artifact@v3
with:
name: contract-artifacts
path: starknet_py/tests/e2e/mock/
- uses: actions/setup-python@v4
with:
python-version: "3.12"
cache: 'pip'
# ====================== SETUP PYTHON ====================== #
- name: Install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config installer.modern-installation false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install dependencies
run: |
poetry install
# ====================== SETUP DEVNET ====================== #
- name: Install devnet
run: |
cargo install --locked \
--git https://github.com/0xSpaceShard/starknet-devnet-rs.git \
--rev ${{ env.DEVNET_SHA }}
# ====================== RUN TESTS ====================== #
- name: Check circular imports
run: |
poetry run poe circular_imports_check
- name: Run tests
run: |
poetry run poe test_ci_v2
poetry run poe test_ci_v1
- name: Generate coverage in XML
run: |
poetry run coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
# ---------------------------------------------------------- #
# ..................RUN-TESTS-ON-NETWORKS................... #
# ---------------------------------------------------------- #
run-tests-on-networks:
name: Tests on networks (testnet and integration)
needs: setup-tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
env:
GOERLI_INTEGRATION_RPC_URL: ${{ secrets.INTEGRATION_RPC_URL }}
GOERLI_TESTNET_RPC_URL: ${{ secrets.TESTNET_RPC_URL }}
SEPOLIA_INTEGRATION_RPC_URL: ${{ secrets.SEPOLIA_INTEGRATION_RPC_URL }}
SEPOLIA_TESTNET_RPC_URL: ${{ secrets.SEPOLIA_TESTNET_RPC_URL }}
GOERLI_INTEGRATION_ACCOUNT_PRIVATE_KEY: ${{ secrets.INTEGRATION_ACCOUNT_PRIVATE_KEY }}
GOERLI_INTEGRATION_ACCOUNT_ADDRESS: ${{ secrets.INTEGRATION_ACCOUNT_ADDRESS }}
GOERLI_TESTNET_ACCOUNT_PRIVATE_KEY: ${{ secrets.TESTNET_ACCOUNT_PRIVATE_KEY }}
GOERLI_TESTNET_ACCOUNT_ADDRESS: ${{ secrets.TESTNET_ACCOUNT_ADDRESS }}
steps:
- uses: actions/checkout@v3
- name: Download contracts
uses: actions/download-artifact@v3
with:
name: contract-artifacts
path: starknet_py/tests/e2e/mock/
- uses: actions/setup-python@v4
with:
python-version: "3.12"
cache: 'pip'
# ====================== SETUP PYTHON ====================== #
- name: Install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config installer.modern-installation false
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.12"
cache: 'poetry'
- name: Install dependencies
run: |
poetry install
# ====================== RUN TESTS ====================== #
- name: Check circular imports
run: |
poetry run poe circular_imports_check
- name: Run tests
run: |
poetry run poe test_ci_on_networks
- name: Generate coverage in XML
run: |
poetry run coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
# ---------------------------------------------------------- #
# ....................RUN-TESTS-WINDOWS..................... #
# ---------------------------------------------------------- #
run-tests-windows:
if: ${{ github.event_name != 'pull_request' }}
name: Tests Windows
needs: setup-tests
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: Swatinem/rust-cache@v2
- name: Download contracts
uses: actions/download-artifact@v3
with:
name: contract-artifacts
path: starknet_py/tests/e2e/mock/
- uses: actions/setup-python@v4
with:
python-version: "3.12"
cache: 'pip'
# ====================== SETUP DEVNET ====================== #
- name: Install devnet
run: cargo install --locked --git https://github.com/0xSpaceShard/starknet-devnet-rs.git --rev ${{ env.DEVNET_SHA }}
# ====================== SETUP PYTHON ====================== #
- name: Install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config installer.modern-installation false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install dependencies
run: |
poetry install
# ====================== RUN TESTS ====================== #
- name: Check circular imports
run: |
poetry run poe circular_imports_check
- name: Run tests
run: |
poetry run poe test_ci_v2
poetry run poe test_ci_v1
- name: Generate coverage in XML
run: |
poetry run coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
# ---------------------------------------------------------- #
# .....................RUN-DOCS-TESTS....................... #
# ---------------------------------------------------------- #
run-docs-tests:
name: Docs Tests
needs: setup-tests
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: Swatinem/rust-cache@v2
- name: Download contracts
uses: actions/download-artifact@v3
with:
name: contract-artifacts
path: starknet_py/tests/e2e/mock/
- uses: actions/setup-python@v4
with:
python-version: "3.12"
cache: 'pip'
# ====================== SETUP PYTHON ====================== #
- name: Install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config installer.modern-installation false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install dependencies
run: |
poetry install
# ====================== SETUP DEVNET ====================== #
- name: Install devnet
run: |
cargo install --locked \
--git https://github.com/0xSpaceShard/starknet-devnet-rs.git \
--rev ${{ env.DEVNET_SHA }}
# ====================== RUN TESTS ====================== #
- name: Run tests
run: |
poetry run poe test_ci_docs_v2
poetry run poe test_ci_docs_v1
- name: Generate coverage in XML
run: |
poetry run coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
# ---------------------------------------------------------- #
# .................RUN-DOCS-TESTS-WINDOWS................... #
# ---------------------------------------------------------- #
run-docs-tests-windows:
if: ${{ github.event_name != 'pull_request' }}
name: Docs Tests Windows
needs: setup-tests
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: [ "3.8", "3.9", "3.10", "3.11", "3.12" ]
steps:
- uses: actions/checkout@v3
- uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: Swatinem/rust-cache@v2
- name: Download contracts
uses: actions/download-artifact@v3
with:
name: contract-artifacts
path: starknet_py/tests/e2e/mock/
- uses: actions/setup-python@v4
with:
python-version: "3.12"
cache: 'pip'
# ====================== SETUP PYTHON ====================== #
- name: Install poetry
run: |
python -m pip install --upgrade pip
pip install poetry
poetry config installer.modern-installation false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'poetry'
- name: Install dependencies
run: |
poetry install
# ====================== SETUP DEVNET ====================== #
- name: Install devnet
run: cargo install --locked --git https://github.com/0xSpaceShard/starknet-devnet-rs.git --rev ${{ env.DEVNET_SHA }}
# ====================== RUN TESTS ====================== #
- name: Run tests
run: |
poetry run poe test_ci_docs_v2
poetry run poe test_ci_docs_v1
- name: Generate coverage in XML
run: |
poetry run coverage xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3