您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
67 行
2.5 KiB
67 行
2.5 KiB
name: pytest
|
|
|
|
on:
|
|
pull_request:
|
|
paths: # This action will only run if the PR modifies a file in one of these directories
|
|
- 'ml-agents/**'
|
|
- 'ml-agents-envs/**'
|
|
- 'gym-unity/**'
|
|
- 'test_constraints*.txt'
|
|
- 'test_requirements.txt'
|
|
- '.github/workflows/pytest.yml'
|
|
push:
|
|
branches: [master]
|
|
|
|
jobs:
|
|
pytest:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
matrix:
|
|
python-version: [3.6.x, 3.7.x, 3.8.x]
|
|
include:
|
|
- python-version: 3.6.x
|
|
- python-version: 3.7.x
|
|
- python-version: 3.8.x
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Cache pip
|
|
uses: actions/cache@v2
|
|
with:
|
|
# This path is specific to Ubuntu
|
|
path: ~/.cache/pip
|
|
# Look to see if there is a cache hit for the corresponding requirements file
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('ml-agents/setup.py', 'ml-agents-envs/setup.py', 'gym-unity/setup.py', 'test_requirements.txt') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pip-
|
|
${{ runner.os }}-
|
|
- name: Display Python version
|
|
run: python -c "import sys; print(sys.version)"
|
|
- name: Install dependencies
|
|
run: |
|
|
# pin pip to workaround https://github.com/pypa/pip/issues/9180
|
|
python -m pip install pip==20.2
|
|
python -m pip install --upgrade setuptools
|
|
python -m pip install --progress-bar=off -e ./ml-agents-envs
|
|
python -m pip install --progress-bar=off -e ./ml-agents
|
|
python -m pip install --progress-bar=off -r test_requirements.txt
|
|
python -m pip install --progress-bar=off -e ./gym-unity
|
|
- name: Save python dependencies
|
|
run: |
|
|
pip freeze > pip_versions-${{ matrix.python-version }}.txt
|
|
cat pip_versions-${{ matrix.python-version }}.txt
|
|
- name: Run pytest
|
|
run: pytest --cov=ml-agents --cov=ml-agents-envs --cov=gym-unity --cov-report html --junitxml=junit/test-results-${{ matrix.python-version }}.xml -p no:warnings
|
|
- name: Upload pytest test results
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: artifacts-${{ matrix.python-version }}
|
|
path: |
|
|
htmlcov
|
|
pip_versions-${{ matrix.python-version }}.txt
|
|
junit/test-results-${{ matrix.python-version }}.xml
|
|
# Use always() to always run this step to publish test results when there are test failures
|
|
if: ${{ always() }}
|