Skip to content

Commit

Permalink
Fix CI: add tests to GitHub actions (openai#2262)
Browse files Browse the repository at this point in the history
* Initial CI fixes
  • Loading branch information
mzjp2 authored Jul 28, 2021
1 parent fe1e083 commit b064313
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 43 deletions.
1 change: 0 additions & 1 deletion .dockerignore

This file was deleted.

18 changes: 18 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: build
on: [pull_request, push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- run: |
docker build -f py.Dockerfile \
--build-arg MUJOCO_KEY=$MUJOCO_KEY \
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
--tag gym-docker .
- name: Run tests
run: docker run gym-docker pytest --forked
2 changes: 1 addition & 1 deletion .github/workflows/lint_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- run: flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- run: flake8 . --count --exit-zero --max-complexity=10 --max-line-length=88 --show-source --statistics
- run: isort --check-only --profile black . || true
- run: pip install -e .[all]
- run: pip install -e .[nomujoco]
- run: mypy --install-types --non-interactive . || true
- run: pytest . || true
- run: pytest --doctest-modules . || true
Expand Down
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

26 changes: 9 additions & 17 deletions py.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
# A Dockerfile that sets up a full Gym install with test dependencies
ARG PYTHON_VER
FROM python:$PYTHON_VER
ARG PYTHON_VERSION
FROM python:$PYTHON_VERSION
RUN apt-get -y update && apt-get install -y unzip libglu1-mesa-dev libgl1-mesa-dev libosmesa6-dev xvfb patchelf ffmpeg cmake swig
RUN \

# Download mujoco
mkdir /root/.mujoco && \
RUN mkdir /root/.mujoco && \
cd /root/.mujoco && \
curl -O https://www.roboti.us/download/mjpro150_linux.zip && \
unzip mjpro150_linux.zip

ARG PYTHON_VER
ARG MUJOCO_KEY
ENV MUJOCO_KEY=$MUJOCO_KEY
curl -O https://www.roboti.us/download/mjpro150_linux.zip && \
unzip mjpro150_linux.zip && \
echo DUMMY_KEY > /root/.mujoco/mjkey.txt

ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/.mujoco/mjpro150/bin
RUN echo $MUJOCO_KEY | base64 --decode > /root/.mujoco/mjkey.txt
RUN pip install pytest pytest-forked lz4

COPY . /usr/local/gym/
WORKDIR /usr/local/gym/
# install all extras for python 3.6 and 3.7, and skip mujoco add-ons for 3.8 and 3.9
# as mujoco 1.50 does not seem to work with 3.8 and 3.9
# RUN bash -c "[[ $PYTHON_VER =~ 3\.[6-7]\.[0-9] ]] && pip install -e .[all] || pip install -e .[nomujoco]"
RUN pip install -e .[nomujoco]

RUN pip install -e .[nomujoco] && pip install -r test_requirements.txt

ENTRYPOINT ["/usr/local/gym/bin/docker_entrypoint"]
CMD ["pytest","--forked"]
3 changes: 3 additions & 0 deletions test_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
lz4~=3.1
pytest~=6.2
pytest-forked~=1.3

0 comments on commit b064313

Please sign in to comment.