您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
221 行
7.5 KiB
221 行
7.5 KiB
version: 2.1
|
|
executors:
|
|
python361:
|
|
docker:
|
|
- image: circleci/python:3.6.1
|
|
python373:
|
|
docker:
|
|
- image: circleci/python:3.7.3
|
|
python382:
|
|
docker:
|
|
- image: circleci/python:3.8.2
|
|
|
|
jobs:
|
|
build_python:
|
|
parameters:
|
|
executor:
|
|
type: executor
|
|
pyversion:
|
|
type: string
|
|
description: python version to being used (currently only affects caching).
|
|
pip_constraints:
|
|
type: string
|
|
description: Constraints file that is passed to "pip install". We constraint older versions of libraries for older python runtime, in order to help ensure compatibility.
|
|
executor: << parameters.executor >>
|
|
working_directory: ~/repo
|
|
|
|
# Run additional numpy checks on unit tests
|
|
environment:
|
|
TEST_ENFORCE_NUMPY_FLOAT32: 1
|
|
# Whether to raise an exception if ONNX models couldn't be saved.
|
|
TEST_ENFORCE_ONNX_CONVERSION: 1
|
|
|
|
steps:
|
|
- checkout
|
|
|
|
- run:
|
|
# Combine all the python dependencies into one file so that we can use that for the cache checksum
|
|
name: Combine pip dependencies for caching
|
|
command: cat ml-agents/setup.py ml-agents-envs/setup.py gym-unity/setup.py test_requirements.txt << parameters.pip_constraints >> > python_deps.txt
|
|
|
|
- restore_cache:
|
|
keys:
|
|
# Parameterize the cache so that different python versions can get different versions of the packages
|
|
- v1-dependencies-py<< parameters.pyversion >>-{{ checksum "python_deps.txt" }}
|
|
|
|
- run:
|
|
name: Install Dependencies
|
|
command: |
|
|
python3 -m venv venv
|
|
. venv/bin/activate
|
|
pip install --upgrade pip
|
|
pip install --upgrade setuptools
|
|
pip install --progress-bar=off -e ./ml-agents-envs -c << parameters.pip_constraints >>
|
|
pip install --progress-bar=off -e ./ml-agents -c << parameters.pip_constraints >>
|
|
pip install --progress-bar=off -r test_requirements.txt -c << parameters.pip_constraints >>
|
|
pip install --progress-bar=off -e ./gym-unity -c << parameters.pip_constraints >>
|
|
|
|
- save_cache:
|
|
paths:
|
|
- ./venv
|
|
key: v1-dependencies-py<< parameters.pyversion >>-{{ checksum "python_deps.txt" }}
|
|
|
|
- run:
|
|
name: Run Tests for ml-agents and gym_unity
|
|
# This also dumps the installed pip packages to a file, so we can see what versions are actually being used.
|
|
command: |
|
|
. venv/bin/activate
|
|
mkdir test-reports
|
|
pip freeze > test-reports/pip_versions.txt
|
|
pytest --cov=ml-agents --cov=ml-agents-envs --cov=gym-unity --cov-report html --junitxml=test-reports/junit.xml -p no:warnings
|
|
|
|
- run:
|
|
name: Verify there are no hidden/missing metafiles.
|
|
# Renaming files or deleting files can leave metafiles behind that makes Unity very unhappy.
|
|
command: |
|
|
. venv/bin/activate
|
|
python utils/validate_meta_files.py
|
|
|
|
- store_test_results:
|
|
path: test-reports
|
|
|
|
- store_artifacts:
|
|
path: test-reports
|
|
destination: test-reports
|
|
|
|
- store_artifacts:
|
|
path: htmlcov
|
|
destination: htmlcov
|
|
|
|
deploy:
|
|
parameters:
|
|
directory:
|
|
type: string
|
|
description: Local directory to use for publishing (e.g. ml-agents)
|
|
username:
|
|
type: string
|
|
description: pypi username
|
|
default: mlagents
|
|
test_repository_args:
|
|
type: string
|
|
description: Optional override repository URL. Only use for tests, leave blank for "real"
|
|
default: ""
|
|
docker:
|
|
- image: circleci/python:3.6
|
|
steps:
|
|
- checkout
|
|
- run:
|
|
name: install python dependencies
|
|
command: |
|
|
python3 -m venv venv
|
|
. venv/bin/activate
|
|
pip install --upgrade pip
|
|
pip install setuptools wheel twine
|
|
- run:
|
|
name: verify git tag vs. version
|
|
command: |
|
|
python3 -m venv venv
|
|
. venv/bin/activate
|
|
cd << parameters.directory >>
|
|
python setup.py verify
|
|
- run:
|
|
name: create packages
|
|
command: |
|
|
. venv/bin/activate
|
|
cd << parameters.directory >>
|
|
python setup.py sdist
|
|
python setup.py bdist_wheel
|
|
- run:
|
|
name: upload to pypi
|
|
# To upload to test, just add the following flag to twine upload:
|
|
# --repository-url https://test.pypi.org/legacy/
|
|
# and change the username to "mlagents-test"
|
|
command: |
|
|
. venv/bin/activate
|
|
cd << parameters.directory >>
|
|
twine upload -u << parameters.username >> -p $PYPI_PASSWORD << parameters.test_repository_args >> dist/*
|
|
|
|
workflows:
|
|
version: 2
|
|
workflow:
|
|
jobs:
|
|
- build_python:
|
|
name: python_3.6.1
|
|
executor: python361
|
|
pyversion: 3.6.1
|
|
# Test python 3.6 with the oldest supported versions
|
|
pip_constraints: test_constraints_min_version.txt
|
|
- build_python:
|
|
name: python_3.7.3
|
|
executor: python373
|
|
pyversion: 3.7.3
|
|
# Test python 3.7 with the newest supported versions of 1.x
|
|
pip_constraints: test_constraints_max_tf1_version.txt
|
|
- build_python:
|
|
name: python_3.8.2+tf2.2
|
|
executor: python382
|
|
pyversion: 3.8.2
|
|
# Test python 3.8 with the newest edge versions
|
|
pip_constraints: test_constraints_max_tf2_version.txt
|
|
# The first deploy jobs are the "real" ones that upload to pypi
|
|
- deploy:
|
|
name: deploy ml-agents-envs
|
|
directory: ml-agents-envs
|
|
filters:
|
|
tags:
|
|
# Matches e.g. "release_123"
|
|
only: /^release_[0-9]+$/
|
|
branches:
|
|
ignore: /.*/
|
|
- deploy:
|
|
name: deploy ml-agents
|
|
directory: ml-agents
|
|
filters:
|
|
tags:
|
|
# Matches e.g. "release_123"
|
|
only: /^release_[0-9]+$/
|
|
branches:
|
|
ignore: /.*/
|
|
- deploy:
|
|
name: deploy gym-unity
|
|
directory: gym-unity
|
|
filters:
|
|
tags:
|
|
# Matches e.g. "release_123"
|
|
only: /^release_[0-9]+$/
|
|
branches:
|
|
ignore: /.*/
|
|
# These deploy jobs upload to the pypi test repo. They have different tag triggers than the real ones.
|
|
- deploy:
|
|
name: test deploy ml-agents-envs
|
|
directory: ml-agents-envs
|
|
username: mlagents-test
|
|
test_repository_args: --repository-url https://test.pypi.org/legacy/
|
|
filters:
|
|
tags:
|
|
# Matches e.g. "release_123_test456
|
|
only: /^release_[0-9]+_test[0-9]+$/
|
|
branches:
|
|
ignore: /.*/
|
|
- deploy:
|
|
name: test deploy ml-agents
|
|
directory: ml-agents
|
|
username: mlagents-test
|
|
test_repository_args: --repository-url https://test.pypi.org/legacy/
|
|
filters:
|
|
tags:
|
|
# Matches e.g. "release_123_test456
|
|
only: /^release_[0-9]+_test[0-9]+$/
|
|
branches:
|
|
ignore: /.*/
|
|
- deploy:
|
|
name: test deploy gym-unity
|
|
directory: gym-unity
|
|
username: mlagents-test
|
|
test_repository_args: --repository-url https://test.pypi.org/legacy/
|
|
filters:
|
|
tags:
|
|
# Matches e.g. "release_123_test456
|
|
only: /^release_[0-9]+_test[0-9]+$/
|
|
branches:
|
|
ignore: /.*/
|