|
3 | 3 | # Check https://circleci.com/docs/2.0/language-python/ for more details
|
4 | 4 | #
|
5 | 5 | version: 2.1
|
6 |
| -jobs: |
7 |
| - build: |
8 |
| - docker: |
9 |
| - - image: circleci/python:3.6.1 |
10 | 6 |
|
11 |
| - - image: redislabs/redisgraph:edge |
| 7 | +commands: |
12 | 8 |
|
13 |
| - working_directory: ~/repo |
| 9 | + abort_for_docs: |
| 10 | + steps: |
| 11 | + - run: |
| 12 | + name: Avoid tests for docs |
| 13 | + command: | |
| 14 | + if [[ $CIRCLE_BRANCH == *docs ]]; then |
| 15 | + echo "Identifies as documents PR, no testing required" |
| 16 | + circleci step halt |
| 17 | + fi |
14 | 18 |
|
| 19 | + abort_for_noci: |
15 | 20 | steps:
|
| 21 | + - run: |
| 22 | + name: Ignore CI for specific branches |
| 23 | + command: | |
| 24 | + if [[ $CIRCLE_BRANCH == *noci ]]; then |
| 25 | + echo "Identifies as actively ignoring CI, no testing required." |
| 26 | + circleci step halt |
| 27 | + fi |
| 28 | +
|
| 29 | +
|
| 30 | + early_return_for_forked_pull_requests: |
| 31 | + description: >- |
| 32 | + If this build is from a fork, stop executing the current job and return success. |
| 33 | + This is useful to avoid steps that will fail due to missing credentials. |
| 34 | + steps: |
| 35 | + - run: |
| 36 | + name: Early return if this build is from a forked PR |
| 37 | + command: | |
| 38 | + if [[ -n "$CIRCLE_PR_NUMBER" ]]; then |
| 39 | + echo "Nothing to do for forked PRs, so marking this step successful" |
| 40 | + circleci step halt |
| 41 | + fi |
| 42 | +
|
| 43 | + build_and_test: |
| 44 | + steps: |
| 45 | + - abort_for_docs |
| 46 | + - abort_for_noci |
16 | 47 | - checkout
|
17 | 48 |
|
18 |
| - # Download and cache dependencies |
19 |
| - - restore_cache: |
| 49 | + - restore_cache: # Download and cache dependencies |
20 | 50 | keys:
|
21 |
| - - v1-dependencies-{{ checksum "requirements.txt" }} |
22 |
| - # fallback to using the latest cache if no exact match is found |
23 |
| - - v1-dependencies- |
| 51 | + - v1-dependencies-{{ checksum "pyproject.toml" }} |
| 52 | + # fallback to using the latest cache if no exact match is found |
| 53 | + - v1-dependencies- |
24 | 54 |
|
25 | 55 | - run:
|
26 |
| - name: install dependencies |
| 56 | + name: install tox dependencies |
27 | 57 | command: |
|
28 |
| - python3 -m venv venv |
29 |
| - . venv/bin/activate |
30 |
| - pip install . |
| 58 | + pip install --user --quiet -r .circleci/circle_requirements.txt |
31 | 59 |
|
32 |
| - - save_cache: |
33 |
| - paths: |
34 |
| - - ./venv |
35 |
| - key: v1-dependencies-{{ checksum "requirements.txt" }} |
| 60 | + - run: |
| 61 | + name: install dependencies |
| 62 | + command: | |
| 63 | + poetry install |
36 | 64 |
|
37 | 65 | - run:
|
38 |
| - name: build dist |
39 |
| - command: python setup.py sdist |
| 66 | + name: build sdist and wheels |
| 67 | + command: | |
| 68 | + poetry build |
40 | 69 |
|
41 | 70 | - run:
|
42 |
| - name: run tests and upload coverage |
| 71 | + name: lint |
43 | 72 | command: |
|
44 |
| - . venv/bin/activate |
45 |
| - pip install -r test/requirements.txt |
46 |
| - pytest --cov redisgraph_bulk_loader |
47 |
| - codecov -t ${CODECOV_TOKEN} |
| 73 | + tox -e linters |
| 74 | +
|
| 75 | + - run: |
| 76 | + name: run tests |
| 77 | + command: |
| 78 | + tox -e cover |
| 79 | + |
| 80 | + - save_cache: |
| 81 | + paths: |
| 82 | + - ./.tox |
| 83 | + - ~/.cache/pip |
| 84 | + key: v1-dependencies-{{ checksum "pyproject.toml" }} |
| 85 | + |
| 86 | + - store_artifacts: |
| 87 | + path: test-reports |
| 88 | + destination: test-reports |
| 89 | + |
| 90 | + |
| 91 | +jobs: |
| 92 | + build: |
| 93 | + parameters: |
| 94 | + python_version: |
| 95 | + type: string |
| 96 | + default: latest |
| 97 | + docker: |
| 98 | + - image: circleci/python:<<parameters.python_version >> |
| 99 | + - image: redislabs/redisgraph:edge |
| 100 | + steps: |
| 101 | + - build_and_test |
| 102 | + |
| 103 | +on-any-branch: &on-any-branch |
| 104 | + filters: |
| 105 | + branches: |
| 106 | + only: /.*/ |
| 107 | + tags: |
| 108 | + only: /.*/ |
| 109 | + |
| 110 | +on-master: &on-master |
| 111 | + filters: |
| 112 | + branches: |
| 113 | + only: |
| 114 | + - master |
| 115 | + |
| 116 | +# the is to build and test, per commit against all supported python versions |
| 117 | +python-versions: &python-versions |
| 118 | + matrix: |
| 119 | + parameters: |
| 120 | + python_version: |
| 121 | + - "3.8.9" |
| 122 | + - "3.9.4" |
| 123 | + - "latest" |
48 | 124 |
|
49 | 125 | workflows:
|
50 | 126 | version: 2
|
51 | 127 | commit:
|
52 | 128 | jobs:
|
53 |
| - - build |
| 129 | + - build: |
| 130 | + <<: *on-any-branch |
| 131 | + <<: *python-versions |
| 132 | + |
54 | 133 | nightly:
|
55 | 134 | triggers:
|
56 | 135 | - schedule:
|
57 | 136 | cron: "0 0 * * *"
|
58 |
| - filters: |
59 |
| - branches: |
60 |
| - only: |
61 |
| - - master |
| 137 | + <<: *on-master |
62 | 138 | jobs:
|
63 | 139 | - build
|
0 commit comments