[c330f8]: / .circleci / config.yml

Download this file

100 lines (90 with data), 2.6 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
version: 2.1
executors:
python-3-9-6:
docker:
- image: cimg/python:3.9.6
node-docker:
docker:
- image: cimg/node:17.6.0
orbs:
python: circleci/python@1.5.0
jobs:
generate-version:
executor: node-docker
steps:
- checkout
- run:
name: install semantic release dependencies in root
command: |
npm --prefix .semantic-release run installInRoot
- run:
name: run semantic release
command: npx semantic-release
build-and-test:
executor: python-3-9-6
steps:
- checkout
- restore_cache:
keys:
- python-cache-{{ checksum "requirements.txt" }}
- python/install-packages:
pkg-manager: pip
# app-dir: ~/project/package-directory/ # If you're requirements.txt isn't in the root directory.
# pip-dependency-file: test-requirements.txt # if you have a different name for your requirements file, maybe one that combines your runtime and test requirements.
- save_cache:
paths:
- ~/.cache/pip
key: python-cache-{{ checksum "requirements.txt" }}
when: always
- run:
name: run unit tests
command: python -m pytest -v tests --cov=${CIRCLE_PROJECT_REPONAME/-/_}
release:
executor: python-3-9-6
steps:
- checkout
- restore_cache:
keys:
- python-cache-{{ checksum "requirements.txt" }}
- run:
name: install dependencies
command: |
pip install -r requirements.txt
pip install twine
- run:
name: create the distribution
command: |
python setup.py sdist
CHECKS=$(twine check dist/* | grep -c "PASSED")
N_FILES=$(( $(ls -l dist | wc -l) -1 ))
if [[ $CHECKS -ne $N_FILES ]]
then
echo "twine checks failed"
exit 1
fi
- run:
name: push to pypi
command: |
twine upload -u ${PYPI_USERNAME} -p ${PYPI_PASSWORD} dist/*
workflows:
version: 2
build-release:
jobs:
- generate-version:
filters:
branches:
only: "main"
- build-and-test
# filters:
# tags:
# only: /.*/
# branches:
# ignore: "main"
- release:
requires:
- build-and-test
# filters:
# branches:
# ignore: /.*/
# tags:
# only: /^deploy-.*/