diff --git a/.github/actions/install-meltingpot/action.yml b/.github/actions/install-meltingpot/action.yml index e94b605b..d1f78f70 100644 --- a/.github/actions/install-meltingpot/action.yml +++ b/.github/actions/install-meltingpot/action.yml @@ -10,13 +10,60 @@ inputs: runs: using: composite steps: + - name: Get current runner + id: os-info + shell: bash + run: | + if [ "${RUNNER_OS}" = 'macOS' ]; then + echo "name=macOS" >> $GITHUB_OUTPUT + echo "version=$(sw_vers -productVersion)" >> $GITHUB_OUTPUT + elif [ "${RUNNER_OS}" = 'Linux' ]; then + echo "name=$(lsb_release -i -s)" >> $GITHUB_OUTPUT + echo "version=$(lsb_release -r -s)" >> $GITHUB_OUTPUT + else + exit 1 + fi + - name: Set up Python ${{ inputs.python-version }} uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 with: python-version: ${{ inputs.python-version }} + cache: 'pip' + cache-dependency-path: setup.py + + - name: Restore cached installation + id: restore + uses: actions/cache/restore@v3 + with: + path: | + meltingpot/assets + venv + key: install-meltingpot-${{ steps.os-info.outputs.name }}-${{ steps.os-info.outputs.version }}-py${{ inputs.python-version}}-${{ hashFiles('setup.py') }} + restore-keys: | + install-meltingpot-${{ steps.os-info.outputs.name }}-${{ steps.os-info.outputs.version }}-py${{ inputs.python-version }}- - name: Install Python dependencies + if: steps.restore.outputs.cache-hit != 'true' shell: bash run: | pip install --upgrade pip + pip install virtualenv + virtualenv venv + source venv/bin/activate pip install --editable .[dev] + + - name: Save assets + if: steps.restore.outputs.cache-hit != 'true' + uses: actions/cache/save@v3 + with: + path: | + meltingpot/assets + venv + key: ${{ steps.restore.outputs.cache-primary-key }} + + - name: Activate virtual environment + shell: bash + run: | + source venv/bin/activate + pip list + echo "PATH=${PATH}" >> $GITHUB_ENV diff --git a/setup.py b/setup.py index a0fb4cde..d4bf84ca 100644 --- a/setup.py +++ b/setup.py @@ -104,31 +104,30 @@ def build_assets(self): }, python_requires='>=3.10', install_requires=[ - 'absl-py', - 'chex<0.1.81', # Incompatible with tensorflow 2.13 (due to numpy req). - 'dm-env', - 'dmlab2d', - 'dm-tree', - 'immutabledict', - 'ml-collections', - 'networkx', - 'numpy', - 'opencv-python', - 'pandas', - 'pygame', - 'reactivex', - 'tensorflow', + 'absl-py==1.4.0', + 'chex==0.1.7', + 'dm-env==1.6', + 'dm-tree==0.1.8', + 'dmlab2d==1.0.0', + 'immutabledict==2.0.0', + 'ml-collections==0.1.1', + 'networkx==3.1', + 'numpy==1.26.0', + 'opencv-python==4.8.0.74', + 'pandas==1.3.5', + 'pygame==2.5.0', + 'reactivex==4.0.4', + 'tensorflow==2.13.0', ], extras_require={ # Used in development. 'dev': [ - 'build', - 'isort', - 'pipreqs', - 'pyink', - 'pylint', - 'pytest-xdist', - 'pytype', + 'isort==5.12.0', + 'pipreqs==0.4.13', + 'pyink==23.5.0', + 'pylint==2.17.5', + 'pytest-xdist==3.3.1', + 'pytype==2023.7.21', ], }, )