Files
py-libp2p/.circleci/config.yml

316 lines
7.9 KiB
YAML

version: 2.1
# heavily inspired by https://raw.githubusercontent.com/pinax/pinax-wiki/6bd2a99ab6f702e300d708532a6d1d9aa638b9f8/.circleci/config.yml
common: &common
working_directory: ~/repo
steps:
- checkout
- run:
name: merge pull request base
command: ./.circleci/merge_pr.sh
- run:
name: merge pull request base (2nd try)
command: ./.circleci/merge_pr.sh
when: on_fail
- run:
name: merge pull request base (3rd try)
command: ./.circleci/merge_pr.sh
when: on_fail
- restore_cache:
keys:
- cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
- run:
name: install dependencies
command: |
python -m pip install --upgrade pip
python -m pip install tox
- run:
name: run tox
command: python -m tox run -r
- save_cache:
paths:
- .hypothesis
- .tox
- ~/.cache/pip
- ~/.local
key: cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
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-libp2p
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" }}
docs: &docs
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
- run:
name: install dependencies
command: |
python -m pip install --upgrade pip
python -m pip install tox
- run:
name: install latexpdf dependencies
command: |
sudo apt-get update
sudo apt-get install latexmk tex-gyre texlive-fonts-extra
- run:
name: run tox
command: python -m tox run -r
- save_cache:
paths:
- .tox
- ~/.cache/pip
- ~/.local
key: cache-v1-{{ arch }}-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
resource_class: xlarge
interop: &interop
docker:
- image: common
steps:
- run:
name: install interop test dependencies
command: |
sudo apt-get update
wget https://dl.google.com/go/$GOBINPKG
sudo tar -C /usr/local -xzf $GOBINPKG
export GOPATH=$HOME/go
export GOROOT=/usr/local/go
export PATH=$GOROOT/bin:$GOPATH/bin:$PATH
./tests_interop/go_pkgs/install_interop_go_pkgs.sh
jobs:
docs:
<<: *docs
docker:
- image: cimg/python:3.9
environment:
TOXENV: docs
py38-core:
<<: *common
docker:
- image: cimg/python:3.8
environment:
TOXENV: py38-core
py39-core:
<<: *common
docker:
- image: cimg/python:3.9
environment:
TOXENV: py39-core
py310-core:
<<: *common
docker:
- image: cimg/python:3.10
environment:
TOXENV: py310-core
py311-core:
<<: *common
docker:
- image: cimg/python:3.11
environment:
TOXENV: py311-core
py312-core:
<<: *common
docker:
- image: cimg/python:3.12
environment:
TOXENV: py312-core
py38-lint:
<<: *common
docker:
- image: cimg/python:3.8
environment:
TOXENV: py38-lint
py39-lint:
<<: *common
docker:
- image: cimg/python:3.9
environment:
TOXENV: py39-lint
py310-lint:
<<: *common
docker:
- image: cimg/python:3.10
environment:
TOXENV: py310-lint
py311-lint:
<<: *common
docker:
- image: cimg/python:3.11
environment:
TOXENV: py311-lint
py312-lint:
<<: *common
docker:
- image: cimg/python:3.12
environment:
TOXENV: py312-lint
py38-wheel:
<<: *common
docker:
- image: cimg/python:3.8
environment:
TOXENV: py38-wheel
py39-wheel:
<<: *common
docker:
- image: cimg/python:3.9
environment:
TOXENV: py39-wheel
py310-wheel:
<<: *common
docker:
- image: cimg/python:3.10
environment:
TOXENV: py310-wheel
py311-wheel:
<<: *common
docker:
- image: cimg/python:3.11
environment:
TOXENV: py311-wheel
py312-wheel:
<<: *common
docker:
- image: cimg/python:3.12
environment:
TOXENV: py312-wheel
py311-windows-wheel:
<<: *windows-wheel-setup
steps:
- checkout
- <<: *restore-cache-step
- <<: *install-pyenv-step
- 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
- run:
name: set minor version
command: echo "export MINOR_VERSION='3.12'" >> $BASH_ENV
- <<: *install-latest-python-step
- <<: *run-tox-step
- <<: *save-cache-step
py38-interop:
<<: *interop
docker:
- image: cimg/python:3.8
environment:
TOXENV: py38-interop
py39-interop:
<<: *interop
docker:
- image: cimg/python:3.9
environment:
TOXENV: py39-interop
py310-interop:
<<: *interop
docker:
- image: cimg/python:3.10
environment:
TOXENV: py310-interop
py311-interop:
<<: *interop
docker:
- image: cimg/python:3.11
environment:
TOXENV: py311-interop
py312-interop:
<<: *interop
docker:
- image: cimg/python:3.12
environment:
TOXENV: py312-interop
workflows:
version: 2
test:
jobs:
- docs
- py38-core
- py39-core
- py310-core
- py311-core
- py312-core
- py38-lint
- py39-lint
- py310-lint
- py311-lint
- py312-lint
- py38-wheel
- py39-wheel
- py310-wheel
- py311-wheel
- py312-wheel
# - py311-windows-wheel
# - py312-windows-wheel
# - py38-interop
# - py39-interop
# - py310-interop
# - py311-interop
# - py312-interop