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

Add matrix ci tests for python versions 3.9 - 3.11 #218

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
95 changes: 67 additions & 28 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,13 @@ version: 2.1

executors:
standard:
parameters:
version:
description: "python version"
default: "3.9"
type: string
docker:
- image: circleci/python:3.9
- image: cimg/python:<< parameters.version >>
environment:
PIPENV_VENV_IN_PROJECT: true
working_directory: "~/lib"
Expand Down Expand Up @@ -42,54 +47,80 @@ commands:
- "./.git"

update_virtualenv:
parameters:
version:
description: "python version"
type: string
steps:
- restore_cache:
keys:
- virtualenv-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- virtualenv-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-
- virtualenv-{{ .Environment.CACHE_VERSION }}-
- virtualenv-<< parameters.version >>-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- virtualenv-<< parameters.version >>-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-
- virtualenv-<< parameters.version >>-{{ .Environment.CACHE_VERSION }}-
- configure_github
- run:
name: Install Python packages
command: make sync
- save_cache:
key: virtualenv-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
key: virtualenv-<< parameters.version >>-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
paths:
- "./.venv"

jobs:
lint:
executor: standard
parameters:
version:
description: "python version"
default: "3.9"
type: string
executor:
name: standard
version: << parameters.version >>
steps:
- checkout_source
- update_virtualenv
- update_virtualenv:
version: << parameters.version >>
- run:
name: Run Python linter
command: make lint

unit:
executor: standard
parameters:
version:
description: "python version"
default: "3.9"
type: string
executor:
name: standard
version: << parameters.version >>
steps:
- checkout_source
- update_virtualenv
- update_virtualenv:
version: << parameters.version >>
- run:
name: Run Python unit tests
command: make unit

release:
parameters:
version:
description: "python version"
default: "3.9"
type: string
working_directory: ~/lib

docker:
- image: circleci/python:3.9
- image: cimg/python:<< parameters.version >>

steps:
- checkout_source
- update_virtualenv
- update_virtualenv:
version: << parameters.version >>
- restore_cache:
keys:
- pip-cache-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- pip-cache-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-
- pip-cache-{{ .Environment.CACHE_VERSION }}-
- pip-cache-<< parameters.version >>-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- pip-cache-<< parameters.version >>-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-
- pip-cache-<< parameters.version >>-{{ .Environment.CACHE_VERSION }}-

- run:
name: verify git tag vs. version
Expand All @@ -111,10 +142,15 @@ jobs:


functional-ftp:
parameters:
version:
description: "python version"
default: "3.9"
type: string
working_directory: ~/lib

docker:
- image: circleci/python:3.9
- image: cimg/python:<< parameters.version >>
environment:
TENTACLIO__CONN__FTP_TEST: ftp://octopus:tentacle@localhost

Expand All @@ -128,18 +164,23 @@ jobs:

- restore_cache:
keys:
- pip-cache-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- pip-cache-<< parameters.version >>-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ checksum "Pipfile.lock" }}

- run:
name: Install Python packages
command: make sync


functional-sftp:
parameters:
version:
description: "python version"
default: "3.9"
type: string
working_directory: ~/lib

docker:
- image: circleci/python:3.9
- image: cimg/python:<< parameters.version >>
environment:
TENTACLIO__CONN__SFTP_TEST: sftp://octopus:tentacle@localhost:22

Expand All @@ -151,7 +192,7 @@ jobs:

- restore_cache:
keys:
- pip-cache-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
- pip-cache-<< parameters.version >>-{{ .Environment.CACHE_VERSION }}-{{ .Branch }}-{{ checksum "Pipfile.lock" }}

- run:
name: Install Python packages
Expand All @@ -163,7 +204,6 @@ jobs:


workflows:
version: 2

test-build-deploy:
jobs:
Expand All @@ -173,26 +213,25 @@ workflows:
only: /.*/

- unit:
name: unit.<< matrix.version >>
matrix:
parameters:
version: ["3.9","3.10","3.11"]
filters:
tags:
only: /.*/
- functional-ftp:
filters:
tags:
only: /.*/
requires:
- lint
- unit
- functional-sftp:
matrix:
parameters:
version: ["3.9","3.10","3.11"]
filters:
tags:
only: /.*/
requires:
- lint
- unit
- unit.<< matrix.version >>
- release:
requires:
- functional-ftp
- functional-sftp
filters:
tags:
Expand Down
7 changes: 2 additions & 5 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@ url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[requires]
python_version = "3.9"

[dev-packages]
# Symlink to project root
tentaclio = {editable = true,path = "."}
# Linting
black = "*"
black = "==23.9.1"
isort = "*"
flake8 = "*"
mypy = "*"
Expand All @@ -19,7 +16,7 @@ types-paramiko = "*"
types-pyyaml = "*"
types-requests = "*"
# Testing
moto = "*"
moto = "==5.0.6"
pytest = "*"
pytest-cov = "*"
pytest-mock = "*"
Expand Down
Loading