|
| 1 | +name: colab |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: # This action will only run if the PR modifies a file in one of these directories |
| 6 | + - 'ml-agents-envs/**' |
| 7 | + - 'gym-unity/**' |
| 8 | + - 'colab/**' |
| 9 | + - '.github/workflows/colab.yml' |
| 10 | + push: |
| 11 | + branches: [main] |
| 12 | + |
| 13 | +jobs: |
| 14 | + colab: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + env: |
| 17 | + COLAB_ALWAYS_INSTALL_XVFB: 1 |
| 18 | + QLEARNING_NUM_TRAINING_STEPS: 5 |
| 19 | + QLEARNING_NUM_NEW_EXP: 64 |
| 20 | + QLEARNING_BUFFER_SIZE: 64 |
| 21 | + strategy: |
| 22 | + matrix: |
| 23 | + notebook_path: [Colab_UnityEnvironment_1_Run.ipynb, Colab_UnityEnvironment_2_Train.ipynb, Colab_UnityEnvironment_3_SideChannel.ipynb] |
| 24 | + steps: |
| 25 | + - uses: actions/checkout@v2 |
| 26 | + - name: Set up Python |
| 27 | + uses: actions/setup-python@v2 |
| 28 | + with: |
| 29 | + python-version: 3.8.x |
| 30 | + - uses: actions/setup-dotnet@v1 |
| 31 | + with: |
| 32 | + dotnet-version: '3.1.x' |
| 33 | + - name: Cache pip |
| 34 | + uses: actions/cache@v2 |
| 35 | + with: |
| 36 | + # This path is specific to Ubuntu |
| 37 | + path: ~/.cache/pip |
| 38 | + # Look to see if there is a cache hit for the corresponding requirements file |
| 39 | + key: ${{ runner.os }}-pip-${{ hashFiles('ml-agents/setup.py', 'ml-agents-envs/setup.py', 'gym-unity/setup.py', 'colab_requirements.txt') }} |
| 40 | + restore-keys: | |
| 41 | + ${{ runner.os }}-pip- |
| 42 | + ${{ runner.os }}- |
| 43 | + - name: Install dependencies |
| 44 | + run: | |
| 45 | + python -m pip install --upgrade pip |
| 46 | + python -m pip install --upgrade setuptools |
| 47 | + # Install the local checkouts of ml-agents. This will prevent the colab notebooks from installing a released version. |
| 48 | + python -m pip install --progress-bar=off -e ./ml-agents-envs |
| 49 | + python -m pip install --progress-bar=off -e ./ml-agents |
| 50 | + python -m pip install --progress-bar=off -r colab_requirements.txt |
| 51 | + - name: Execute notebook |
| 52 | + run: jupyter nbconvert --to notebook --execute --log-level=INFO --ExecutePreprocessor.kernel_name=python3 --output output-${{ matrix.notebook_path }} colab/${{ matrix.notebook_path }} |
| 53 | + - name: Upload colab results |
| 54 | + uses: actions/upload-artifact@v2 |
| 55 | + with: |
| 56 | + name: artifacts |
| 57 | + path: | |
| 58 | + colab/output-${{ matrix.notebook_path }} |
| 59 | + # Use always() to always run this step to publish execution results when there are failures |
| 60 | + if: ${{ always() }} |
0 commit comments