version: 2.1 parameters: min_py_ver: type: string default: "3.7" max_py_ver: type: string default: "3.10" min_tf_ver: type: string default: "2.4" max_tf_ver: type: string default: "2.8" min_tfp_ver: type: string default: "0.12" max_tfp_ver: type: string default: "0.16" commands: setup_venv: parameters: py_ver: type: string steps: - checkout - run: name: Setup virtual environment command: | # Run in a fresh virtual environment, to avoid conflicts with preinstalled packages. virtualenv -p python<> .venv source .venv/bin/activate pip install --progress-bar=off -U pip install_gpflow: parameters: py_ver: type: string tf_ver: type: string tfp_ver: type: string steps: - setup_venv: py_ver: <> - run: name: Install GPflow command: " source .venv/bin/activate \n # Everything is installed in one pip command, to allow for better dependency version # resolution. Explicit tensorflow and tensorflow-probability version, to ensure # consistency between them. \n pip install --progress-bar=off -e . -r tests_requirements.txt tensorflow==<> tensorflow-probability==<> \n " run_tests: parameters: py_ver: type: string tf_ver: type: string tfp_ver: type: string pytest_filter: type: string steps: - install_gpflow: py_ver: <> tf_ver: <> tfp_ver: <> - run: name: Run tests command: | source .venv/bin/activate pytest -v -W ignore::UserWarning --durations=10 -m "<>" --cov=./gpflow ./tests - run: name: Upload coverage report command: | source .venv/bin/activate bash <(curl -s https://codecov.io/bash) -t "${CODECOV_TOKEN}" jobs: verify-install: parameters: py_ver: type: string tf_ver: type: string tfp_ver: type: string docker: - image: cimg/python:<> steps: - install_gpflow: py_ver: <> tf_ver: <> tfp_ver: <> - run: name: Check installed dependencies are compatible command: | source .venv/bin/activate pip check -vvv python -c "import gpflow" type-check: parameters: py_ver: type: string tf_ver: type: string tfp_ver: type: string docker: - image: cimg/python:<> steps: - install_gpflow: py_ver: <> tf_ver: <> tfp_ver: <> - run: name: Run type check command: | source .venv/bin/activate mypy gpflow tests format-check: parameters: py_ver: type: string tf_ver: type: string tfp_ver: type: string docker: - image: cimg/python:<> steps: - install_gpflow: py_ver: <> tf_ver: <> tfp_ver: <> - run: name: Run format check command: | source .venv/bin/activate make format-check unit-test: parameters: py_ver: type: string tf_ver: type: string tfp_ver: type: string docker: - image: cimg/python:<> steps: - run_tests: py_ver: <> tf_ver: <> tfp_ver: <> pytest_filter: not notebooks notebook-test: parameters: py_ver: type: string tf_ver: type: string tfp_ver: type: string docker: - image: cimg/python:<> steps: - run_tests: py_ver: <> tf_ver: <> tfp_ver: <> pytest_filter: notebooks build-docs: docker: # At the time of writing we cannot generate documentation for type numpy with older versions, # so we need to use `max` versions here. - image: cimg/python:<> environment: DOCS: True # This is used in gpflow/ci_utils.py steps: - install_gpflow: py_ver: <> tf_ver: <> tfp_ver: <> - run: name: Install pandoc command: | sudo apt update sudo apt install pandoc - run: name: Build documentation no_output_timeout: 60m command: | source .venv/bin/activate mkdir docs_tmp time python doc/build_docs.py <> docs_tmp - add_ssh_keys: fingerprints: # Add key to give write-access below - "b5:9b:f3:74:26:00:b3:c3:de:3a:b3:03:ee:0b:0b:64" - run: name: Commit documentation command: | source .venv/bin/activate git clone -b gh-pages git@github.com:GPflow/GPflow.git gh-pages for version in docs_tmp/*; do rm -rf gh-pages/docs/${version} done cp -r docs_tmp/* gh-pages/docs python doc/update_versions.py <> gh-pages/docs cd gh-pages/docs git config user.email "docs.bot@gpflow.com" git config user.name "Docs Bot" git add . git commit -m "Build documentation for <> [ci skip]" git push origin gh-pages deploy: docker: - image: cimg/python:<> steps: - checkout - run: name: Verify git tag vs. VERSION command: | VERSION="v$(cat VERSION | tr -d '\t\r\n ')" if [ "$VERSION" != "$CIRCLE_TAG" ]; then echo "The package version ($VERSION) and the latest tag version ($CIRCLE_TAG) are different" exit 1 fi - run: name: Install twine command: | # Run in a fresh virtual environment, to avoid conflicts with preinstalled packages. virtualenv -p python<> .venv source .venv/bin/activate pip install --progress-bar=off -U pip pip install --progress-bar=off twine - run: name: Init .pypirc command: | echo -e "[pypi]" >> ~/.pypirc echo -e "username = artemav" >> ~/.pypirc echo -e "password = $PYPI_PASSWORD" >> ~/.pypirc - run: name: Create pip package command: | source .venv/bin/activate python setup.py bdist_wheel sdist - run: name: Upload to PyPI command: | source .venv/bin/activate twine upload dist/* workflows: version: 2.1 build_test_and_deploy: jobs: - verify-install: name: verify-install-min py_ver: <> tf_ver: <> tfp_ver: <> filters: tags: only: /^v[0-9]+(\.[0-9]+)*(-rc[0-9]+)?/ - verify-install: name: verify-install-max py_ver: <> tf_ver: <> tfp_ver: <> filters: tags: only: /^v[0-9]+(\.[0-9]+)*(-rc[0-9]+)?/ - type-check: name: type-check-min py_ver: <> tf_ver: <> tfp_ver: <> filters: tags: only: /^v[0-9]+(\.[0-9]+)*(-rc[0-9]+)?/ - type-check: name: type-check-max py_ver: <> tf_ver: <> tfp_ver: <> filters: tags: only: /^v[0-9]+(\.[0-9]+)*(-rc[0-9]+)?/ - format-check: name: format-check-min py_ver: <> tf_ver: <> tfp_ver: <> filters: tags: only: /^v[0-9]+(\.[0-9]+)*(-rc[0-9]+)?/ - format-check: name: format-check-max py_ver: <> tf_ver: <> tfp_ver: <> filters: tags: only: /^v[0-9]+(\.[0-9]+)*(-rc[0-9]+)?/ - unit-test: name: unit-test-min py_ver: <> tf_ver: <> tfp_ver: <> requires: - verify-install-min - verify-install-max - type-check-min - type-check-max - format-check-min - format-check-max filters: tags: only: /^v[0-9]+(\.[0-9]+)*(-rc[0-9]+)?/ - unit-test: name: unit-test-max py_ver: <> tf_ver: <> tfp_ver: <> requires: - verify-install-min - verify-install-max - type-check-min - type-check-max - format-check-min - format-check-max filters: tags: only: /^v[0-9]+(\.[0-9]+)*(-rc[0-9]+)?/ - notebook-test: name: notebook-test-min py_ver: <> tf_ver: <> tfp_ver: <> requires: - verify-install-min - verify-install-max - type-check-min - type-check-max - format-check-min - format-check-max filters: tags: only: /^v[0-9]+(\.[0-9]+)*(-rc[0-9]+)?/ - notebook-test: name: notebook-test-max py_ver: <> tf_ver: <> tfp_ver: <> requires: - verify-install-min - verify-install-max - type-check-min - type-check-max - format-check-min - format-check-max filters: tags: only: /^v[0-9]+(\.[0-9]+)*(-rc[0-9]+)?/ - build-docs: requires: - verify-install-min - verify-install-max - type-check-min - type-check-max - format-check-min - format-check-max - unit-test-min - unit-test-max - notebook-test-min - notebook-test-max filters: branches: only: - master - develop - deploy: requires: - verify-install-min - verify-install-max - type-check-min - type-check-max - format-check-min - format-check-max - unit-test-min - unit-test-max - notebook-test-min - notebook-test-max filters: tags: only: /^v[0-9]+(\.[0-9]+)*(-rc[0-9]+)?/ branches: ignore: /.*/