.circleci/config.yml
version: 2.1
workflows:
run_tests:
jobs:
- build_and_test:
name: py36
python_version: "3.6"
filters:
tags:
only: /.*/
- build_and_test:
name: py37
python_version: "3.7"
filters:
tags:
only: /.*/
- build_and_test:
name: py38
python_version: "3.8"
filters:
tags:
only: /.*/
- packaging_test:
filters:
tags:
only: /.*/
- build_and_test_with_coverage:
requires:
- py36
- py37
- py38
filters:
tags:
only: /.*/
- deploy:
requires:
- build_and_test_with_coverage
filters:
tags:
only: /^v.*/
branches:
ignore: /.*/
jobs:
build_and_test:
parameters:
python_version:
type: string
docker:
- image: cimg/python:<< parameters.python_version >>
steps:
- checkout
- run:
name: Generate crypto test materials
command: |
ls -l
export ORIGIN=${PWD}
cp tests/scripts/generate_crypto.sh ./
cp tests/configs/ssl.cnf ./
bash ./generate_crypto.sh
cd ${ORIGIN}
mkdir -p tests/fixtures/dynamic
sudo cp ${HOME}/export/* tests/fixtures/dynamic/
sudo chown -R `whoami` ${HOME}
pip3 install --upgrade pip
- run:
name: Install deps and package
command: |
pip3 install -r requirements-test.txt
pip3 install .
- run:
name: Install deps and run unit and integration tests
command: |
python3 -m pytest --cov=dane_discovery --cov-report=xml --cov-report=term-missing -v
build_and_test_with_coverage:
docker:
- image: cimg/python:3.11
steps:
- checkout
- run:
name: Generate crypto test materials
command: |
ls -l
export ORIGIN=${PWD}
cp tests/scripts/generate_crypto.sh ./
cp tests/configs/ssl.cnf ./
bash ./generate_crypto.sh
cd ${ORIGIN}
mkdir -p tests/fixtures/dynamic
sudo cp ${HOME}/export/* tests/fixtures/dynamic/
sudo chown -R `whoami` ${HOME}
- run:
name: Install deps and package
command: |
pip3 install -r requirements-test.txt
pip3 install .
- run:
name: Install deps, run unit and integration tests, publish coverage
command: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
python3 -m pytest --cov=dane_discovery --cov-report=xml --cov-report=term-missing
./cc-test-reporter format-coverage -t coverage.py ./coverage.xml
./cc-test-reporter upload-coverage
./cc-test-reporter after-build --exit-code $?
build_docs:
docker:
- image: cimg/python:3.11
steps:
- checkout
- run:
name: Install deps and package
command: |
pip3 install -r requirements-develop.txt
pip3 install -r requirements-test.txt
pip3 install -r requirements-doc.txt
pip3 install .
- run:
name: Test building docs
command: |
cd docs
make html
- run:
name: Trigger build in RTD
command: |
curl -X POST -d "branches=${CIRCLE_BRANCH}" -d "token=${RTD_TOKEN}" ${RTD_URL}
packaging_test:
docker:
- image: cimg/python:3.11
steps:
- checkout
- run:
name: Install Twine
command: pip3 install twine
- run:
name: Build bdist wheel
command: |
python setup.py sdist
python setup.py bdist_wheel
python setup.py bdist --format=gztar
ls ./*
twine check dist/*
deploy:
docker:
- image: cimg/python:3.11
steps:
- checkout
- run:
name: Write PyPI config
command: |
echo -e "[pypi]" >> ~/.pypirc
echo -e "username = __token__" >> ~/.pypirc
echo -e "password = ${PYPI_TOKEN}" >> ~/.pypirc
- run:
name: Build sdist, wheel
command: |
python setup.py sdist
python setup.py bdist_wheel
- run:
name: Upload to pypi
command: |
pip3 install twine
twine upload dist/*