name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
container:
image: synthillect/opencog-minerl
options: --user root
steps:
- name: Add .local/bin to PATH
run: |
echo "/home/opencog/.local/bin" >> $GITHUB_PATH
echo "/github/home/.local/bin" >> $GITHUB_PATH
- name: Add .local Python library dir to sys.path
run: |
export PYTHON_VERSION=$(python3 --version | cut -d' ' -f2 | cut -d'.' -f1,2)
echo "PYTHONPATH=/home/opencog/.local/lib/python$PYTHON_VERSION/site-packages" >> $GITHUB_ENV
- uses: actions/checkout@v2
- name: Install the library
run: |
python3 -m pip install --user --upgrade pip wheel setuptools
python3 -m pip install --user -r requirements-dev.txt
python3 -m pip install --user -e .
- name: Read all notebooks
run: |
nbdev_read_nbs
- name: Check if all notebooks are cleaned
run: |
echo "Check we are starting with clean git checkout"
if [ -n "$(git status -uno -s)" ]; then echo "git status is not clean"; false; fi
echo "Trying to strip out notebooks"
nbdev_clean_nbs
echo "Check that strip out was unnecessary"
git status -s # display the status to see which nbs need cleaning up
if [ -n "$(git status -uno -s)" ]; then echo -e "!!! Detected unstripped out notebooks\n!!!Remember to run nbdev_install_git_hooks"; false; fi
- name: Check if the code is formatted
run: |
black --check .
- name: Check if there is no diff library/notebooks
run: |
echo "Building the library and formatting with black"
nbdev_build_lib
black .
if [ -n "$(git status -uno -s)" ]; then echo -e "!!! Detected difference between the notebooks and the library"; false; fi
- name: Run tests
run: |
pytest
# Unfortunately running MineRL doesn't work yet so we can't test notebooks.
# nbdev_test_nbs