forked from litestar-org/litestar
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (59 loc) · 1.64 KB
/
Copy pathtest.yml
File metadata and controls
69 lines (59 loc) · 1.64 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
name: Test
on:
workflow_call:
inputs:
python-version:
required: true
type: string
coverage:
required: false
type: boolean
default: false
os:
required: false
type: string
default: "ubuntu-latest"
timeout:
required: false
type: number
default: 10
jobs:
test:
runs-on: ${{ inputs.os }}
timeout-minutes: ${{ inputs.timeout }}
defaults:
run:
shell: bash
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up python ${{ inputs.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}
- uses: pdm-project/setup-pdm@v3
name: Set up PDM
with:
python-version: ${{ inputs.python-version }}
allow-python-prereleases: false
cache: true
cache-dependency-path: |
./pdm.lock
- name: Install dependencies
run: pdm install -G:all
- name: Set PYTHONPATH
run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV
- name: Test
if: ${{ !inputs.coverage }}
run: pdm run pytest docs/examples tests -n auto
- name: Test with coverage
if: inputs.coverage
run: pdm run pytest docs/examples tests --cov -n auto
- name: Rename coverage file
if: inputs.coverage
run: mv .coverage .coverage.${{ inputs.python-version }}
- uses: actions/upload-artifact@v3
if: inputs.coverage
with:
name: coverage-data
path: .coverage.${{ inputs.python-version }}