diff --git a/.circleci/config.yml b/.circleci/config.yml index 5c0ee85..9824ebb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,12 +1,18 @@ version: 2.1 -# heavily inspired by https://raw.githubusercontent.com/pinax/pinax-wiki/6bd2a99ab6f702e300d708532a6d1d9aa638b9f8/.circleci/config.yml - parameters: go_version: default: "1.22.4" type: string +supported_python_minor_versions: &supported_python_minor_versions + - "8" + - "9" + - "10" + - "11" + - "12" + - "13" + common_go_steps: &common_go_steps working_directory: ~/repo steps: @@ -50,778 +56,102 @@ common_go_steps: &common_go_steps orbs: win: circleci/windows@5.0.0 -windows-wheel-steps: - windows-wheel-setup: &windows-wheel-setup - executor: - name: win/default - shell: bash.exe - working_directory: C:\Users\circleci\project\py-geth - environment: - TOXENV: windows-wheel - restore-cache-step: &restore-cache-step - restore_cache: - keys: - - cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} - install-pyenv-step: &install-pyenv-step - run: - name: install pyenv - command: | - pip install pyenv-win --target $HOME/.pyenv - echo 'export PYENV="$HOME/.pyenv/pyenv-win/"' >> $BASH_ENV - echo 'export PYENV_ROOT="$HOME/.pyenv/pyenv-win/"' >> $BASH_ENV - echo 'export PYENV_USERPROFILE="$HOME/.pyenv/pyenv-win/"' >> $BASH_ENV - echo 'export PATH="$PATH:$HOME/.pyenv/pyenv-win/bin"' >> $BASH_ENV - echo 'export PATH="$PATH:$HOME/.pyenv/pyenv-win/shims"' >> $BASH_ENV - source $BASH_ENV - pyenv update - install-latest-python-step: &install-latest-python-step - run: - name: install latest python version and tox - command: | - LATEST_VERSION=$(pyenv install --list | grep -E "${MINOR_VERSION}\.[0-9]+$" | tail -1) - echo "installing python version $LATEST_VERSION" - pyenv install $LATEST_VERSION - pyenv global $LATEST_VERSION - python3 -m pip install --upgrade pip - python3 -m pip install tox - run-tox-step: &run-tox-step - run: - name: run tox - command: | - echo 'running tox with' $(python3 --version) - python3 -m tox run -r - save-cache-step: &save-cache-step - save_cache: - paths: - - .tox - key: cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} - jobs: - py38-install-geth-v1_14_0: - <<: *common_go_steps - docker: - - image: cimg/python:3.8 - environment: - GETH_VERSION: v1.14.0 - TOXENV: py38-install-geth-v1_14_0 - py39-install-geth-v1_14_0: - <<: *common_go_steps - docker: - - image: cimg/python:3.9 - environment: - GETH_VERSION: v1.14.0 - TOXENV: py39-install-geth-v1_14_0 - py310-install-geth-v1_14_0: - <<: *common_go_steps - docker: - - image: cimg/python:3.10 - environment: - GETH_VERSION: v1.14.0 - TOXENV: py310-install-geth-v1_14_0 - py311-install-geth-v1_14_0: - <<: *common_go_steps - docker: - - image: cimg/python:3.11 - environment: - GETH_VERSION: v1.14.0 - TOXENV: py311-install-geth-v1_14_0 - py312-install-geth-v1_14_0: - <<: *common_go_steps - docker: - - image: cimg/python:3.12 - environment: - GETH_VERSION: v1.14.0 - TOXENV: py312-install-geth-v1_14_0 - py313-install-geth-v1_14_0: - <<: *common_go_steps - docker: - - image: cimg/python:3.13 - environment: - GETH_VERSION: v1.14.0 - TOXENV: py313-install-geth-v1_14_0 - py38-install-geth-v1_14_2: - <<: *common_go_steps - docker: - - image: cimg/python:3.8 - environment: - GETH_VERSION: v1.14.2 - TOXENV: py38-install-geth-v1_14_2 - py39-install-geth-v1_14_2: - <<: *common_go_steps - docker: - - image: cimg/python:3.9 - environment: - GETH_VERSION: v1.14.2 - TOXENV: py39-install-geth-v1_14_2 - py310-install-geth-v1_14_2: - <<: *common_go_steps - docker: - - image: cimg/python:3.10 - environment: - GETH_VERSION: v1.14.2 - TOXENV: py310-install-geth-v1_14_2 - py311-install-geth-v1_14_2: - <<: *common_go_steps - docker: - - image: cimg/python:3.11 - environment: - GETH_VERSION: v1.14.2 - TOXENV: py311-install-geth-v1_14_2 - py312-install-geth-v1_14_2: - <<: *common_go_steps - docker: - - image: cimg/python:3.12 - environment: - GETH_VERSION: v1.14.2 - TOXENV: py312-install-geth-v1_14_2 - py313-install-geth-v1_14_2: - <<: *common_go_steps - docker: - - image: cimg/python:3.13 - environment: - GETH_VERSION: v1.14.2 - TOXENV: py313-install-geth-v1_14_2 - py38-install-geth-v1_14_3: - <<: *common_go_steps - docker: - - image: cimg/python:3.8 - environment: - GETH_VERSION: v1.14.3 - TOXENV: py38-install-geth-v1_14_3 - py39-install-geth-v1_14_3: - <<: *common_go_steps - docker: - - image: cimg/python:3.9 - environment: - GETH_VERSION: v1.14.3 - TOXENV: py39-install-geth-v1_14_3 - py310-install-geth-v1_14_3: - <<: *common_go_steps - docker: - - image: cimg/python:3.10 - environment: - GETH_VERSION: v1.14.3 - TOXENV: py310-install-geth-v1_14_3 - py311-install-geth-v1_14_3: - <<: *common_go_steps - docker: - - image: cimg/python:3.11 - environment: - GETH_VERSION: v1.14.3 - TOXENV: py311-install-geth-v1_14_3 - py312-install-geth-v1_14_3: - <<: *common_go_steps - docker: - - image: cimg/python:3.12 - environment: - GETH_VERSION: v1.14.3 - TOXENV: py312-install-geth-v1_14_3 - py313-install-geth-v1_14_3: - <<: *common_go_steps - docker: - - image: cimg/python:3.13 - environment: - GETH_VERSION: v1.14.3 - TOXENV: py313-install-geth-v1_14_3 - py38-install-geth-v1_14_4: - <<: *common_go_steps - docker: - - image: cimg/python:3.8 - environment: - GETH_VERSION: v1.14.4 - TOXENV: py38-install-geth-v1_14_4 - py39-install-geth-v1_14_4: - <<: *common_go_steps - docker: - - image: cimg/python:3.9 - environment: - GETH_VERSION: v1.14.4 - TOXENV: py39-install-geth-v1_14_4 - py310-install-geth-v1_14_4: - <<: *common_go_steps - docker: - - image: cimg/python:3.10 - environment: - GETH_VERSION: v1.14.4 - TOXENV: py310-install-geth-v1_14_4 - py311-install-geth-v1_14_4: - <<: *common_go_steps - docker: - - image: cimg/python:3.11 - environment: - GETH_VERSION: v1.14.4 - TOXENV: py311-install-geth-v1_14_4 - py312-install-geth-v1_14_4: - <<: *common_go_steps - docker: - - image: cimg/python:3.12 - environment: - GETH_VERSION: v1.14.4 - TOXENV: py312-install-geth-v1_14_4 - py313-install-geth-v1_14_4: - <<: *common_go_steps - docker: - - image: cimg/python:3.13 - environment: - GETH_VERSION: v1.14.4 - TOXENV: py313-install-geth-v1_14_4 - py38-install-geth-v1_14_5: - <<: *common_go_steps - docker: - - image: cimg/python:3.8 - environment: - GETH_VERSION: v1.14.5 - TOXENV: py38-install-geth-v1_14_5 - py39-install-geth-v1_14_5: - <<: *common_go_steps - docker: - - image: cimg/python:3.9 - environment: - GETH_VERSION: v1.14.5 - TOXENV: py39-install-geth-v1_14_5 - py310-install-geth-v1_14_5: - <<: *common_go_steps - docker: - - image: cimg/python:3.10 - environment: - GETH_VERSION: v1.14.5 - TOXENV: py310-install-geth-v1_14_5 - py311-install-geth-v1_14_5: - <<: *common_go_steps - docker: - - image: cimg/python:3.11 - environment: - GETH_VERSION: v1.14.5 - TOXENV: py311-install-geth-v1_14_5 - py312-install-geth-v1_14_5: - <<: *common_go_steps - docker: - - image: cimg/python:3.12 - environment: - GETH_VERSION: v1.14.5 - TOXENV: py312-install-geth-v1_14_5 - py313-install-geth-v1_14_5: - <<: *common_go_steps - docker: - - image: cimg/python:3.13 - environment: - GETH_VERSION: v1.14.5 - TOXENV: py313-install-geth-v1_14_5 - py38-install-geth-v1_14_6: - <<: *common_go_steps - docker: - - image: cimg/python:3.8 - environment: - GETH_VERSION: v1.14.6 - TOXENV: py38-install-geth-v1_14_6 - py39-install-geth-v1_14_6: - <<: *common_go_steps - docker: - - image: cimg/python:3.9 - environment: - GETH_VERSION: v1.14.6 - TOXENV: py39-install-geth-v1_14_6 - py310-install-geth-v1_14_6: - <<: *common_go_steps - docker: - - image: cimg/python:3.10 - environment: - GETH_VERSION: v1.14.6 - TOXENV: py310-install-geth-v1_14_6 - py311-install-geth-v1_14_6: - <<: *common_go_steps - docker: - - image: cimg/python:3.11 - environment: - GETH_VERSION: v1.14.6 - TOXENV: py311-install-geth-v1_14_6 - py312-install-geth-v1_14_6: - <<: *common_go_steps - docker: - - image: cimg/python:3.12 - environment: - GETH_VERSION: v1.14.6 - TOXENV: py312-install-geth-v1_14_6 - py313-install-geth-v1_14_6: - <<: *common_go_steps - docker: - - image: cimg/python:3.13 - environment: - GETH_VERSION: v1.14.6 - TOXENV: py313-install-geth-v1_14_6 - py38-install-geth-v1_14_7: - <<: *common_go_steps - docker: - - image: cimg/python:3.8 - environment: - GETH_VERSION: v1.14.7 - TOXENV: py38-install-geth-v1_14_7 - py39-install-geth-v1_14_7: - <<: *common_go_steps - docker: - - image: cimg/python:3.9 - environment: - GETH_VERSION: v1.14.7 - TOXENV: py39-install-geth-v1_14_7 - py310-install-geth-v1_14_7: - <<: *common_go_steps - docker: - - image: cimg/python:3.10 - environment: - GETH_VERSION: v1.14.7 - TOXENV: py310-install-geth-v1_14_7 - py311-install-geth-v1_14_7: - <<: *common_go_steps - docker: - - image: cimg/python:3.11 - environment: - GETH_VERSION: v1.14.7 - TOXENV: py311-install-geth-v1_14_7 - py312-install-geth-v1_14_7: - <<: *common_go_steps - docker: - - image: cimg/python:3.12 - environment: - GETH_VERSION: v1.14.7 - TOXENV: py312-install-geth-v1_14_7 - py313-install-geth-v1_14_7: - <<: *common_go_steps - docker: - - image: cimg/python:3.13 - environment: - GETH_VERSION: v1.14.7 - TOXENV: py313-install-geth-v1_14_7 - py38-install-geth-v1_14_8: - <<: *common_go_steps - docker: - - image: cimg/python:3.8 - environment: - GETH_VERSION: v1.14.8 - TOXENV: py38-install-geth-v1_14_8 - py39-install-geth-v1_14_8: - <<: *common_go_steps - docker: - - image: cimg/python:3.9 - environment: - GETH_VERSION: v1.14.8 - TOXENV: py39-install-geth-v1_14_8 - py310-install-geth-v1_14_8: - <<: *common_go_steps - docker: - - image: cimg/python:3.10 - environment: - GETH_VERSION: v1.14.8 - TOXENV: py310-install-geth-v1_14_8 - py311-install-geth-v1_14_8: - <<: *common_go_steps - docker: - - image: cimg/python:3.11 - environment: - GETH_VERSION: v1.14.8 - TOXENV: py311-install-geth-v1_14_8 - py312-install-geth-v1_14_8: - <<: *common_go_steps - docker: - - image: cimg/python:3.12 - environment: - GETH_VERSION: v1.14.8 - TOXENV: py312-install-geth-v1_14_8 - py313-install-geth-v1_14_8: + common: + parameters: + python_minor_version: + type: string + tox_env: + type: string <<: *common_go_steps docker: - - image: cimg/python:3.13 - environment: - GETH_VERSION: v1.14.8 - TOXENV: py313-install-geth-v1_14_8 - py38-install-geth-v1_14_9: - <<: *common_go_steps - docker: - - image: cimg/python:3.8 - environment: - GETH_VERSION: v1.14.9 - TOXENV: py38-install-geth-v1_14_9 - py39-install-geth-v1_14_9: - <<: *common_go_steps - docker: - - image: cimg/python:3.9 - environment: - GETH_VERSION: v1.14.9 - TOXENV: py39-install-geth-v1_14_9 - py310-install-geth-v1_14_9: - <<: *common_go_steps - docker: - - image: cimg/python:3.10 - environment: - GETH_VERSION: v1.14.9 - TOXENV: py310-install-geth-v1_14_9 - py311-install-geth-v1_14_9: - <<: *common_go_steps - docker: - - image: cimg/python:3.11 - environment: - GETH_VERSION: v1.14.9 - TOXENV: py311-install-geth-v1_14_9 - py312-install-geth-v1_14_9: - <<: *common_go_steps - docker: - - image: cimg/python:3.12 - environment: - GETH_VERSION: v1.14.9 - TOXENV: py312-install-geth-v1_14_9 - py313-install-geth-v1_14_9: - <<: *common_go_steps - docker: - - image: cimg/python:3.13 - environment: - GETH_VERSION: v1.14.9 - TOXENV: py313-install-geth-v1_14_9 - py38-install-geth-v1_14_10: - <<: *common_go_steps - docker: - - image: cimg/python:3.8 - environment: - GETH_VERSION: v1.14.10 - TOXENV: py38-install-geth-v1_14_10 - py39-install-geth-v1_14_10: - <<: *common_go_steps - docker: - - image: cimg/python:3.9 - environment: - GETH_VERSION: v1.14.10 - TOXENV: py39-install-geth-v1_14_10 - py310-install-geth-v1_14_10: - <<: *common_go_steps - docker: - - image: cimg/python:3.10 - environment: - GETH_VERSION: v1.14.10 - TOXENV: py310-install-geth-v1_14_10 - py311-install-geth-v1_14_10: - <<: *common_go_steps - docker: - - image: cimg/python:3.11 - environment: - GETH_VERSION: v1.14.10 - TOXENV: py311-install-geth-v1_14_10 - py312-install-geth-v1_14_10: - <<: *common_go_steps - docker: - - image: cimg/python:3.12 - environment: - GETH_VERSION: v1.14.10 - TOXENV: py312-install-geth-v1_14_10 - py313-install-geth-v1_14_10: - <<: *common_go_steps - docker: - - image: cimg/python:3.13 - environment: - GETH_VERSION: v1.14.10 - TOXENV: py313-install-geth-v1_14_10 - py38-install-geth-v1_14_11: - <<: *common_go_steps - docker: - - image: cimg/python:3.8 - environment: - GETH_VERSION: v1.14.11 - TOXENV: py38-install-geth-v1_14_11 - py39-install-geth-v1_14_11: - <<: *common_go_steps - docker: - - image: cimg/python:3.9 - environment: - GETH_VERSION: v1.14.11 - TOXENV: py39-install-geth-v1_14_11 - py310-install-geth-v1_14_11: - <<: *common_go_steps - docker: - - image: cimg/python:3.10 - environment: - GETH_VERSION: v1.14.11 - TOXENV: py310-install-geth-v1_14_11 - py311-install-geth-v1_14_11: - <<: *common_go_steps - docker: - - image: cimg/python:3.11 - environment: - GETH_VERSION: v1.14.11 - TOXENV: py311-install-geth-v1_14_11 - py312-install-geth-v1_14_11: - <<: *common_go_steps - docker: - - image: cimg/python:3.12 - environment: - GETH_VERSION: v1.14.11 - TOXENV: py312-install-geth-v1_14_11 - py313-install-geth-v1_14_11: - <<: *common_go_steps - docker: - - image: cimg/python:3.13 - environment: - GETH_VERSION: v1.14.11 - TOXENV: py313-install-geth-v1_14_11 - py38-install-geth-v1_14_12: - <<: *common_go_steps - docker: - - image: cimg/python:3.8 - environment: - GETH_VERSION: v1.14.12 - TOXENV: py38-install-geth-v1_14_12 - py39-install-geth-v1_14_12: - <<: *common_go_steps - docker: - - image: cimg/python:3.9 - environment: - GETH_VERSION: v1.14.12 - TOXENV: py39-install-geth-v1_14_12 - py310-install-geth-v1_14_12: - <<: *common_go_steps - docker: - - image: cimg/python:3.10 - environment: - GETH_VERSION: v1.14.12 - TOXENV: py310-install-geth-v1_14_12 - py311-install-geth-v1_14_12: - <<: *common_go_steps - docker: - - image: cimg/python:3.11 - environment: - GETH_VERSION: v1.14.12 - TOXENV: py311-install-geth-v1_14_12 - py312-install-geth-v1_14_12: - <<: *common_go_steps - docker: - - image: cimg/python:3.12 - environment: - GETH_VERSION: v1.14.12 - TOXENV: py312-install-geth-v1_14_12 - py313-install-geth-v1_14_12: - <<: *common_go_steps - docker: - - image: cimg/python:3.13 - environment: - GETH_VERSION: v1.14.12 - TOXENV: py313-install-geth-v1_14_12 - - py38-lint: - <<: *common_go_steps - docker: - - image: cimg/python:3.8 - environment: - TOXENV: py38-lint - py39-lint: - <<: *common_go_steps - docker: - - image: cimg/python:3.9 - environment: - TOXENV: py39-lint - py310-lint: - <<: *common_go_steps - docker: - - image: cimg/python:3.10 - environment: - TOXENV: py310-lint - py311-lint: - <<: *common_go_steps - docker: - - image: cimg/python:3.11 - environment: - TOXENV: py311-lint - py312-lint: - <<: *common_go_steps - docker: - - image: cimg/python:3.12 - environment: - TOXENV: py312-lint - py313-lint: - <<: *common_go_steps - docker: - - image: cimg/python:3.13 - environment: - TOXENV: py313-lint + - image: cimg/python:3.<< parameters.python_minor_version >> + environment: + TOXENV: py3<< parameters.python_minor_version >>-<< parameters.tox_env >> - py38-wheel: - <<: *common_go_steps - docker: - - image: cimg/python:3.8 - environment: - TOXENV: py38-wheel - py39-wheel: + install-geth: + parameters: + python_minor_version: + type: string + geth_version: + type: string <<: *common_go_steps docker: - - image: cimg/python:3.9 - environment: - TOXENV: py39-wheel - py310-wheel: - <<: *common_go_steps - docker: - - image: cimg/python:3.10 - environment: - TOXENV: py310-wheel - py311-wheel: - <<: *common_go_steps - docker: - - image: cimg/python:3.11 - environment: - TOXENV: py311-wheel - py312-wheel: - <<: *common_go_steps - docker: - - image: cimg/python:3.12 - environment: - TOXENV: py312-wheel - py313-wheel: - <<: *common_go_steps - docker: - - image: cimg/python:3.13 - environment: - TOXENV: py313-wheel + - image: cimg/python:3.<< parameters.python_minor_version >> + environment: + GETH_VERSION: v<< parameters.geth_version >> + TOXENV: py3<< parameters.python_minor_version >>-install-geth-v<< parameters.geth_version >> - py311-windows-wheel: - <<: *windows-wheel-setup + windows-wheel: + parameters: + python_minor_version: + type: string + executor: + name: win/default + shell: bash.exe + working_directory: C:\Users\circleci\project\py-geth + environment: + TOXENV: windows-wheel steps: - checkout - - <<: *restore-cache-step - - <<: *install-pyenv-step + - restore_cache: + keys: + - cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} - run: - name: set minor version - command: echo "export MINOR_VERSION='3.11'" >> $BASH_ENV - - <<: *install-latest-python-step - - <<: *run-tox-step - - <<: *save-cache-step - - py312-windows-wheel: - <<: *windows-wheel-setup - steps: - - checkout - - <<: *restore-cache-step - - <<: *install-pyenv-step + name: install pyenv + command: | + pip install pyenv-win --target $HOME/.pyenv + echo 'export PYENV="$HOME/.pyenv/pyenv-win/"' >> $BASH_ENV + echo 'export PYENV_ROOT="$HOME/.pyenv/pyenv-win/"' >> $BASH_ENV + echo 'export PYENV_USERPROFILE="$HOME/.pyenv/pyenv-win/"' >> $BASH_ENV + echo 'export PATH="$PATH:$HOME/.pyenv/pyenv-win/bin"' >> $BASH_ENV + echo 'export PATH="$PATH:$HOME/.pyenv/pyenv-win/shims"' >> $BASH_ENV + source $BASH_ENV + pyenv update - run: - name: set minor version - command: echo "export MINOR_VERSION='3.12'" >> $BASH_ENV - - <<: *install-latest-python-step - - <<: *run-tox-step - - <<: *save-cache-step - - py313-windows-wheel: - <<: *windows-wheel-setup - steps: - - checkout - - <<: *restore-cache-step - - <<: *install-pyenv-step + name: install latest python version and tox + command: | + LATEST_VERSION=$(pyenv install --list | grep -E "^\s*3\.<< parameters.python_minor_version >>\.[0-9]+$" | tail -1 | tr -d ' ') + echo "Installing python version $LATEST_VERSION" + pyenv install $LATEST_VERSION + pyenv global $LATEST_VERSION + python3 -m pip install --upgrade pip + python3 -m pip install tox - run: - name: set minor version - command: echo "export MINOR_VERSION='3.13'" >> $BASH_ENV - - <<: *install-latest-python-step - - <<: *run-tox-step - - <<: *save-cache-step - -define: &all_jobs - - py38-install-geth-v1_14_0 - - py39-install-geth-v1_14_0 - - py310-install-geth-v1_14_0 - - py311-install-geth-v1_14_0 - - py312-install-geth-v1_14_0 - - py313-install-geth-v1_14_0 - - - py38-install-geth-v1_14_2 - - py39-install-geth-v1_14_2 - - py310-install-geth-v1_14_2 - - py311-install-geth-v1_14_2 - - py312-install-geth-v1_14_2 - - py313-install-geth-v1_14_2 - - - py38-install-geth-v1_14_3 - - py39-install-geth-v1_14_3 - - py310-install-geth-v1_14_3 - - py311-install-geth-v1_14_3 - - py312-install-geth-v1_14_3 - - py313-install-geth-v1_14_3 - - - py38-install-geth-v1_14_4 - - py39-install-geth-v1_14_4 - - py310-install-geth-v1_14_4 - - py311-install-geth-v1_14_4 - - py312-install-geth-v1_14_4 - - py313-install-geth-v1_14_4 - - - py38-install-geth-v1_14_5 - - py39-install-geth-v1_14_5 - - py310-install-geth-v1_14_5 - - py311-install-geth-v1_14_5 - - py312-install-geth-v1_14_5 - - py313-install-geth-v1_14_5 - - - py38-install-geth-v1_14_6 - - py39-install-geth-v1_14_6 - - py310-install-geth-v1_14_6 - - py311-install-geth-v1_14_6 - - py312-install-geth-v1_14_6 - - py313-install-geth-v1_14_6 - - - py38-install-geth-v1_14_7 - - py39-install-geth-v1_14_7 - - py310-install-geth-v1_14_7 - - py311-install-geth-v1_14_7 - - py312-install-geth-v1_14_7 - - py313-install-geth-v1_14_7 - - - py38-install-geth-v1_14_8 - - py39-install-geth-v1_14_8 - - py310-install-geth-v1_14_8 - - py311-install-geth-v1_14_8 - - py312-install-geth-v1_14_8 - - py313-install-geth-v1_14_8 - - - py38-install-geth-v1_14_9 - - py39-install-geth-v1_14_9 - - py310-install-geth-v1_14_9 - - py311-install-geth-v1_14_9 - - py312-install-geth-v1_14_9 - - py313-install-geth-v1_14_9 - - - py38-install-geth-v1_14_10 - - py39-install-geth-v1_14_10 - - py310-install-geth-v1_14_10 - - py311-install-geth-v1_14_10 - - py312-install-geth-v1_14_10 - - py313-install-geth-v1_14_10 - - - py38-install-geth-v1_14_11 - - py39-install-geth-v1_14_11 - - py310-install-geth-v1_14_11 - - py311-install-geth-v1_14_11 - - py312-install-geth-v1_14_11 - - py313-install-geth-v1_14_11 - - - py38-install-geth-v1_14_12 - - py39-install-geth-v1_14_12 - - py310-install-geth-v1_14_12 - - py311-install-geth-v1_14_12 - - py312-install-geth-v1_14_12 - - py313-install-geth-v1_14_12 - - - py38-lint - - py39-lint - - py310-lint - - py311-lint - - py312-lint - - py313-lint - - - py38-wheel - - py39-wheel - - py310-wheel - - py311-wheel - - py312-wheel - - py313-wheel - - - py311-windows-wheel - - py312-windows-wheel - - py313-windows-wheel + name: run tox + command: | + echo 'running tox with' $(python3 --version) + python3 -m tox run -r + - save_cache: + paths: + - .tox + key: cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }} workflows: version: 2 test: - jobs: *all_jobs + jobs: &all_jobs + - common: + matrix: + parameters: + python_minor_version: *supported_python_minor_versions + tox_env: ["lint", "wheel"] + name: "py3<< matrix.python_minor_version >>-<< matrix.tox_env >>" + - install-geth: + matrix: + parameters: + python_minor_version: *supported_python_minor_versions + geth_version: [ + "1_14_0", "1_14_2", "1_14_3", "1_14_4", "1_14_5", "1_14_6", + "1_14_7", "1_14_8", "1_14_9", "1_14_10", "1_14_11", "1_14_12", + ] + name: "py3<< matrix.python_minor_version >>-install-geth-v<< matrix.geth_version >>" + - windows-wheel: + matrix: + parameters: + python_minor_version: [ "11", "12", "13" ] + name: "py3<< matrix.python_minor_version >>-windows-wheel" + nightly: triggers: - schedule: diff --git a/.circleci/install_geth.sh b/.circleci/install_geth.sh index 2d09f24..4d3be76 100755 --- a/.circleci/install_geth.sh +++ b/.circleci/install_geth.sh @@ -1,13 +1,18 @@ #!/usr/bin/env bash python --version -echo $GETH_VERSION + +# convert underscored `GETH_VERSION` to dotted format +GETH_VERSION=${GETH_VERSION//_/\.} +export GETH_VERSION +echo "Using Geth version: $GETH_VERSION" + export GETH_BASE_INSTALL_PATH=~/repo/install/ -mkdir -p $HOME/.ethash -if [ -n "$GETH_VERSION" ]; then python -m geth.install $GETH_VERSION; fi + +if [ -n "$GETH_VERSION" ]; then python -m geth.install "$GETH_VERSION"; fi if [ -n "$GETH_VERSION" ]; then export GETH_BINARY="$GETH_BASE_INSTALL_PATH/geth-$GETH_VERSION/bin/geth"; fi if [ -n "$GETH_VERSION" ]; then $GETH_BINARY version; fi # Modifying the path is tough with tox, hence copying the executable # to a known directory which is included in $PATH -cp $GETH_BINARY $HOME/.local/bin +cp "$GETH_BINARY" "$HOME"/.local/bin diff --git a/newsfragments/244.internal.rst b/newsfragments/244.internal.rst new file mode 100644 index 0000000..73058e9 --- /dev/null +++ b/newsfragments/244.internal.rst @@ -0,0 +1 @@ +Re-organize circleci config, making use of ``matrix``, to parametrize CI jobs and reduce code duplication. diff --git a/update_geth.py b/update_geth.py index 35af435..d907fb5 100644 --- a/update_geth.py +++ b/update_geth.py @@ -25,6 +25,7 @@ import sys GETH_VERSION_REGEX = re.compile(r"v\d*_\d+") # v0_0_0 pattern +GETH_VERSION_REGEX_NO_V = re.compile(r"\d*_\d+") # 0_0_0 pattern currently_supported_geth_versions = [] with open("tox.ini") as tox_ini: @@ -47,11 +48,6 @@ LATEST_SUPPORTED_GETH_VERSION = currently_supported_geth_versions[-1] LATEST_PYTHON_VERSION = circleci_python_versions[-1] -# .circleci/config.yml pattern -CIRCLE_CI_PATTERN = { - "jobs": "", - "workflow_test_jobs": "", -} # geth/install.py pattern GETH_INSTALL_PATTERN = { "versions": "", @@ -61,7 +57,7 @@ user_provided_versions = sys.argv[1:] normalized_user_versions = [] -for index, user_provided_version in enumerate(user_provided_versions): +for user_provided_version in user_provided_versions: if "v" not in user_provided_version: user_provided_version = f"v{user_provided_version}" normalized_user_versions.append(user_provided_version) @@ -78,26 +74,6 @@ ) latest_user_provided_version = normalized_user_versions[-1] - # set up .circleci/config.yml pattern - if index > 0: - CIRCLE_CI_PATTERN["workflow_test_jobs"] += "\n" - - for py_version in circleci_python_versions: - py_version_decimal = f"{py_version[0]}.{py_version[1:]}" - CIRCLE_CI_PATTERN["jobs"] += ( - f" py{py_version}-install-geth-{user_provided_version}:\n" - f" <<: *common_go_steps\n" - " docker:\n" - f" - image: cimg/python:{py_version_decimal}\n" - " environment:\n" - f" GETH_VERSION: {user_provided_version.replace('_', '.')}\n" - f" TOXENV: py{py_version}-install-geth-{user_provided_version}\n" - ) - - CIRCLE_CI_PATTERN[ - "workflow_test_jobs" - ] += f"\n - py{py_version}-install-geth-{user_provided_version}" - # set up geth/install.py pattern user_version_upper = user_provided_version.upper() user_version_period = user_provided_version.replace("_", ".") @@ -114,26 +90,33 @@ "version<->install" ] += f" {user_version_upper}: {user_version_install},\n" + +ALL_VERSIONS = currently_supported_geth_versions + normalized_user_versions + # update .circleci/config.yml versions with fileinput.FileInput(".circleci/config.yml", inplace=True) as cci_config: + all_versions_no_v = [version[1:] for version in ALL_VERSIONS] + in_geth_versions = False for line in cci_config: - if ( - f"TOXENV: py{LATEST_PYTHON_VERSION}-install-geth-{LATEST_SUPPORTED_GETH_VERSION}" # noqa: E501 - ) in line: - print( - f" TOXENV: py{LATEST_PYTHON_VERSION}-install-geth-" - f"{LATEST_SUPPORTED_GETH_VERSION}\n" + CIRCLE_CI_PATTERN["jobs"], - end="", - ) - elif ( - f"- py{LATEST_PYTHON_VERSION}-install-geth-{LATEST_SUPPORTED_GETH_VERSION}" - ) in line: - print( - f" - py{LATEST_PYTHON_VERSION}-install-geth-{LATEST_SUPPORTED_GETH_VERSION}\n" # noqa: E501 - + CIRCLE_CI_PATTERN["workflow_test_jobs"] - ) + if in_geth_versions: + print(" ", end="") + for num, v in enumerate(all_versions_no_v, start=1): + if num == len(all_versions_no_v): + print(f'"{v}"', end="\n") + # at most 6 versions per line + elif not num % 6: + print(f'"{v}",\n ', end="") + else: + print(f'"{v}"', end=", ") + in_geth_versions = False else: - print(line, end="") + if "geth_version: [" in line: + in_geth_versions = True + if GETH_VERSION_REGEX_NO_V.search(line): + # clean up the older version lines + print(end="") + else: + print(line, end="") # update geth/install.py versions with fileinput.FileInput("geth/install.py", inplace=True) as geth_install: @@ -175,13 +158,12 @@ # update tox.ini versions with fileinput.FileInput("tox.ini", inplace=True) as tox_ini: - all_versions = currently_supported_geth_versions + normalized_user_versions write_versions = False for line in tox_ini: if write_versions: print(" ", end="") - for num, v in enumerate(all_versions, start=1): - if num == len(all_versions): + for num, v in enumerate(ALL_VERSIONS, start=1): + if num == len(ALL_VERSIONS): print(f"{v} \\") elif not num % 7: print(f"{v}, \\\n ", end="")