-
Notifications
You must be signed in to change notification settings - Fork 3
95 lines (80 loc) · 2.85 KB
/
unit-test-windows.yml
File metadata and controls
95 lines (80 loc) · 2.85 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
name: Unit Tests on Windows
on:
pull_request:
branches:
- main
- "[0-9]+\\.[0-9]+\\.[0-9]+"
jobs:
test:
runs-on: windows-latest
strategy:
matrix:
python-version: ["3.11"]
steps:
- name: 📥 Checkout code
uses: actions/checkout@v4
- name: 🐍 Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: 📦 Install Poetry
run: |
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python -
- name: 📦 Add Poetry to PATH
run: |
echo "$env:APPDATA\Python\Scripts" | Out-File -Append -Encoding ascii $env:GITHUB_PATH
echo "Poetry PATH set to $env:APPDATA\Python\Scripts"
- name: ✅ Check Poetry version
run: poetry --version
- name: 📦 Cache Poetry virtualenv
uses: actions/cache@v4
with:
path: ~\AppData\Local\pypoetry\Cache
key: ${{ runner.os }}-poetry-${{ matrix.python-version }}-${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ runner.os }}-poetry-${{ matrix.python-version }}-
- name: 📦 Install dependencies with Poetry
run: poetry install --with dev
- name: 🔍 Lint with ruff
run: poetry run ruff check .
- name: 🧪 Run tests with coverage
run: |
$BRANCH = git rev-parse --abbrev-ref HEAD
$COMMIT = git rev-parse HEAD
poetry run pytest `
--cov=pytest_html_plus `
--cov-fail-under=39 `
--cov-report=term `
--reruns 1 `
--ignore=tests/browser `
--plus-profile=ci `
--git-branch "$BRANCH" `
--git-commit "$COMMIT" `
tests/
- name: 🧪 Run tests with warnings enabled
run: |
$BRANCH = git rev-parse --abbrev-ref HEAD
$COMMIT = git rev-parse HEAD
$env:PYTHONWARNINGS = "error"
poetry run pytest `
--cov=pytest_html_plus `
--cov-fail-under=39 `
--cov-report=term `
--reruns 1 `
--ignore=tests/browser `
--plus-profile=ci-warnings `
--git-branch "$BRANCH" `
--git-commit "$COMMIT" `
tests/
- name: 📤 Upload HTML Report
if: always()
uses: actions/upload-artifact@v4
with:
name: report-windows-${{ github.job }}-${{ github.run_number }}-${{ matrix.python-version }}
path: report_output/
- name: 📤 Upload HTML Warnings Report
if: always()
uses: actions/upload-artifact@v4
with:
name: report-warnings-windows-${{ github.job }}-${{ github.run_number }}-${{ matrix.python-version }}
path: report_output_warnings/