File: tests.yaml

package info (click to toggle)
python-energyzero 5.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,052 kB
  • sloc: python: 1,903; makefile: 3
file content (84 lines) | stat: -rw-r--r-- 2,760 bytes parent folder | download
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
---
name: Testing

# yamllint disable-line rule:truthy
on:
  push:
  pull_request:
  workflow_dispatch:

env:
  DEFAULT_PYTHON: "3.12"

permissions:
  contents: read

jobs:
  pytest:
    name: Python ${{ matrix.python }}
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python: ["3.12", "3.13", "3.14"]
    steps:
      - name: โคต๏ธ Check out code from GitHub
        uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
        with:
          persist-credentials: false
      - name: ๐Ÿ— Set up Poetry
        run: pipx install poetry
      - name: ๐Ÿ— Set up Python ${{ matrix.python }}
        id: python
        uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
        with:
          python-version: ${{ matrix.python }}
          cache: "poetry"
      - name: ๐Ÿ— Install workflow dependencies
        run: |
          poetry config virtualenvs.create true
          poetry config virtualenvs.in-project true
      - name: ๐Ÿ— Install dependencies
        run: poetry install --no-interaction
      - name: ๐Ÿš€ Run pytest
        run: poetry run pytest -v --cov src tests
      - name: โฌ†๏ธ Upload coverage artifact
        uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
        with:
          name: coverage-${{ matrix.python }}
          include-hidden-files: true
          path: .coverage

  coverage:
    needs: pytest
    runs-on: ubuntu-latest
    steps:
      - name: โคต๏ธ Check out code from GitHub
        uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
        with:
          fetch-depth: 0
          persist-credentials: false
      - name: โฌ‡๏ธ Download coverage data
        uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
      - name: ๐Ÿ— Set up Poetry
        run: pipx install poetry
      - name: ๐Ÿ— Set up Python ${{ env.DEFAULT_PYTHON }}
        id: python
        uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
        with:
          python-version: ${{ env.DEFAULT_PYTHON }}
          cache: 'poetry'
      - name: ๐Ÿ— Install workflow dependencies
        run: |
          poetry config virtualenvs.create true
          poetry config virtualenvs.in-project true
      - name: ๐Ÿ— Install dependencies
        run: poetry install --no-interaction
      - name: ๐Ÿš€ Process coverage results
        run: |
          poetry run coverage combine coverage*/.coverage*
          poetry run coverage xml -i
      - name: ๐Ÿš€ Upload coverage report
        uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          fail_ci_if_error: true