|
| 1 | +version: 2.1 |
| 2 | + |
| 3 | +orbs: |
| 4 | + codecov: codecov/codecov@1.2.4 |
| 5 | + gh: circleci/github-cli@1.0 |
| 6 | + |
| 7 | +workflows: |
| 8 | + workflow: |
| 9 | + jobs: |
| 10 | + - checkout: |
| 11 | + name: Checkout |
| 12 | + context: Default |
| 13 | + filters: |
| 14 | + tags: |
| 15 | + only: /^v\d+\.\d+\.\d+$/ |
| 16 | + - lint: |
| 17 | + name: Lint and check spelling |
| 18 | + context: Default |
| 19 | + requires: |
| 20 | + - Checkout |
| 21 | + filters: |
| 22 | + tags: |
| 23 | + only: /^v\d+\.\d+\.\d+$/ |
| 24 | + - test: |
| 25 | + name: Run tests |
| 26 | + context: Default |
| 27 | + requires: |
| 28 | + - Checkout |
| 29 | + filters: |
| 30 | + tags: |
| 31 | + only: /^v\d+\.\d+\.\d+$/ |
| 32 | + - build: |
| 33 | + name: Build |
| 34 | + context: Default |
| 35 | + requires: |
| 36 | + - Checkout |
| 37 | + filters: |
| 38 | + tags: |
| 39 | + only: /^v\d+\.\d+\.\d+$/ |
| 40 | + - upload: |
| 41 | + name: Upload |
| 42 | + context: Default |
| 43 | + requires: |
| 44 | + - Lint and check spelling |
| 45 | + - Run tests |
| 46 | + - Build |
| 47 | + filters: |
| 48 | + branches: |
| 49 | + ignore: /.*/ |
| 50 | + tags: |
| 51 | + only: /^v\d+\.\d+\.\d+$/ |
| 52 | + |
| 53 | +jobs: |
| 54 | + checkout: |
| 55 | + docker: |
| 56 | + - image: cimg/python:3.10 |
| 57 | + steps: |
| 58 | + - checkout |
| 59 | + - persist_to_workspace: |
| 60 | + root: . |
| 61 | + paths: |
| 62 | + - . |
| 63 | + |
| 64 | + lint: |
| 65 | + docker: |
| 66 | + - image: cimg/python:3.10-node |
| 67 | + steps: |
| 68 | + - attach_workspace: |
| 69 | + at: . |
| 70 | + - run: |
| 71 | + name: Install pdftotext and enchant |
| 72 | + command: | |
| 73 | + sudo apt update |
| 74 | + sudo apt install build-essential libpoppler-cpp-dev pkg-config enchant-2 |
| 75 | + - run: |
| 76 | + name: Install cSpell |
| 77 | + command: sudo npm install cspell --global |
| 78 | + - run: |
| 79 | + name: Install markdownlint |
| 80 | + command: sudo npm install markdownlint-cli2 --global |
| 81 | + - run: |
| 82 | + name: Install pyright |
| 83 | + command: sudo npm install pyright --global |
| 84 | + - run: |
| 85 | + name: Upgrade pip |
| 86 | + command: pip3 install --upgrade pip |
| 87 | + - run: |
| 88 | + name: Install package and dev extras |
| 89 | + command: pip3 install ."[dev]" |
| 90 | + - run: |
| 91 | + name: Install Voight-Kampff |
| 92 | + command: pip3 install voight-kampff |
| 93 | + - run: |
| 94 | + name: Markdownlint |
| 95 | + command: vk markdownlint |
| 96 | + - run: |
| 97 | + name: Pyright |
| 98 | + command: vk pyright |
| 99 | + - run: |
| 100 | + name: Pylint |
| 101 | + command: vk pylint |
| 102 | + - run: |
| 103 | + name: Black |
| 104 | + command: vk black |
| 105 | + - run: |
| 106 | + name: Pydocstyle |
| 107 | + command: vk pydocstyle |
| 108 | + - run: |
| 109 | + name: Flake8 |
| 110 | + command: vk flake8 |
| 111 | + - run: |
| 112 | + name: Bandit |
| 113 | + command: vk bandit |
| 114 | + - run: |
| 115 | + name: isort |
| 116 | + command: vk isort |
| 117 | + - run: |
| 118 | + name: cSpell |
| 119 | + command: vk cspell |
| 120 | + - run: |
| 121 | + name: Pylint spelling |
| 122 | + command: vk pylint-spelling |
| 123 | + |
| 124 | + test: |
| 125 | + docker: |
| 126 | + - image: cimg/python:3.10 |
| 127 | + steps: |
| 128 | + - attach_workspace: |
| 129 | + at: . |
| 130 | + - run: |
| 131 | + name: Install pdftotext and enchant |
| 132 | + command: | |
| 133 | + sudo apt update |
| 134 | + sudo apt install build-essential libpoppler-cpp-dev pkg-config enchant-2 |
| 135 | + - run: |
| 136 | + name: Upgrade pip |
| 137 | + command: pip3 install --upgrade pip |
| 138 | + - run: |
| 139 | + name: Install tox and coverage |
| 140 | + command: pip3 install tox coverage |
| 141 | + - run: |
| 142 | + name: Test |
| 143 | + command: tox |
| 144 | + - store_test_results: |
| 145 | + path: test-results |
| 146 | + - store_artifacts: |
| 147 | + path: test-results/html |
| 148 | + - codecov/upload: |
| 149 | + file: test-results/cov.xml |
| 150 | + |
| 151 | + build: |
| 152 | + docker: |
| 153 | + - image: cimg/python:3.10 |
| 154 | + steps: |
| 155 | + - attach_workspace: |
| 156 | + at: . |
| 157 | + - run: |
| 158 | + name: Upgrade pip |
| 159 | + command: pip3 install --upgrade pip |
| 160 | + - run: |
| 161 | + name: Install build |
| 162 | + command: pip install build |
| 163 | + - run: |
| 164 | + name: Substitute version |
| 165 | + command: | |
| 166 | + PACKAGE_VERSION=$(sed 's/^v//' \<<< ${CIRCLE_TAG:-0.0.0}) |
| 167 | + sed -i "s/0.0.0/$PACKAGE_VERSION/" ./flake8_plus/version.py |
| 168 | + - run: |
| 169 | + name: Check version number |
| 170 | + command: python setup.py verify |
| 171 | + - run: |
| 172 | + name: Build |
| 173 | + command: | |
| 174 | + python3 -m build |
| 175 | + - persist_to_workspace: |
| 176 | + root: . |
| 177 | + paths: |
| 178 | + - . |
| 179 | + |
| 180 | + upload: |
| 181 | + docker: |
| 182 | + - image: cimg/python:3.10 |
| 183 | + steps: |
| 184 | + - gh/setup |
| 185 | + - attach_workspace: |
| 186 | + at: . |
| 187 | + - run: |
| 188 | + name: Upgrade pip |
| 189 | + command: pip3 install --upgrade pip |
| 190 | + - run: |
| 191 | + name: Install twine |
| 192 | + command: pip install twine |
| 193 | + - run: |
| 194 | + name: Upload |
| 195 | + command: | |
| 196 | + twine upload dist/* |
| 197 | + - run: |
| 198 | + name: Create release |
| 199 | + command: | |
| 200 | + echo Creating release |
| 201 | + gh release create ${CIRCLE_TAG} ./dist/*.gz --title ${CIRCLE_TAG} --notes "$(git log `git tag --sort=-committerdate | head -1`...`git tag --sort=-committerdate | head -2 | tail -1` --pretty=format:"%h - **%s**%n%n%b")" |
0 commit comments