|
| 1 | +# Copyright (C) 2025 Chris Caron <[email protected]> |
| 2 | +# All rights reserved. |
| 3 | +# |
| 4 | +# This code is licensed under the MIT License. |
| 5 | +# |
| 6 | +# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | +# of this software and associated documentation files(the "Software"), to deal |
| 8 | +# in the Software without restriction, including without limitation the rights |
| 9 | +# to use, copy, modify, merge, publish, distribute, sublicense, and / or sell |
| 10 | +# copies of the Software, and to permit persons to whom the Software is |
| 11 | +# furnished to do so, subject to the following conditions : |
| 12 | +# |
| 13 | +# The above copyright notice and this permission notice shall be included in |
| 14 | +# all copies or substantial portions of the Software. |
| 15 | +# |
| 16 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE |
| 19 | +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 22 | +# THE SOFTWARE. |
1 | 23 | name: Tests |
2 | 24 |
|
3 | 25 | on: |
4 | | - |
5 | | - # On which repository actions to trigger the build. |
6 | 26 | push: |
7 | 27 | branches: [ master ] |
8 | 28 | pull_request: |
9 | 29 | branches: [ master ] |
10 | | - |
11 | | - # Allow job to be triggered manually. |
12 | 30 | workflow_dispatch: |
13 | 31 |
|
14 | | -# Cancel in-progress jobs when pushing to the same branch. |
15 | | -concurrency: |
16 | | - cancel-in-progress: true |
17 | | - group: ${{ github.workflow }}-${{ github.ref }} |
18 | | - |
19 | 32 | jobs: |
20 | | - |
21 | 33 | tests: |
| 34 | + runs-on: ubuntu-latest |
22 | 35 |
|
23 | | - runs-on: ${{ matrix.os }} |
24 | | - strategy: |
25 | | - |
26 | | - # Run all jobs to completion (false), or cancel |
27 | | - # all jobs once the first one fails (true). |
28 | | - fail-fast: true |
29 | | - |
30 | | - # Define a minimal test matrix, it will be |
31 | | - # expanded using subsequent `include` items. |
32 | | - matrix: |
33 | | - os: ["ubuntu-latest"] |
34 | | - python-version: ["3.12"] |
35 | | - bare: [false] |
36 | | - |
37 | | - defaults: |
38 | | - run: |
39 | | - shell: bash |
40 | | - |
41 | | - env: |
42 | | - OS: ${{ matrix.os }} |
43 | | - PYTHON: ${{ matrix.python-version }} |
44 | | - BARE: ${{ matrix.bare }} |
45 | | - |
46 | | - name: Python ${{ matrix.python-version }} on ${{ matrix.os }} ${{ matrix.bare && '(bare)' || '' }} |
47 | 36 | steps: |
48 | | - |
49 | 37 | - name: Acquire sources |
50 | 38 | uses: actions/checkout@v4 |
51 | 39 |
|
52 | | - - name: Install prerequisites (Linux) |
53 | | - if: runner.os == 'Linux' |
| 40 | + - name: Install prerequisites |
54 | 41 | run: | |
55 | 42 | sudo apt-get update |
56 | 43 |
|
57 | | - - name: Install project dependencies (Baseline) |
| 44 | + - name: Install dependencies |
58 | 45 | run: | |
59 | 46 | pip install -r requirements.txt -r dev-requirements.txt |
60 | 47 |
|
61 | | - # For saving resources, code style checking is |
62 | | - # only invoked within the `bare` environment. |
63 | | - - name: Check code style |
64 | | - if: matrix.bare == true |
| 48 | + - name: Lint with Ruff |
65 | 49 | run: | |
66 | | - flake8 apprise_api --count --show-source --statistics |
| 50 | + ruff check apprise_api |
67 | 51 |
|
68 | | - - name: Run tests |
| 52 | + - name: Run tests with coverage |
69 | 53 | run: | |
70 | 54 | coverage run -m pytest apprise_api |
71 | 55 |
|
|
74 | 58 | coverage xml |
75 | 59 | coverage report |
76 | 60 |
|
77 | | - - name: Upload coverage data |
| 61 | + - name: Upload coverage to Codecov |
78 | 62 | uses: codecov/codecov-action@v5 |
79 | 63 | with: |
80 | 64 | files: ./coverage.xml |
81 | 65 | fail_ci_if_error: false |
82 | 66 | token: ${{ secrets.CODECOV_TOKEN }} |
| 67 | + |
0 commit comments