|
1 | 1 | name: "Code Coverage"
|
2 | 2 |
|
3 |
| -on: [push, pull_request] |
| 3 | +on: [ push, pull_request ] |
4 | 4 |
|
5 | 5 | jobs:
|
6 |
| - coverage: |
7 |
| - runs-on: ubuntu-latest |
8 |
| - steps: |
9 |
| - - uses: actions/checkout@v4 |
10 |
| - - name: Set up Python |
11 |
| - uses: actions/setup-python@v5 |
12 |
| - with: |
13 |
| - python-version: '3.11' |
14 |
| - - name: Install dependencies |
15 |
| - run: | |
16 |
| - pip install -r requirements.txt |
17 |
| - - name: Run pytest with coverage |
18 |
| - run: | |
19 |
| - pytest --cov=./ --cov-report=xml |
20 |
| - - name: Upload coverage to Codecov |
21 |
| - uses: codecov/codecov-action@v1 |
22 |
| - with: |
23 |
| - file: ./coverage.xml |
24 |
| - flags: unittests |
25 |
| - name: codecov-umbrella |
26 |
| - fail_ci_if_error: false |
| 6 | + build: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + strategy: |
| 9 | + matrix: |
| 10 | + python-version: [ "3.11.3" ] |
| 11 | + steps: |
| 12 | + - uses: actions/checkout@v4 |
| 13 | + - uses: eifinger/setup-rye@v3 |
| 14 | + id: setup-rye |
| 15 | + with: |
| 16 | + enable-cache: true |
| 17 | + cache-prefix: ${{ matrix.python-version }} |
| 18 | + - name: Pin python-version ${{ matrix.python-version }} |
| 19 | + if: steps.setup-rye.outputs.cache-hit != 'true' |
| 20 | + run: rye pin ${{ matrix.python-version }} |
| 21 | + - name: Install dependencies |
| 22 | + if: steps.setup-rye.outputs.cache-hit != 'true' |
| 23 | + run: | |
| 24 | + rye sync --no-lock |
| 25 | + - name: Cache pre-commit |
| 26 | + uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1 |
| 27 | + with: |
| 28 | + path: ~/.cache/pre-commit |
| 29 | + key: pre-commit-|${{ matrix.python-version }}|${{ hashFiles('.pre-commit-config.yaml') }} |
| 30 | + - name: Lint |
| 31 | + run: | |
| 32 | + rye run pre-commit run --all-files |
| 33 | + - name: Test |
| 34 | + run: | |
| 35 | + rye run pytest --cov=src --cov-report=html |
| 36 | + - name: Upload coverage to Codecov |
| 37 | + uses: codecov/codecov-action@v1 |
| 38 | + with: |
| 39 | + file: ./htmlcov/index.html |
0 commit comments