From add47bf93c200051e588d813053aa471343ff031 Mon Sep 17 00:00:00 2001 From: John Agapiou Date: Fri, 28 Jul 2023 22:52:42 +0000 Subject: [PATCH] use venv --- .github/actions/install-meltingpot/action.yml | 52 +++++++++++++------ 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/.github/actions/install-meltingpot/action.yml b/.github/actions/install-meltingpot/action.yml index fa5375bd..d1f78f70 100644 --- a/.github/actions/install-meltingpot/action.yml +++ b/.github/actions/install-meltingpot/action.yml @@ -10,38 +10,60 @@ inputs: runs: using: composite steps: - # - name: Get current runner - # id: get-runner - # shell: bash - # run: | - # echo "runner=$(uname -s)-$(uname -r)" >> $GITHUB_OUTPUT + - 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: 'pip' cache-dependency-path: setup.py - - name: Restore assets - id: assets-restore + - name: Restore cached installation + id: restore uses: actions/cache/restore@v3 with: - path: assets - key: assets-${{ hashFiles('setup.py') }} + 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: | - assets- + 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 cache list pip install --upgrade pip + pip install virtualenv + virtualenv venv + source venv/bin/activate pip install --editable .[dev] - name: Save assets - if: steps.assets-restore.outputs.cache-hit != 'true' + if: steps.restore.outputs.cache-hit != 'true' uses: actions/cache/save@v3 with: - path: assets - key: ${{ steps.assets-restore.outputs.cache-primary-key }} + 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