Skip to content

Bump pytest from 7.4.0 to 7.4.3 #149

Bump pytest from 7.4.0 to 7.4.3

Bump pytest from 7.4.0 to 7.4.3 #149

Workflow file for this run

name: pytest
# Run this job on pushes to `main`, and for pull requests. If you don't specify
# `branches: [main], then this actions runs _twice_ on pull requests, which is
# annoying.
on:
push:
pull_request:
branches: [main]
env:
python-versions: ( "3.8" "3.9" "3.10" "3.11" )
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout repository
uses: actions/checkout@v3.5.3
# If you wanted to use multiple Python versions, you'd have specify a matrix in the job and
# reference the matrixe python version here.
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3.1.4
with:
python-version: ${{ matrix.python-version }}
# Cache the installation of Poetry itself, e.g. the next step. This prevents the workflow
# from installing Poetry every time, which can be slow. Note the use of the Poetry version
# number in the cache key, and the "-0" suffix: this allows you to invalidate the cache
# manually if/when you want to upgrade Poetry, or if something goes wrong. This could be
# mildly cleaner by using an environment variable, but I don't really care.
- name: cache poetry install
uses: actions/cache@v3.3.1
with:
path: ~/.local
key: poetry-1.5.1-0-${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.5.1
virtualenvs-create: true
virtualenvs-in-project: true
- name: cache deps
id: cache-deps
uses: actions/cache@v3.3.1
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }}
- run: poetry install --no-interaction --no-root --with=dev
if: steps.cache-deps.outputs.cache-hit != 'true'
# And finally run tests. I'm using pytest and all my pytest config is in my `pyproject.toml`
# so this line is super-simple. But it could be as complex as you need.
- name: Run tests with coverage
run: poetry run pytest --cov=sqlalchemy_crud --cov-report=xml:coverage.xml --junitxml=test-report.xml ./tests
- name: Upload coverage reports to Codecov
if: always()
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload coverage artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: coverage-${{ matrix.python-version }}
path: coverage.xml
- name: Upload test artifact
if: always()
uses: actions/upload-artifact@v3
with:
name: test-report-${{ matrix.python-version }}
path: test-report.xml
Publish-Test:
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
needs:
- test
if: always()
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]
steps:
- name: Checkout repository
uses: actions/checkout@v3.5.3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3.1.4
with:
python-version: ${{ matrix.python-version }}
- name: Download test artifact
uses: actions/download-artifact@v3
with:
name: test-report-${{ matrix.python-version }}
- name: Publish test artifact
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
test-report.xml
check_name: Unit Tests for python ${{ matrix.python-version }}