|
1 | | -version: 2 |
| 1 | +version: 2.1 |
| 2 | + |
| 3 | +orbs: |
| 4 | + win: circleci/windows@1.0.0 |
| 5 | + |
2 | 6 | workflows: |
3 | | - version: 2 |
4 | 7 | test: |
5 | 8 | jobs: |
6 | | - - test-2.7 |
7 | | - - test-3.3 |
8 | | - - test-3.4 |
9 | | - - test-3.5 |
10 | | - - test-3.6 |
11 | | - - test-3.7 |
12 | | -test-template: &test-template |
13 | | - steps: |
14 | | - - checkout |
15 | | - - run: |
16 | | - name: install requirements |
17 | | - command: | |
18 | | - sudo pip install --upgrade pip virtualenv; |
19 | | - sudo pip install -r test-requirements.txt; |
20 | | - if [[ "$CIRCLE_JOB" != "test-3.3" ]]; then |
21 | | - sudo pip install -r test-filesource-optional-requirements.txt; |
22 | | - fi; |
23 | | - if [[ "$CIRCLE_JOB" != "test-3.3" ]] && [[ "$CIRCLE_JOB" != "test-3.4" ]]; then |
24 | | - sudo pip install -r consul-requirements.txt; |
25 | | - fi; |
26 | | - sudo python setup.py install; |
27 | | - pip freeze |
28 | | - - run: |
29 | | - name: run tests |
30 | | - command: | |
31 | | - mkdir test-reports; |
32 | | - if [[ "$CIRCLE_JOB" == "test-2.7" ]]; then |
33 | | - pytest -s --cov=ldclient --junitxml=test-reports/junit.xml testing; |
34 | | - sh -c '[ -n "${CODECLIMATE_REPO_TOKEN+1}" ] && codeclimate-test-reporter || echo "No CODECLIMATE_REPO_TOKEN value is set; not publishing coverage report"'; |
35 | | - else |
36 | | - pytest -s --junitxml=test-reports/junit.xml testing; |
37 | | - fi |
38 | | - - run: |
39 | | - name: test packaging/install |
40 | | - # Note, virtualenv isn't supported on Python 3.3 and this test requires virtualenv. But we |
41 | | - # never build our published package on 3.3 anyway. |
42 | | - command: | |
43 | | - if [[ "$CIRCLE_JOB" != "test-3.3" ]]; then |
44 | | - sudo rm -rf dist *.egg-info; |
45 | | - ./test-packaging/test-packaging.sh; |
46 | | - fi |
47 | | - - store_test_results: |
48 | | - path: test-reports |
49 | | - - store_artifacts: |
50 | | - path: test-reports |
| 9 | + - test-linux: |
| 10 | + name: Python 2.7 |
| 11 | + docker-image: circleci/python:2.7-jessie |
| 12 | + test-with-codeclimate: true # we only need to run CodeClimate in one job |
| 13 | + - test-linux: |
| 14 | + name: Python 3.3 |
| 15 | + docker-image: circleci/python:3.3-jessie |
| 16 | + consul-supported: false # Consul isn't supported in 3.3 |
| 17 | + filesource-supported: false # FileDataSource isn't supported in 3.3 |
| 18 | + test-packaging: false # packaging test requires virtualenv, which isn't supported in 3.3 |
| 19 | + - test-linux: |
| 20 | + name: Python 3.4 |
| 21 | + docker-image: circleci/python:3.4-jessie |
| 22 | + consul-supported: false # Consul isn't supported in 3.4 |
| 23 | + - test-linux: |
| 24 | + name: Python 3.5 |
| 25 | + docker-image: circleci/python:3.5-jessie |
| 26 | + - test-linux: |
| 27 | + name: Python 3.6 |
| 28 | + docker-image: circleci/python:3.6-jessie |
| 29 | + - test-linux: |
| 30 | + name: Python 3.7 |
| 31 | + docker-image: circleci/python:3.7-stretch |
| 32 | + - test-linux: |
| 33 | + name: Python 3.8 |
| 34 | + docker-image: circleci/python:3.8-buster |
| 35 | + - test-windows: |
| 36 | + name: Windows Py2.7 |
| 37 | + py3: false |
| 38 | + - test-windows: |
| 39 | + name: Windows Py3.3 |
| 40 | + py3: true |
51 | 41 |
|
52 | 42 | jobs: |
53 | | - test-2.7: |
54 | | - <<: *test-template |
| 43 | + test-linux: |
| 44 | + parameters: |
| 45 | + docker-image: |
| 46 | + type: string |
| 47 | + consul-supported: |
| 48 | + type: boolean |
| 49 | + default: true |
| 50 | + filesource-supported: |
| 51 | + type: boolean |
| 52 | + default: true |
| 53 | + test-packaging: |
| 54 | + type: boolean |
| 55 | + default: true |
| 56 | + test-with-codeclimate: |
| 57 | + type: boolean |
| 58 | + default: false |
55 | 59 | docker: |
56 | | - - image: circleci/python:2.7-jessie |
57 | | - - image: redis |
58 | | - - image: amazon/dynamodb-local |
59 | | - - image: consul |
60 | | - test-3.3: |
61 | | - <<: *test-template |
62 | | - docker: |
63 | | - - image: circleci/python:3.3-jessie |
64 | | - - image: redis |
65 | | - - image: amazon/dynamodb-local |
66 | | - # python-consul doesn't support Python 3.3 |
67 | | - test-3.4: |
68 | | - <<: *test-template |
69 | | - docker: |
70 | | - - image: circleci/python:3.4-jessie |
71 | | - - image: redis |
72 | | - - image: amazon/dynamodb-local |
73 | | - # python-consul doesn't support Python 3.4 |
74 | | - test-3.5: |
75 | | - <<: *test-template |
76 | | - docker: |
77 | | - - image: circleci/python:3.5-jessie |
78 | | - - image: redis |
79 | | - - image: amazon/dynamodb-local |
80 | | - - image: consul |
81 | | - test-3.6: |
82 | | - <<: *test-template |
83 | | - docker: |
84 | | - - image: circleci/python:3.6-jessie |
85 | | - - image: redis |
86 | | - - image: amazon/dynamodb-local |
87 | | - - image: consul |
88 | | - test-3.7: |
89 | | - <<: *test-template |
90 | | - docker: |
91 | | - - image: circleci/python:3.7-stretch |
| 60 | + - image: <<parameters.docker-image>> |
92 | 61 | - image: redis |
93 | 62 | - image: amazon/dynamodb-local |
94 | 63 | - image: consul |
| 64 | + steps: |
| 65 | + - checkout |
| 66 | + - run: |
| 67 | + name: install requirements |
| 68 | + command: | |
| 69 | + sudo pip install --upgrade pip virtualenv; |
| 70 | + sudo pip install -r test-requirements.txt; |
| 71 | + if [[ "<<parameters.filesource-supported>>" == "true" ]]; then |
| 72 | + sudo pip install -r test-filesource-optional-requirements.txt; |
| 73 | + fi; |
| 74 | + if [[ "<<parameters.consul-supported>>" == "true" ]]; then |
| 75 | + sudo pip install -r consul-requirements.txt; |
| 76 | + fi; |
| 77 | + sudo python setup.py install; |
| 78 | + pip freeze |
| 79 | + - when: |
| 80 | + condition: <<parameters.test-with-codeclimate>> |
| 81 | + steps: |
| 82 | + - run: |
| 83 | + name: run tests (with CodeClimate) |
| 84 | + command: | |
| 85 | + mkdir test-reports |
| 86 | + pytest -s --cov=ldclient --junitxml=test-reports/junit.xml testing -W error::SyntaxWarning |
| 87 | + sh -c '[ -n "${CODECLIMATE_REPO_TOKEN+1}" ] && codeclimate-test-reporter || echo "No CODECLIMATE_REPO_TOKEN value is set; not publishing coverage report"' |
| 88 | + - unless: |
| 89 | + condition: <<parameters.test-with-codeclimate>> |
| 90 | + steps: |
| 91 | + - run: |
| 92 | + name: run tests |
| 93 | + command: | |
| 94 | + mkdir test-reports |
| 95 | + pytest -s --junitxml=test-reports/junit.xml testing -W error::SyntaxWarning |
| 96 | + - when: |
| 97 | + condition: <<parameters.test-packaging>> |
| 98 | + steps: |
| 99 | + - run: |
| 100 | + name: test packaging/install |
| 101 | + command: | |
| 102 | + sudo rm -rf dist *.egg-info |
| 103 | + ./test-packaging/test-packaging.sh |
| 104 | + - store_test_results: |
| 105 | + path: test-reports |
| 106 | + - store_artifacts: |
| 107 | + path: test-reports |
| 108 | + |
| 109 | + test-windows: |
| 110 | + executor: |
| 111 | + name: win/vs2019 |
| 112 | + shell: powershell.exe |
| 113 | + parameters: |
| 114 | + py3: |
| 115 | + type: boolean |
| 116 | + steps: |
| 117 | + - checkout |
| 118 | + - when: |
| 119 | + condition: <<parameters.py3>> |
| 120 | + steps: |
| 121 | + - run: |
| 122 | + name: install Python 3 |
| 123 | + command: choco install python --no-progress |
| 124 | + - unless: |
| 125 | + condition: <<parameters.py3>> |
| 126 | + steps: |
| 127 | + - run: |
| 128 | + name: install Python 2.7 |
| 129 | + command: | |
| 130 | + $ProgressPreference = "SilentlyContinue" # prevents console errors from CircleCI host |
| 131 | + iwr -outf python-2.7.16.amd64.msi https://www.python.org/ftp/python/2.7.16/python-2.7.16.amd64.msi |
| 132 | + Start-Process msiexec.exe -Wait -ArgumentList '/I python-2.7.16.amd64.msi /quiet' |
| 133 | + - run: |
| 134 | + name: set up DynamoDB |
| 135 | + command: | |
| 136 | + $ProgressPreference = "SilentlyContinue" |
| 137 | + iwr -outf dynamo.zip https://s3-us-west-2.amazonaws.com/dynamodb-local/dynamodb_local_latest.zip |
| 138 | + mkdir dynamo |
| 139 | + Expand-Archive -Path dynamo.zip -DestinationPath dynamo |
| 140 | + cd dynamo |
| 141 | + javaw -D"java.library.path=./DynamoDBLocal_lib" -jar DynamoDBLocal.jar |
| 142 | + background: true |
| 143 | + - run: |
| 144 | + name: set up Consul |
| 145 | + command: | |
| 146 | + $ProgressPreference = "SilentlyContinue" |
| 147 | + iwr -outf consul.zip https://releases.hashicorp.com/consul/1.4.2/consul_1.4.2_windows_amd64.zip |
| 148 | + mkdir consul |
| 149 | + Expand-Archive -Path consul.zip -DestinationPath consul |
| 150 | + cd consul |
| 151 | + sc.exe create "Consul" binPath="$(Get-Location)/consul.exe agent -dev" |
| 152 | + sc.exe start "Consul" |
| 153 | + - run: |
| 154 | + name: start Redis |
| 155 | + command: | |
| 156 | + $ProgressPreference = "SilentlyContinue" |
| 157 | + iwr -outf redis.zip https://github.com/MicrosoftArchive/redis/releases/download/win-3.0.504/Redis-x64-3.0.504.zip |
| 158 | + mkdir redis |
| 159 | + Expand-Archive -Path redis.zip -DestinationPath redis |
| 160 | + cd redis |
| 161 | + ./redis-server --service-install |
| 162 | + ./redis-server --service-start |
| 163 | + Start-Sleep -s 5 |
| 164 | + ./redis-cli ping |
| 165 | + - run: |
| 166 | + name: install requirements |
| 167 | + command: | |
| 168 | + $env:Path += ";C:\Python27\;C:\Python27\Scripts\" # has no effect if 2.7 isn't installed |
| 169 | + python --version |
| 170 | + pip install -r test-requirements.txt |
| 171 | + pip install -r consul-requirements.txt |
| 172 | + python setup.py install |
| 173 | + - run: |
| 174 | + name: run tests (2.7) |
| 175 | + command: | |
| 176 | + mkdir test-reports |
| 177 | + $env:Path += ";C:\Python27\;C:\Python27\Scripts\" # has no effect if 2.7 isn't installed |
| 178 | + python -m pytest -s --junitxml=test-reports/junit.xml testing; |
| 179 | + - store_test_results: |
| 180 | + path: test-reports |
| 181 | + - store_artifacts: |
| 182 | + path: test-reports |
0 commit comments