|
| 1 | +version: 2.1 |
| 2 | + |
| 3 | +commands: |
| 4 | + client-test: |
| 5 | + description: "Run tests" |
| 6 | + parameters: |
| 7 | + python-image: |
| 8 | + type: string |
| 9 | + steps: |
| 10 | + - restore_cache: |
| 11 | + name: Restoring Pip Cache |
| 12 | + keys: |
| 13 | + - &cache-key pip-cache-v11-<< parameters.python-image >>-{{ checksum "setup.py" }} |
| 14 | + - pip-cache-v11-<< parameters.python-image >>- |
| 15 | + - run: |
| 16 | + name: "Running tests" |
| 17 | + command: | |
| 18 | + python --version |
| 19 | + mkdir test-reports || true |
| 20 | + pip install . --user |
| 21 | + pip install .\[dataframe\] --user |
| 22 | + pip install pytest pytest-cov --user |
| 23 | + pytest tests --junitxml=test-reports/junit.xml --cov=./ --cov-report xml:coverage.xml |
| 24 | + - save_cache: |
| 25 | + name: Saving Pip Cache |
| 26 | + key: *cache-key |
| 27 | + paths: |
| 28 | + - ".venv" |
| 29 | + - "~/.cache/pip" |
| 30 | + - "/usr/local/lib/site-python" |
| 31 | + when: always |
| 32 | +jobs: |
| 33 | + tests-python: |
| 34 | + parameters: |
| 35 | + python-image: |
| 36 | + type: string |
| 37 | + default: &default-python "cimg/python:3.7" |
| 38 | + docker: |
| 39 | + - image: << parameters.python-image >> |
| 40 | + environment: |
| 41 | + PIPENV_VENV_IN_PROJECT: true |
| 42 | + steps: |
| 43 | + - checkout |
| 44 | + - client-test: |
| 45 | + python-image: << parameters.python-image >> |
| 46 | + - store_test_results: |
| 47 | + path: test-reports |
| 48 | + - run: |
| 49 | + name: Collecting coverage reports |
| 50 | + command: | |
| 51 | + curl -Os https://uploader.codecov.io/latest/linux/codecov |
| 52 | + curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM |
| 53 | + curl -Os https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig |
| 54 | + curl -s https://keybase.io/codecovsecurity/pgp_keys.asc | gpg --no-default-keyring --keyring trustedkeys.gpg --import |
| 55 | + gpgv codecov.SHA256SUM.sig codecov.SHA256SUM |
| 56 | + shasum -a 256 -c codecov.SHA256SUM |
| 57 | + chmod +x ./codecov |
| 58 | + ./codecov |
| 59 | + check-code-style: |
| 60 | + docker: |
| 61 | + - image: *default-python |
| 62 | + environment: |
| 63 | + PIPENV_VENV_IN_PROJECT: true |
| 64 | + steps: |
| 65 | + - checkout |
| 66 | + - run: |
| 67 | + name: Checks style consistency across sources. |
| 68 | + command: | |
| 69 | + pip install flake8 --user |
| 70 | + flake8 influxdb_client_3/ |
| 71 | + check-twine: |
| 72 | + docker: |
| 73 | + - image: *default-python |
| 74 | + environment: |
| 75 | + PIPENV_VENV_IN_PROJECT: true |
| 76 | + steps: |
| 77 | + - checkout |
| 78 | + - run: |
| 79 | + name: Checks that the description will render correctly on PyPI. |
| 80 | + command: | |
| 81 | + pip install --upgrade pip |
| 82 | + pip install twine --user |
| 83 | + python setup.py sdist bdist_wheel |
| 84 | + twine check dist/* |
| 85 | + check-docstyle: |
| 86 | + docker: |
| 87 | + - image: *default-python |
| 88 | + environment: |
| 89 | + PIPENV_VENV_IN_PROJECT: true |
| 90 | + steps: |
| 91 | + - checkout |
| 92 | + - run: |
| 93 | + name: Checks compliance with Python docstring convention. |
| 94 | + command: | |
| 95 | + pip install pydocstyle --user |
| 96 | + pydocstyle --count influxdb_client_3 |
| 97 | +
|
| 98 | +workflows: |
| 99 | + version: 2 |
| 100 | + build: |
| 101 | + when: |
| 102 | + not: |
| 103 | + equal: [ scheduled_pipeline, << pipeline.trigger_source >> ] |
| 104 | + jobs: |
| 105 | +# - check-code-style |
| 106 | +# - check-docstyle |
| 107 | + - check-twine |
| 108 | + - tests-python: |
| 109 | + name: test-3.8 |
| 110 | + python-image: "cimg/python:3.8" |
| 111 | + - tests-python: |
| 112 | + name: test-3.9 |
| 113 | + python-image: "cimg/python:3.9" |
| 114 | + - tests-python: |
| 115 | + name: test-3.10 |
| 116 | + python-image: "cimg/python:3.10" |
| 117 | + - tests-python: |
| 118 | + name: test-3.11 |
| 119 | + python-image: "cimg/python:3.11" |
| 120 | + - tests-python: |
| 121 | + name: test-3.12 |
| 122 | + python-image: "cimg/python:3.12" |
| 123 | + |
| 124 | + nightly: |
| 125 | + when: |
| 126 | + equal: [ scheduled_pipeline, << pipeline.trigger_source >> ] |
| 127 | + jobs: |
| 128 | + - tests-python |
0 commit comments