-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
141 lines (128 loc) · 3.91 KB
/
Copy pathtests.yml
File metadata and controls
141 lines (128 loc) · 3.91 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
name: Tests
on:
push:
branches:
- main
- dev
paths-ignore:
- '*.md'
- '**/*.md'
- 'docs/**'
- 'images/**'
- '.github/**'
- 'agent-skill/**'
- '*.yml'
- '*.yaml'
- 'ruff.toml'
pull_request:
branches:
- main
- dev
paths-ignore:
- '*.md'
- '**/*.md'
- 'docs/**'
- 'images/**'
- '.github/**'
- 'agent-skill/**'
- '*.yml'
- '*.yaml'
- 'ruff.toml'
concurrency:
group: ${{github.workflow}}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
timeout-minutes: 60
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- python-version: "3.10"
os: macos-latest
env:
TOXENV: py310
- python-version: "3.11"
os: macos-latest
env:
TOXENV: py311
- python-version: "3.12"
os: macos-latest
env:
TOXENV: py312
- python-version: "3.13"
os: macos-latest
env:
TOXENV: py313
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
pyproject.toml
tox.ini
- name: Install all browsers dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install playwright==1.62.0 patchright==1.62.1
- name: Get Playwright version
id: playwright-version
run: |
PLAYWRIGHT_VERSION=$(python3 -c "import importlib.metadata; print(importlib.metadata.version('playwright'))")
echo "version=$PLAYWRIGHT_VERSION" >> $GITHUB_OUTPUT
echo "Playwright version: $PLAYWRIGHT_VERSION"
- name: Retrieve Playwright browsers from cache if any
id: playwright-cache
uses: actions/cache/restore@v5
with:
path: |
~/.cache/ms-playwright
~/Library/Caches/ms-playwright
~/.ms-playwright
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}-v1
restore-keys: |
${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}-
${{ runner.os }}-playwright-
- name: Install Playwright browsers
run: |
echo "Cache hit: ${{ steps.playwright-cache.outputs.cache-hit }}"
if [ "${{ steps.playwright-cache.outputs.cache-hit }}" != "true" ]; then
python3 -m playwright install chromium
else
echo "Skipping install - using cached Playwright browsers"
fi
python3 -m playwright install-deps chromium
- name: Retrieve tox environments from cache if any
id: tox-cache
uses: actions/cache/restore@v5
with:
path: .tox
# Include python version and os in the cache key
key: tox-v1-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('pyproject.toml', 'tox.ini') }}
restore-keys: |
tox-v1-${{ runner.os }}-py${{ matrix.python-version }}-
tox-v1-${{ runner.os }}-
- name: Install tox
run: pip install -U tox
- name: Run tests
env: ${{ matrix.env }}
run: tox
- name: Save Playwright browsers to cache
if: github.ref == 'refs/heads/main' && steps.playwright-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v5
with:
path: |
~/.cache/ms-playwright
~/Library/Caches/ms-playwright
~/.ms-playwright
key: ${{ steps.playwright-cache.outputs.cache-primary-key }}
- name: Save tox environments to cache
if: github.ref == 'refs/heads/main' && steps.tox-cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v5
with:
path: .tox
key: ${{ steps.tox-cache.outputs.cache-primary-key }}