diff --git a/.github/workflows/code_coverage.yml b/.github/workflows/code_coverage.yml index ffe6afb..06fa813 100644 --- a/.github/workflows/code_coverage.yml +++ b/.github/workflows/code_coverage.yml @@ -1,26 +1,39 @@ name: "Code Coverage" -on: [push, pull_request] +on: [ push, pull_request ] jobs: - coverage: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - name: Install dependencies - run: | - pip install -r requirements.txt - - name: Run pytest with coverage - run: | - pytest --cov=./ --cov-report=xml - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v1 - with: - file: ./coverage.xml - flags: unittests - name: codecov-umbrella - fail_ci_if_error: false + build: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [ "3.11.3" ] + steps: + - uses: actions/checkout@v4 + - uses: eifinger/setup-rye@v3 + id: setup-rye + with: + enable-cache: true + cache-prefix: ${{ matrix.python-version }} + - name: Pin python-version ${{ matrix.python-version }} + if: steps.setup-rye.outputs.cache-hit != 'true' + run: rye pin ${{ matrix.python-version }} + - name: Install dependencies + if: steps.setup-rye.outputs.cache-hit != 'true' + run: | + rye sync --no-lock + - name: Cache pre-commit + uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4.0.1 + with: + path: ~/.cache/pre-commit + key: pre-commit-|${{ matrix.python-version }}|${{ hashFiles('.pre-commit-config.yaml') }} + - name: Lint + run: | + rye run pre-commit run --all-files + - name: Test + run: | + rye run pytest --cov=src --cov-report=html + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v1 + with: + file: ./htmlcov/index.html