forked from DataDog/integrations-core
-
Notifications
You must be signed in to change notification settings - Fork 1
82 lines (70 loc) · 2.88 KB
/
Copy pathcache-shared-deps.yml
File metadata and controls
82 lines (70 loc) · 2.88 KB
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
78
79
80
81
82
name: Cache shared Python dependencies
on:
workflow_call:
defaults:
run:
shell: bash
jobs:
cache:
name: Cache Python dependencies for ${{ startsWith(matrix.os, 'windows-') && 'Windows' || startsWith(matrix.os, 'macos-') && 'macOS' || 'Linux' }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-2022]
env:
PYTHON_VERSION: "3.13"
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
id: python
with:
python-version: "${{ env.PYTHON_VERSION }}"
- name: Install uv
uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7.6.0
with:
enable-cache: false
- name: Check cache
uses: actions/cache/restore@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
id: cache
with:
path: |
${{ runner.os == 'Windows' && '~\AppData\Local\uv\cache' || runner.os == 'macOS' && '~/Library/Caches/uv' || '~/.cache/uv' }}
${{ runner.os == 'Windows' && '~\AppData\Local\pip\Cache' || runner.os == 'macOS' && '~/Library/Caches/pip' || '~/.cache/pip' }}
key: >-
${{ format(
'v02-uv-{0}-{1}-{2}-{3}',
env.pythonLocation,
hashFiles('datadog_checks_base/pyproject.toml'),
hashFiles('datadog_checks_dev/pyproject.toml'),
hashFiles('ddev/pyproject.toml')
)}}
lookup-only: true
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |-
uv pip install --system ./ddev ./datadog_checks_dev[cli] ./datadog_checks_base[deps]
- name: Set up Python 2.7
if: steps.cache.outputs.cache-hit != 'true'
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt update
sudo apt install python2 python2-dev
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 1
elif [ "$RUNNER_OS" == "Windows" ]; then
choco install python2
else
echo "$RUNNER_OS not supported"
exit 1
fi
- name: Install dependencies for Python 2.7
if: steps.cache.outputs.cache-hit != 'true'
run: pip install ./datadog_checks_base[deps] ./datadog_checks_dev
- name: Cache dependencies
uses: actions/cache/save@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5.0.3
if: steps.cache.outputs.cache-hit != 'true'
with:
path: |
${{ runner.os == 'Windows' && '~\AppData\Local\uv\cache' || runner.os == 'macOS' && '~/Library/Caches/uv' || '~/.cache/uv' }}
${{ runner.os == 'Windows' && '~\AppData\Local\pip\Cache' || runner.os == 'macOS' && '~/Library/Caches/pip' || '~/.cache/pip' }}
key: ${{ steps.cache.outputs.cache-primary-key }}