---
version: 2.1
commands:
cleanup:
steps:
- run:
shell: /bin/bash
name: "Cleanup"
command: |
make clean
when: always
reposync:
steps:
- run:
shell: /bin/bash
name: "Fetch"
command: |
git fetch --all ;
when: always
- run:
shell: /bin/bash
name: "Sync Submodules"
command: |
git submodule sync ;
when: on_success
- run:
shell: /bin/bash
name: "Update Submodules"
command: |
git submodule update --init ;
when: on_success
parameters:
python-version:
type: string
default: "3.12"
jobs:
build:
docker:
- image: cimg/python:<< pipeline.parameters.python-version >>
resource_class: medium
environment:
CI: cicleci
DEBIAN_FRONTEND: noninteractive
LANG: en_US.UTF-8
LC_CTYPE: en_US.UTF-8
SHELL: /bin/bash
working_directory: ~/python-repo
steps:
- checkout
- reposync
- run:
shell: /bin/bash
name: "install depends attempt"
command: |
python3 -m pip install --user -r ./requirements.txt || : ;
when: on_success
- run:
shell: /bin/bash
name: "install test depends attempt"
command: |
python3 -m pip install --upgrade --user -r ./test-requirements.txt || : ;
when: on_success
- save_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/python-repo
test:
docker:
- image: cimg/python:<< pipeline.parameters.python-version >>
parallelism: 2
resource_class: medium
environment:
CI: cicleci
DEBIAN_FRONTEND: noninteractive
LANG: en_US.UTF-8
LC_CTYPE: en_US.UTF-8
SHELL: /bin/bash
working_directory: ~/python-repo
steps:
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- run:
shell: /bin/bash
name: "Installing deps for test"
command: |
python3 -m pip install --upgrade --user -r ./test-requirements.txt || : ;
when: on_success
- cleanup
- run:
shell: /bin/bash
name: "Unit Tests"
command: |
make test
when: on_success
- cleanup
pytest:
docker:
- image: cimg/python:<< pipeline.parameters.python-version >>
parallelism: 2
resource_class: medium
environment:
CI: cicleci
DEBIAN_FRONTEND: noninteractive
LANG: en_US.UTF-8
LC_CTYPE: en_US.UTF-8
SHELL: /bin/bash
working_directory: ~/python-repo
steps:
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- run:
shell: /bin/bash
name: "set up depends"
command: |
python3 -m pip install --upgrade --user -r ./requirements.txt || : ;
when: on_success
- run:
shell: /bin/bash
name: "install test-reqs attempt"
command: |
python3 -m pip install --upgrade --user -r ./test-requirements.txt || : ;
when: on_success
- cleanup
- run:
shell: /bin/bash
name: "pytest Unit Tests"
command: |
make test-pytest
when: on_success
- store_test_results:
path: test-reports
when: on_success
- store_artifacts:
path: test-reports
when: on_success
- cleanup
lint:
docker:
- image: cimg/python:<< pipeline.parameters.python-version >>
resource_class: medium
environment:
CI: cicleci
DEBIAN_FRONTEND: noninteractive
LANG: en_US.UTF-8
SHELL: /bin/bash
LC_CTYPE: en_US.UTF-8
working_directory: ~/python-repo
steps:
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: "install reqs attempt"
command: |
python3 -m pip install --user -r ./requirements.txt || : ;
- run:
name: "install test-reqs attempt"
command: |
python3 -m pip install --user -r ./test-requirements.txt || : ;
- cleanup
- run:
shell: /bin/bash
name: "check code style and spelling"
command: |
make test-style || python3 -m flake8 --verbose --count --config=.flake8.ini
- cleanup
workflows:
version: 2
test-matrix:
jobs:
- build
- test:
requires:
- build
- lint:
requires:
- build
- pytest:
requires:
- build
- test