12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- # NOTE: Do not rely on `make` commands here as this action is used across different repos
- # where the Makefile will not be available
- name: 'python setup'
- description: 'Configures python, pip, and configures pip cache dir as output.'
- inputs:
- workdir:
- description: 'Directory where the sentry source is located'
- required: false
- default: '.'
- cache-files-hash:
- description: 'A single hash for a set of files. Used for caching.'
- required: false
- default: ${{ hashFiles('requirements-*.txt') }}
- pip-cache-version:
- description: 'pip cache version in order to bust cache'
- required: false
- python-version:
- description: 'python version to install'
- required: false
- outputs:
- python-version:
- description: 'The version of python we are using'
- value: ${{ steps.python-version.outputs.python-version }}
- pip-cache-dir:
- description: 'Path to pip cache'
- value: ${{ steps.pip-info.outputs.pip-cache-dir }}
- pip-version:
- description: 'Pip version'
- value: ${{ steps.pip-info.outputs.pip-version }}
- runs:
- using: 'composite'
- steps:
- - name: Set python version output
- id: python-version
- shell: bash
- run: |
- if [ "${{ inputs.python-version }}" == "" ]; then
- echo "::set-output name=python-version::$(cat .python-version)"
- else
- echo "::set-output name=python-version::${{ inputs.python-version }}"
- fi
- - name: Setup default environment variables
- shell: bash
- run: |
- echo "PIP_DISABLE_PIP_VERSION_CHECK=on" >> $GITHUB_ENV
- - uses: actions/setup-python@v2
- env:
- PIP_DISABLE_PIP_VERSION_CHECK: on
- with:
- python-version: ${{ steps.python-version.outputs.python-version }}
- - name: Get pip cache dir & version
- id: pip-info
- shell: bash
- env:
- WORKDIR: ${{ inputs.workdir }}
- # pip versions before 20.1 do not have `pip cache`, `make upgrade-pip` ensures that version as a minimum
- run: |
- source "$WORKDIR/scripts/lib.sh" && upgrade-pip
- echo "::set-output name=pip-cache-dir::$(pip cache dir)"
- echo "::set-output name=pip-version::$(pip -V | awk -F ' ' '{print $2}')"
- - name: pip cache
- uses: actions/cache@v3
- with:
- path: ${{ steps.pip-info.outputs.pip-cache-dir }}
- key: |
- ${{ runner.os }}-py${{ steps.python-version.outputs.python-version }}-pip${{ steps.pip-info.outputs.pip-version }}-${{ inputs.pip-cache-version }}-${{ inputs.cache-files-hash }}
|