-
Notifications
You must be signed in to change notification settings - Fork 25
72 lines (62 loc) · 2.08 KB
/
_test.yml
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
on:
workflow_call:
inputs:
python-version:
type: string
description: The version of python to install
required: true
event-model-version:
type: string
description: The version of event-model to install
required: false
runs-on:
type: string
description: The runner to run this job on
required: true
secrets:
CODECOV_TOKEN:
required: true
env:
# https://github.com/pytest-dev/pytest/issues/2042
PY_IGNORE_IMPORTMISMATCH: "1"
jobs:
run:
runs-on: ${{ inputs.runs-on }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Need this to get version number from last tag
fetch-depth: 0
- if: inputs.python-version == 'dev'
name: Install dev versions of python packages
uses: ./.github/actions/install_requirements
- if: inputs.python-version == 'dev'
name: Write the requirements as an artifact
run: pip freeze --exclude-editable > /tmp/dev-requirements.txt
- if: inputs.python-version == 'dev'
name: Upload dev-requirements.txt
uses: actions/upload-artifact@v4
with:
name: dev-requirements
path: /tmp/dev-requirements.txt
- if: inputs.python-version != 'dev'
name: Install latest versions of python packages
uses: ./.github/actions/install_requirements
with:
python-version: ${{ inputs.python-version }}
pip-install: ".[dev]"
- name: Install specific version of event-model.
run: pip install "event-model==${{ inputs.event-model-version }}"
# By default, leave whatever was installed by pyproject.toml
# (likely latest version).
if inputs.event-model-version != ''
- name: Run tests
run: tox -e tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
name: ${{ inputs.python-version }}/${{ inputs.runs-on }}
files: cov.xml
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}