-
Notifications
You must be signed in to change notification settings - Fork 13
145 lines (124 loc) · 5.32 KB
/
pytest.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# This workflow will :
# - test the workstation scripts
# - test the createstubs on multiple micropyton linux versions
# - test the minified createstubs on multiple micropyton linux versions
# - upload coverage stats to Codecov
# - push coverage result to Testspace server
# - upload artifacts from the results folder
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: pytest stubber
on:
workflow_dispatch:
pull_request:
branches: [main]
push:
branches: [main, stubber/*, feat/*, fix/*]
paths:
- .github/workflows/pytest.yml
- .github/workflows/codecov.yml
- "src/stubber/**"
- "tests/**"
- "**/pyproject.toml"
- "**/poetry.lock"
env:
JUPYTER_PLATFORM_DIRS: "1"
# fix: DeprecationWarning: Jupyter is migrating its paths to use standard platformdirs
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test_stubber:
name: Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
mpflash-version: ["beta"]
include: # for testing
- os: windows-latest
python-version: "3.11"
- os: ubuntu-latest
python-version: "3.11"
- os: macos-13
python-version: "3.11"
# - os: flyci-macos-large-latest-m2 # fails on pipx
# python-version: "3.11"
# - os: macos-latest-large # Paid
# python-version: "3.11"
# - os: macos-13-xlarge # Paid
# python-version: "3.11"
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
# Number of commits to fetch. 0 indicates all history for all branches and tags.
- uses: testspace-com/setup-testspace@v1
continue-on-error: true
with:
domain: josverl
#----------------------------------------------
# poetry is not in the default image
#----------------------------------------------
- name: Install poetry
run: pipx install poetry==1.3.1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
# cache: "poetry"
#----------------------------------------------
# install project
#----------------------------------------------
- name: Install test dependencies
run: |
poetry install --with test
# use the latest source version of mpflash
- name: update mpflash to beta for testing
if: ${{ matrix.mpflash-version == 'beta' }}
run: |
# use poetry's environmnt
poetry run pip uninstall mpflash -y
poetry run pip install src/mpflash
#----------------------------------------------
# stubber clone
# repos needed for tests
#----------------------------------------------
- name: stubber clone
run: poetry run stubber clone --add-stubs
- name: Test stubber
run: |
poetry run coverage erase
poetry run coverage run -m pytest -m stubber --durations=50
#----------------------------------------------
# upload coverage stats
# .XML to Codecov
#----------------------------------------------
- name: create coverage report
if: always()
continue-on-error: true
run: |
poetry run coverage xml -o results/coverage-stubber-${{ matrix.python-version }}-${{ matrix.os }}.xml
- name: Upload coverage-stubber-*.xml to Codecov
if: always() # ignore errors
continue-on-error: true
uses: codecov/codecov-action@v4
with:
file: results/coverage-stubber-${{ matrix.python-version }}-${{ matrix.os }}.xml
flags: stubber
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
#----------------------------------------------
- name: Push result to Testspace server
if: always() # ignore errors
continue-on-error: true
run: |
testspace [tests/${{ matrix.os }}/Python_${{ matrix.python-version }}]results/*.xml --link codecov
- uses: actions/upload-artifact@v4
if: always() # ignore errors
continue-on-error: true
with:
path: results/
name: results-stubber-${{ matrix.python-version }}-${{ matrix.os }}