version: 2.1 executors: python37: docker: - image: circleci/python:3.7.9 resource_class: small python38: docker: - image: circleci/python:3.8.6 resource_class: small python39: docker: - image: cimg/python:3.9.0 resource_class: small with_browser: docker: - image: cimg/python:3.9.0-browsers resource_class: small mac: macos: xcode: 12.1.0 commands: get_poetry_deps: steps: - run: name: Checking Python version command: | python --version python --version > /tmp/pythonversion - restore_cache: key: deps-00-{{ checksum "poetry.lock" }}-{{ checksum "/tmp/pythonversion" }}-{{ arch }} - run: name: Installing dependencies command: | poetry config --local virtualenvs.in-project true poetry install --no-root --remove-untracked - save_cache: key: deps-00-{{ checksum "poetry.lock" }}-{{ checksum "/tmp/pythonversion" }}-{{ arch }} paths: - ~/project/.venv install_pa11y: steps: - restore_cache: key: deps-00-pa11y - run: name: Install accessibility software (pa11y) command: npm install pa11y pa11y-reporter-junit - save_cache: key: deps-00-pa11y paths: - ~/project/node_modules install_pyenv_poetry: steps: - run: name: Checking Python version command: | echo "python: $JRNL_PYTHON_VERSION" echo "$JRNL_PYTHON_VERSION" > /tmp/pythonversion - restore_cache: key: pyenv-00-{{ checksum "/tmp/pythonversion" }} - run: name: Updating path command: echo 'export PATH="$HOME/.pyenv/bin:$HOME/.pyenv/shims:$PATH"' >> $BASH_ENV - run: name: Installing Pyenv command: | if [[ ! -d ~/.pyenv ]]; then curl https://pyenv.run | bash fi - run: name: Installing Python command: | pyenv install -s $JRNL_PYTHON_VERSION pyenv global $JRNL_PYTHON_VERSION - run: name: Installing Poetry command: pip install poetry - save_cache: key: pyenv-00-{{ checksum "/tmp/pythonversion" }} paths: - ~/.pyenv pytest: steps: - run: name: Tests - Pytest when: always command: > poetry run pytest --junitxml=reports/pytest/results.xml behave: steps: - run: name: Tests - Behave when: always command: > poetry run behave --no-skipped --format progress2 --junit --junit-directory reports/behave lint: steps: - run: name: Poetry Check when: always command: | poetry --version poetry check - run: name: Black Code Formatter when: always command: | poetry run black --version poetry run black --check --diff . - run: name: PyFlakes when: always command: | poetry run pyflakes --version poetry run pyflakes jrnl features tests aliases: linux_test: &linux_test steps: - checkout - get_poetry_deps - run: poetry install - pytest - behave - store_test_results: path: reports mac_test: &mac_test steps: - checkout - install_pyenv_poetry - get_poetry_deps - run: poetry install - pytest - behave - store_test_results: path: reports jobs: test_37_linux: executor: python37 <<: *linux_test test_38_linux: executor: python38 <<: *linux_test test_39_linux: executor: python39 <<: *linux_test test_37_mac: executor: mac environment: JRNL_PYTHON_VERSION: 3.7.8 <<: *mac_test test_38_mac: executor: mac environment: JRNL_PYTHON_VERSION: 3.8.6 <<: *mac_test test_39_mac: executor: mac environment: JRNL_PYTHON_VERSION: 3.9.0 <<: *mac_test linting: executor: python39 steps: - checkout - get_poetry_deps - lint docs_a11y: executor: with_browser steps: - checkout - get_poetry_deps - install_pa11y - run: name: Starting mkdocs server command: poetry run mkdocs serve background: true - run: poetry run .circleci/pa11y.sh - store_test_results: path: reports workflows: version: 2 main: jobs: - docs_a11y: name: Documentation site (jrnl.sh) accessibility - linting: name: Linting and Formatting - test_37_linux: name: Python 3.7 - Linux - test_38_linux: name: Python 3.8 - Linux - test_39_linux: name: Python 3.9 - Linux - test_37_mac: name: Python 3.7 - Mac - test_38_mac: name: Python 3.8 - Mac - test_39_mac: name: Python 3.9 - Mac