-
Notifications
You must be signed in to change notification settings - Fork 110
81 lines (72 loc) · 2.02 KB
/
RunTest.yaml
File metadata and controls
81 lines (72 loc) · 2.02 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
name: Run Linting and Unit Tests
on:
pull_request:
branches:
- master
- dev
push:
branches-ignore:
- master
- dev
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
pip install .[dev]
- name: Lint with Ruff
id: ruff
run: |
pip install ruff
ruff check --output-format=github src/pyvesync
continue-on-error: true
- name: Run pylint
id: pylint
run: |
pip install pylint
pylint src/pyvesync --output-format=text --reports=n
continue-on-error: true
- name: Test with pytest
id: pytest
run: |
pip install pytest
pytest -v
- name: Build docs (mkdocs)
id: docs
if: github.event_name == 'pull_request' && github.base_ref == 'master' && matrix.python-version == '3.12'
run: |
pip install .[docs]
mkdocs build
- name: Fail if any steps failed
run: |
failed=false
if [ "${{ steps.ruff.outcome }}" = "failure" ]; then
echo "::error::Ruff linting failed"
failed=true
fi
if [ "${{ steps.pylint.outcome }}" = "failure" ]; then
echo "::error::Pylint failed"
failed=true
fi
if [ "${{ steps.pytest.outcome }}" = "failure" ]; then
echo "::error::Pytest failed"
failed=true
fi
if [ "$failed" = "true" ]; then
echo "One or more checks failed. See errors above."
exit 1
else
echo "All checks passed."
fi