-
-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (64 loc) · 1.69 KB
/
test.yaml
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
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"
integration:
required: false
type: boolean
default: false
env:
APP_SECRET_KEY: "ThisIsABadSecret"
SECRET_KEY: "ThisIsABadSecret"
jobs:
test:
runs-on: ${{ inputs.os }}
timeout-minutes: ${{ inputs.integrations && 15 || 30 }}
defaults:
run:
shell: bash
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up python ${{ inputs.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
allow-prereleases: true
- uses: pdm-project/setup-pdm@v4
name: Setup PDM
with:
python-version: 3.12
allow-python-prereleases: true
cache: true
- name: Install dependencies
run: pdm install -G dev
- name: Set pythonpath
run: echo "PYTHONPATH=$PWD" >> $GITHUB_ENV
- name: Test
if: ${{ !inputs.coverage }}
run: |
source $VENV
pytest
- name: Test with coverage
if: inputs.coverage
run: pdm run pytest tests --cov=app --cov-report=xml
- uses: actions/upload-artifact@v3
if: inputs.coverage
with:
name: coverage-xml
path: coverage.xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}