|
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_and_test: |
8 | | - docker: |
9 | | - - image: 'ubuntu:bionic' |
| 6 | +commands: |
| 7 | + |
| 8 | + abort_for_docs: |
10 | 9 | steps: |
11 | 10 | - run: |
12 | | - name: installations |
13 | | - command: apt-get -qq update; apt-get install -y ca-certificates wget build-essential git python-pip |
14 | | - - run: |
15 | | - name: Redis_5_upgrade |
16 | | - command: cd ..; git clone https://github.com/antirez/redis.git; cd ./redis; git fetch; git checkout 6.0.9; make; make install |
| 11 | + name: Avoid tests for docs |
| 12 | + command: | |
| 13 | + if [[ $CIRCLE_BRANCH == *docs ]]; then |
| 14 | + echo "Identifies as documents PR, no testing required" |
| 15 | + circleci step halt |
| 16 | + fi |
| 17 | +
|
| 18 | + abort_for_noci: |
| 19 | + steps: |
17 | 20 | - run: |
18 | | - name: download_RedisGears |
19 | | - command: cd ..; wget http://redismodules.s3.amazonaws.com/redisgears/snapshots/redisgears.linux-bionic-x64.master.zip; apt-get install -y unzip; unzip redisgears.linux-bionic-x64.master.zip |
| 21 | + name: Ignore CI for specific branches |
| 22 | + command: | |
| 23 | + if [[ $CIRCLE_BRANCH == *noci ]]; then |
| 24 | + echo "Identifies as actively ignoring CI, no testing required." |
| 25 | + circleci step halt |
| 26 | + fi |
| 27 | +
|
| 28 | +
|
| 29 | + early_return_for_forked_pull_requests: |
| 30 | + description: >- |
| 31 | + If this build is from a fork, stop executing the current job and return success. |
| 32 | + This is useful to avoid steps that will fail due to missing credentials. |
| 33 | + steps: |
20 | 34 | - run: |
21 | | - name: download_RedisGears_deps |
22 | | - command: cd ..; wget http://redismodules.s3.amazonaws.com/redisgears/snapshots/redisgears-python.linux-bionic-x64.master.tgz; mkdir -p /var/opt/redislabs/modules/rg/; cd /var/opt/redislabs/modules/rg/; tar -xvf /root/redisgears-python.linux-bionic-x64.master.tgz |
| 35 | + name: Early return if this build is from a forked PR |
| 36 | + command: | |
| 37 | + if [[ -n "$CIRCLE_PR_NUMBER" ]]; then |
| 38 | + echo "Nothing to do for forked PRs, so marking this step successful" |
| 39 | + circleci step halt |
| 40 | + fi |
| 41 | +
|
| 42 | +# build_and_test: |
| 43 | +# docker: |
| 44 | +# - image: 'ubuntu:bionic' |
| 45 | +# steps: |
| 46 | +# - run: |
| 47 | +# name: installations |
| 48 | +# command: apt-get -qq update; apt-get install -y ca-certificates wget build-essential git python-pip |
| 49 | +# - run: |
| 50 | +# name: Redis_5_upgrade |
| 51 | +# command: cd ..; git clone https://github.com/antirez/redis.git; cd ./redis; git fetch; git checkout 6.0.9; make; make install |
| 52 | +# - run: |
| 53 | +# name: download_RedisGears |
| 54 | +# command: cd ..; wget http://redismodules.s3.amazonaws.com/redisgears/snapshots/redisgears.linux-bionic-x64.master.zip; apt-get install -y unzip; unzip redisgears.linux-bionic-x64.master.zip |
| 55 | +# - run: |
| 56 | +# name: download_RedisGears_deps |
| 57 | +# command: cd ..; wget http://redismodules.s3.amazonaws.com/redisgears/snapshots/redisgears-python.linux-bionic-x64.master.tgz; mkdir -p /var/opt/redislabs/modules/rg/; cd /var/opt/redislabs/modules/rg/; tar -xvf /root/redisgears-python.linux-bionic-x64.master.tgz |
| 58 | +# - checkout |
| 59 | +# - run: |
| 60 | +# name: install_redisgears_py_to_RedisGears_virtual_env |
| 61 | +# command: /var/opt/redislabs/modules/rg/python3_99.99.99/bin/python3 setup.py install |
| 62 | +# - run: |
| 63 | +# name: install RLTest |
| 64 | +# command: /var/opt/redislabs/modules/rg/python3_99.99.99/bin/python3 -m pip install git+https://github.com/Grokzen/redis-py-cluster.git@master git+https://github.com/RedisLabsModules/RLTest.git |
| 65 | +# - run: |
| 66 | +# name: run_tests |
| 67 | +# command: /var/opt/redislabs/modules/rg/python3_99.99.99/bin/python3 -m RLTest --module ../redisgears.so --module-args "Plugin /var/opt/redislabs/modules/rg/plugin/gears_python.so" |
| 68 | + |
| 69 | +#workflows: |
| 70 | +# version: 2 |
| 71 | +# commit: |
| 72 | +# jobs: |
| 73 | +# - build_and_test |
| 74 | +# nightly: |
| 75 | +# triggers: |
| 76 | +# - schedule: |
| 77 | +# cron: "0 0 * * *" |
| 78 | +# filters: |
| 79 | +# branches: |
| 80 | +# only: |
| 81 | +# - master |
| 82 | +# jobs: |
| 83 | +# - build_and_test |
| 84 | + |
| 85 | + build_and_test: |
| 86 | + steps: |
23 | 87 | - checkout |
| 88 | + - restore_cache: # Download and cache dependencies |
| 89 | + keys: |
| 90 | + - v1-dependencies-{{ checksum "pyproject.toml" }} |
| 91 | + # fallback to using the latest cache if no exact match is found |
| 92 | + - v1-dependencies- |
| 93 | + |
24 | 94 | - run: |
25 | | - name: install_redisgears_py_to_RedisGears_virtual_env |
26 | | - command: /var/opt/redislabs/modules/rg/python3_99.99.99/bin/python3 setup.py install |
| 95 | + name: install tox dependencies |
| 96 | + command: | |
| 97 | + /var/opt/redislabs/modules/rg/python3_99.99.99/bin/python3 -m pip install -r .circleci/circle_requirements.txt |
| 98 | +
|
27 | 99 | - run: |
28 | | - name: install RLTest |
29 | | - command: /var/opt/redislabs/modules/rg/python3_99.99.99/bin/python3 -m pip install git+https://github.com/Grokzen/redis-py-cluster.git@master git+https://github.com/RedisLabsModules/RLTest.git |
| 100 | + name: build sdist and wheels |
| 101 | + command: | |
| 102 | + /var/opt/redislabs/modules/rg/python3_99.99.99/bin/python3 -m poetry build |
| 103 | +
|
| 104 | +# - run: |
| 105 | +# name: lint |
| 106 | +# command: | |
| 107 | +# /var/opt/redislabs/modules/rg/python3_99.99.99/bin/python3 -m tox -e linters |
| 108 | +# |
30 | 109 | - run: |
31 | | - name: run_tests |
32 | | - command: /var/opt/redislabs/modules/rg/python3_99.99.99/bin/python3 -m RLTest --module ../redisgears.so --module-args "Plugin /var/opt/redislabs/modules/rg/plugin/gears_python.so" |
| 110 | + name: run tests |
| 111 | + command: |
| 112 | + /var/opt/redislabs/modules/rg/python3_99.99.99/bin/python3 -m tox -e tests |
| 113 | + |
| 114 | + - save_cache: |
| 115 | + paths: |
| 116 | + - ./.tox |
| 117 | + - ~/.cache/pip |
| 118 | + key: v1-dependencies-{{ checksum "pyproject.toml" }} |
| 119 | + |
| 120 | +jobs: |
| 121 | + build: |
| 122 | + docker: |
| 123 | + - image: redislabs/redisgears:edge |
| 124 | + |
| 125 | + steps: |
| 126 | + - build_and_test |
| 127 | + - store_artifacts: |
| 128 | + path: test-reports |
| 129 | + destination: test-reports |
| 130 | + |
| 131 | + nightly: |
| 132 | + docker: |
| 133 | + - image: redislabs/redisgears:edge |
| 134 | + steps: |
| 135 | + - build_and_test |
| 136 | + - dockerize |
| 137 | + |
| 138 | +on-any-branch: &on-any-branch |
| 139 | + filters: |
| 140 | + branches: |
| 141 | + only: |
| 142 | + - /.*/ |
| 143 | + tags: |
| 144 | + ignore: /.*/ |
| 145 | + |
| 146 | +on-master: &on-master |
| 147 | + filters: |
| 148 | + branches: |
| 149 | + only: |
| 150 | + - master |
33 | 151 |
|
34 | 152 | workflows: |
35 | 153 | version: 2 |
36 | 154 | commit: |
37 | 155 | jobs: |
38 | | - - build_and_test |
| 156 | + - build: |
| 157 | + <<: *on-any-branch |
| 158 | + |
39 | 159 | nightly: |
40 | 160 | triggers: |
41 | 161 | - schedule: |
42 | 162 | cron: "0 0 * * *" |
43 | | - filters: |
44 | | - branches: |
45 | | - only: |
46 | | - - master |
| 163 | + <<: *on-master |
47 | 164 | jobs: |
48 | | - - build_and_test |
| 165 | + - build |
0 commit comments