Skip to content

Commit

Permalink
updates gh-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
KPrasch committed Feb 7, 2024
1 parent 1e63931 commit 677c908
Showing 1 changed file with 52 additions and 21 deletions.
73 changes: 52 additions & 21 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,62 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Tests
name: '🔎 Python Tests'

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
branches:
- main

permissions:
contents: read
concurrency:
group: ci-tests-${{ github.ref }}-pytest
cancel-in-progress: true

jobs:
build:
python-tests:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.8", "3.12" ]

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[test]
- name: Test with pytest
run: pytest
- name: Checkout repo
uses: actions/checkout@v4


- id: setup_python
name: Set up Python ${{ matrix.python-version }} Environment
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- id: python_cache
name: Retrieve Cached Python Dependencies
uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
key: ${{ runner.os }}-pip-${{ steps.setup_python.outputs.python-version }}-${{ hashFiles('pyproject.toml') }}

- name: Upgrade pip
if: steps.python_cache.outputs.cache-hit != 'true'
run: python -m pip install --upgrade pip

- name: Install Dependencies
run: pip install .[test]

- name: Tests (Coverage)
if: matrix.python-version == '3.12'
run: |
coverage run --data-file=data -m pytest tests
coverage xml -i --data-file=data -o coverage.xml
- name: Tests
if: matrix.python-version != '3.12'
run: pytest tests

- name: Upload to Codecov
if: matrix.python-version == '3.12'
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
fail_ci_if_error: false
verbose: true

0 comments on commit 677c908

Please sign in to comment.