-
Notifications
You must be signed in to change notification settings - Fork 54
70 lines (58 loc) · 1.81 KB
/
test.yml
File metadata and controls
70 lines (58 loc) · 1.81 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
name: CI
on:
push:
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
tests:
name: "Python ${{ matrix.python-version }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
steps:
- uses: "actions/checkout@v4"
with:
fetch-depth: 0 # IMPORTANT: get full history so comparisons work
submodules: false
- uses: "actions/setup-python@v5"
with:
python-version: "${{ matrix.python-version }}"
cache: pip
- name: "Install dependencies"
run: |
set -xe
python -VV
python -m site
python -m pip install --upgrade pip setuptools wheel
pip install --upgrade -r requirements.txt
pip install --upgrade -r test_requirements.txt
# Force branch + html+xml reports even if pytest.ini doesn't set them
- name: Run unit tests (with coverage)
env:
PYTEST_ADDOPTS: "--cov=pypowerwall --cov-branch --cov-report=xml --cov-report=html"
run: pytest
- name: "Run test.py on ${{ matrix.python-version }}"
run: "python test.py"
# Upload both XML (for services/badges) and HTML (for browsing)
- name: Upload coverage artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.python-version }}
path: |
coverage.xml
htmlcov/**
- name: Upload to Codecov
if: always()
uses: codecov/codecov-action@v4
with:
files: coverage.xml
flags: py${{ matrix.python-version }}
token: ${{ secrets.CODECOV_TOKEN }}