-
Notifications
You must be signed in to change notification settings - Fork 4
144 lines (131 loc) · 3.9 KB
/
Copy pathpytest.yml
File metadata and controls
144 lines (131 loc) · 3.9 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
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
name: Pytest and coverage
on:
push:
env:
TEST_DATA_REF: https://github.com/valentinaschueller/ece-4-monitoring-test-data/archive/refs/heads/main.zip
TEST_DATA_DOWNLOAD: test-data
jobs:
lint:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
-
name: Install flake8
run: |
python -m pip install flake8
-
name: Lint with flake8
run: |
# Syntax errors or undefined names
flake8 --count --select=E9,F63,F7,F82 --show-source --statistics monitoring/
flake8 --count --select=E9,F63,F7,F82 --show-source --statistics helpers/
flake8 --count --select=E9,F63,F7,F82 --show-source --statistics tests/
# All other stuff
flake8 --exit-zero --count --statistics --exclude=__init__.py --max-line-length=88 monitoring/
flake8 --exit-zero --count --statistics --exclude=__init__.py --max-line-length=88 helpers/
flake8 --exit-zero --count --statistics --exclude=__init__.py --max-line-length=88 tests/
pytest:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
strategy:
matrix:
python-version: [ "3.11", "3.12", "3.13" ]
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{matrix.python-version}}
-
name: Install miniconda
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: latest
environment-file: conda_environment.yml
python-version: ${{matrix.python-version}}
-
name: Install pytest
run: |
python -m pip install pytest
-
name: Install se-t-ece from source
run: |
python -m pip install .
-
name: Print environment info
run: |
conda info
conda list
-
name: Download test data
run: |
mkdir ${TEST_DATA_DOWNLOAD};
wget -O ${TEST_DATA_DOWNLOAD}/test-data.zip ${TEST_DATA_REF};
unzip -q ${TEST_DATA_DOWNLOAD}/test-data.zip -d ${TEST_DATA_DOWNLOAD};
mv ${TEST_DATA_DOWNLOAD}/ece-4-monitoring-test-data-main/ tests/testdata;
-
name: Run pytest
run: |
pytest
coverage:
needs: pytest
runs-on: ubuntu-latest
defaults:
run:
shell: bash -el {0}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
-
name: Install miniconda
uses: conda-incubator/setup-miniconda@v3
with:
miniconda-version: latest
environment-file: conda_environment.yml
python-version: "3.12"
-
name: Install se-t-ece from source
run: |
python -m pip install .
-
name: Install pytest, coverage, coveralls
run: |
python -m pip install pytest
python -m pip install coverage
python -m pip install coveralls
-
name: Download test data
run: |
mkdir ${TEST_DATA_DOWNLOAD};
wget -O ${TEST_DATA_DOWNLOAD}/test-data.zip ${TEST_DATA_REF};
unzip -q ${TEST_DATA_DOWNLOAD}/test-data.zip -d ${TEST_DATA_DOWNLOAD};
mv ${TEST_DATA_DOWNLOAD}/ece-4-monitoring-test-data-main/ tests/testdata;
-
name: Run pytest+coverage
run: |
coverage run -m pytest
coverage lcov
-
name: Publish on coveralls.io
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage.lcov