-
Notifications
You must be signed in to change notification settings - Fork 259
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Prototype CircleCI and Docker config * Update Docker and setup * Fix typo in Dockerfile * Include mujoco_py support * Install right version of MuJoCo * CircleCI: fix cache saving * Fix linting * Replace local code checks script * Fix typechecking * envs: close environment after testing * Fix Dockerfile and setup.py * Bugfix: include AIRL example envs assets in install * CircleCI: codespell - skip notebooks * test_scripts: reduce Ray resource consumption * setup.py: fix pytype ignore comment * test_scripts: limit # of trials running in parallel * Remove Travis config * Update status badge in README * Address code review * README.md: Bump python version
- Loading branch information
1 parent
43e23fa
commit b3f66d2
Showing
16 changed files
with
290 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
version: 2.1 | ||
|
||
orbs: | ||
codecov: codecov/[email protected] | ||
|
||
executors: | ||
my-executor: | ||
docker: | ||
- image: humancompatibleai/imitation:base | ||
working_directory: /imitation | ||
environment: | ||
# If you change these, also change ci/code_checks.sh | ||
SRC_FILES: src/ tests/ experiments/ setup.py | ||
|
||
commands: | ||
dependencies: | ||
# You must still manually update the Docker image if any | ||
# binary (non-Python) dependencies change. | ||
description: "Check out and update Python dependencies." | ||
steps: | ||
- checkout | ||
# Download and cache dependencies | ||
- restore_cache: | ||
keys: | ||
- v1-dependencies-{{ checksum "setup.py" }} | ||
|
||
- run: | ||
name: install dependencies | ||
# MUJOCO_KEY is defined in a CircleCI context | ||
# Do some sanity checks to make sure key works | ||
command: | | ||
curl -o /root/.mujoco/mjkey.txt ${MUJOCO_KEY} | ||
md5sum /root/.mujoco/mjkey.txt | ||
# Only create venv if it's not been restored from cache | ||
[[ -d venv ]] || USE_MPI=True ./ci/build_venv.sh | ||
python -c "import mujoco_py" | ||
- save_cache: | ||
paths: | ||
- ./venv | ||
key: v1-dependencies-{{ checksum "setup.py" }} | ||
|
||
- run: | ||
name: install imitation | ||
# Build a wheel then install to avoid copying whole directory (pip issue #2195) | ||
command: | | ||
python setup.py sdist bdist_wheel | ||
pip install --upgrade dist/imitation-*.whl | ||
jobs: | ||
lintandtype: | ||
executor: my-executor | ||
|
||
steps: | ||
- dependencies | ||
- run: | ||
name: flake8 | ||
command: flake8 ${SRC_FILES} | ||
|
||
- run: | ||
name: codespell | ||
command: codespell -I .codespell.skip --skip='*.pyc,tests/data/*,*.ipynb,*.csv' ${SRC_FILES} | ||
|
||
- run: | ||
name: sphinx | ||
command: pushd docs/ && make clean && make html && popd | ||
|
||
- run: | ||
name: pytype | ||
command: pytype ${SRC_FILES} | ||
|
||
unit-test: | ||
executor: my-executor | ||
parallelism: 3 | ||
steps: | ||
- dependencies | ||
|
||
- run: | ||
name: Memory Monitor | ||
command: | | ||
mkdir /tmp/resource-usage | ||
export FILE=/tmp/resource-usage/memory.txt | ||
while true; do | ||
ps -u root eo pid,%cpu,%mem,args,uname --sort=-%mem >> $FILE | ||
echo "----------" >> $FILE | ||
sleep 1 | ||
done | ||
background: true | ||
|
||
- run: | ||
name: run tests | ||
command: | | ||
export DISPLAY=:0 | ||
pytest --cov=venv/lib/python3.7/site-packages/imitation --cov=tests \ | ||
--junitxml=/tmp/test-reports/junit.xml \ | ||
--shard-id=${CIRCLE_NODE_INDEX} --num-shards=${CIRCLE_NODE_TOTAL} \ | ||
-vv tests/ | ||
mv .coverage .coverage.imitation | ||
coverage combine # rewrite paths from virtualenv to src/ | ||
- codecov/upload | ||
|
||
- store_artifacts: | ||
path: /tmp/test-reports | ||
destination: test-reports | ||
- store_test_results: | ||
path: /tmp/test-reports | ||
unit-test: | ||
- store_artifacts: | ||
path: /tmp/resource-usage | ||
destination: resource-usage | ||
|
||
workflows: | ||
version: 2 | ||
test: | ||
jobs: | ||
- lintandtype: | ||
context: MuJoCo | ||
- unit-test: | ||
context: MuJoCo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Based on OpenAI's mujoco-py Dockerfile | ||
|
||
# base stage contains just binary dependencies. | ||
# This is used in the CI build. | ||
FROM nvidia/cuda:10.0-runtime-ubuntu18.04 AS base | ||
ARG DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections \ | ||
&& apt-get update -q \ | ||
&& apt-get install -y --no-install-recommends \ | ||
build-essential \ | ||
curl \ | ||
ffmpeg \ | ||
git \ | ||
libgl1-mesa-dev \ | ||
libgl1-mesa-glx \ | ||
libglew-dev \ | ||
libosmesa6-dev \ | ||
net-tools \ | ||
parallel \ | ||
python3.7 \ | ||
python3.7-dev \ | ||
python3-pip \ | ||
rsync \ | ||
software-properties-common \ | ||
unzip \ | ||
vim \ | ||
virtualenv \ | ||
xpra \ | ||
xserver-xorg-dev \ | ||
ttf-mscorefonts-installer \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN curl -o /usr/local/bin/patchelf https://s3-us-west-2.amazonaws.com/openai-sci-artifacts/manual-builds/patchelf_0.9_amd64.elf \ | ||
&& chmod +x /usr/local/bin/patchelf | ||
|
||
ENV LANG C.UTF-8 | ||
|
||
RUN mkdir -p /root/.mujoco \ | ||
&& curl -o mjpro150.zip https://www.roboti.us/download/mjpro150_linux.zip \ | ||
&& unzip mjpro150.zip -d /root/.mujoco \ | ||
&& rm mjpro150.zip | ||
|
||
# Set the PATH to the venv before we create the venv, so it's visible in base. | ||
# This is since we may create the venv outside of Docker, e.g. in CI | ||
# or by binding it in for local development. | ||
ENV PATH="/imitation/venv/bin:$PATH" | ||
ENV LD_LIBRARY_PATH /usr/local/nvidia/lib64:/root/.mujoco/mjpro150/bin:${LD_LIBRARY_PATH} | ||
|
||
# python-req stage contains Python venv, but not code. | ||
# It is useful for development purposes: you can mount | ||
# code from outside the Docker container. | ||
FROM base as python-req | ||
|
||
WORKDIR /imitation | ||
# Copy over just setup.py and __init__.py (including version) | ||
# to avoid rebuilding venv when requirements have not changed. | ||
COPY ./setup.py ./setup.py | ||
COPY ./src/imitation/__init__.py ./src/imitation/__init__.py | ||
COPY ./ci/build_venv.sh ./ci/build_venv.sh | ||
# mjkey.txt needs to exist for build, but doesn't need to be a real key | ||
RUN touch /root/.mujoco/mjkey.txt \ | ||
&& ci/build_venv.sh \ | ||
&& rm -rf $HOME/.cache/pip | ||
|
||
# full stage contains everything. | ||
# Can be used for deployment and local testing. | ||
FROM python-req as full | ||
|
||
# Delay copying (and installing) the code until the very end | ||
COPY . /imitation | ||
# Build a wheel then install to avoid copying whole directory (pip issue #2195) | ||
RUN python3 setup.py sdist bdist_wheel | ||
RUN pip install --upgrade dist/imitation-*.whl | ||
|
||
# Default entrypoints | ||
CMD ["pytest", "-n", "auto", "-vv", "tests/"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e # exit immediately on any error | ||
|
||
venv=venv | ||
virtualenv -p python3.7 ${venv} | ||
source ${venv}/bin/activate | ||
pip install .[cpu,dev,test] gym[mujoco] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
# If you change these, also change .circle/config.yml. | ||
SRC_FILES=(src/ tests/ experiments/ setup.py) | ||
|
||
set -x # echo commands | ||
set -e # quit immediately on error | ||
|
||
echo "Source format checking" | ||
flake8 ${SRC_FILES} | ||
codespell -I .codespell.skip --skip='*.pyc,tests/data/*,*.ipynb,*.csv' ${SRC_FILES} | ||
|
||
if [ -x "`which circleci`" ]; then | ||
circleci config validate | ||
fi | ||
|
||
if [ "$skipexpensive" != "true" ]; then | ||
echo "Building docs (validates docstrings)" | ||
pushd docs/ | ||
make clean | ||
make html | ||
popd | ||
|
||
echo "Type checking" | ||
pytype ${SRC_FILES} | ||
fi |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.