forked from privacyidea/privacyidea
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (72 loc) · 2.36 KB
/
python.yml
File metadata and controls
79 lines (72 loc) · 2.36 KB
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
# SPDX-FileCopyrightText: (C) 2014 NetKnights GmbH <https://netknights.it>
# SPDX-License-Identifier: CC0-1.0
#
# This workflow will check for changed files, install Python dependencies and
# run tests with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python Tests
on:
# run on each push to every branch of the repository but only on
# pull requests to the 'master' and 'branch-*' branches
push:
paths:
- 'privacyidea/**.py'
- 'tests/**'
- 'pyproject.toml'
- 'requirements.txt'
- 'tools/**'
- '.github/workflows/python.yml'
pull_request:
branches:
- 'master'
- 'branch-*'
paths:
- 'privacyidea/**.py'
- 'tests/**'
- 'pyproject.toml'
- 'requirements.txt'
- 'tools/**'
- '.github/workflows/python.yml'
permissions:
contents: read
jobs:
test:
name: 'Run tests with Python'
permissions:
checks: write # allow the python tests to mark an action run as failed
runs-on: ubuntu-latest
strategy:
# Do not cancel running matrix tests when one test fails
fail-fast: false
matrix:
# Current supported Python versions
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
persist-credentials: false
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: |
requirements.txt
tests/requirements.txt
- name: Install dependencies
run: |
pip install -r tests/requirements.txt
- name: Test with pytest
id: pytest_run
run: |
pip freeze
python -b -m pytest -v --cov=privacyidea --cov-report=xml tests/
env:
# Output DeprecationWarnings only once
PYTHONWARNINGS: "once::DeprecationWarning"
- name: Codecov upload
if: ${{ steps.pytest_run.outcome == 'success' }}
uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
with:
files: ./coverage.xml
token: ${{ secrets.CODECOV_TOKEN }}