Debian Codegraph @

.github/workflows/RunTest.yaml

raw symbols SCIP
1 name: Run Linting and Unit Tests
2
3 on:
4 pull_request:
5 branches:
6 - master
7 - dev
8 push:
9 branches-ignore:
10 - master
11 - dev
12 workflow_dispatch:
13
14
15 jobs:
16 build:
17 runs-on: ubuntu-latest
18 strategy:
19 matrix:
20 python-version: ["3.11", "3.12", "3.13"]
21
22 steps:
23 - uses: actions/checkout@v6
24 - name: Set up Python ${{ matrix.python-version }}
25 uses: actions/setup-python@v6
26 with:
27 python-version: ${{ matrix.python-version }}
28 - name: Install dependencies
29 run: |
30 python -m pip install --upgrade pip
31 pip install .
32 pip install .[dev]
33 - name: Lint with Ruff
34 id: ruff
35 run: |
36 pip install ruff
37 ruff check --output-format=github src/pyvesync
38 continue-on-error: true
39 - name: Run pylint
40 id: pylint
41 run: |
42 pip install pylint
43 pylint src/pyvesync --output-format=text --reports=n
44 continue-on-error: true
45 - name: Test with pytest
46 id: pytest
47 run: |
48 pip install pytest
49 pytest -v
50 - name: Build docs (mkdocs)
51 id: docs
52 if: github.event_name == 'pull_request' && github.base_ref == 'master' && matrix.python-version == '3.12'
53 run: |
54 pip install .[docs]
55 mkdocs build
56
57 - name: Fail if any steps failed
58 run: |
59 failed=false
60
61 if [ "${{ steps.ruff.outcome }}" = "failure" ]; then
62 echo "::error::Ruff linting failed"
63 failed=true
64 fi
65
66 if [ "${{ steps.pylint.outcome }}" = "failure" ]; then
67 echo "::error::Pylint failed"
68 failed=true
69 fi
70
71 if [ "${{ steps.pytest.outcome }}" = "failure" ]; then
72 echo "::error::Pytest failed"
73 failed=true
74 fi
75
76 if [ "$failed" = "true" ]; then
77 echo "One or more checks failed. See errors above."
78 exit 1
79 else
80 echo "All checks passed."
81 fi