forked from getsentry/sentry
/
action.yml
77 lines (69 loc) · 2.58 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# 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', '!requirements-pre-commit.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::$(SENTRY_NO_VENV_CHECK=1 ./scripts/do.sh get-pyenv-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: Install pip
shell: bash
env:
WORKDIR: ${{ inputs.workdir }}
run: |
source "$WORKDIR/scripts/lib.sh" && upgrade-pip
- name: Get pip cache dir & version
id: pip-info
shell: bash
# pip versions before 20.1 do not have `pip cache`, `make upgrade-pip` ensures that version as a minimum
run: |
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@v2
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 }}