-
Notifications
You must be signed in to change notification settings - Fork 3
176 lines (147 loc) · 4.86 KB
/
ci.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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
## -------------------------------------------------------------------------------------------------
## -- Project : MLPro - The integrative middleware framework for standardized machine learning
## -- Workflow: ci.yml
## -------------------------------------------------------------------------------------------------
## -- History :
## -- yyyy-mm-dd Ver. Auth. Description
## -- 2021 1.0.0 MRD Creation
## -- 2024-10-09 1.1.0 DA Updated the version range for Python to 3.10 - 3.12
## -------------------------------------------------------------------------------------------------
name: Unit Tests
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '00 1 * * 1'
workflow_dispatch:
jobs:
deps_gen:
runs-on: ubuntu-latest
outputs:
trigger_build: ${{ steps.trigger_build.outputs.build }}
steps:
- name: Checkout Codes
uses: actions/checkout@v3
with:
token: ${{ secrets.CI_UNIT_TEST }}
ref: ${{ github.head_ref }}
- name: Generate dependecies list
run: |
awk '/^[[]/{f=0} /full/{f=1;next} {sub(/^[ \t]+|[ \t]/, "")} f' setup.cfg | tr -d "<" | tr -d ">" | tr -s "==" "," > doc/rtd/content/01_welcome/sub/deps.txt
- name: Commit files
id: auto-commit-action
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Dependencies Generation
branch: ${{ github.head_ref }}
commit_user_name: MLPro Administration
commit_user_email: mlpro@listen.fh-swf.de
- name: "Run if changes not detected"
if: steps.auto-commit-action.outputs.changes_detected == 'false'
id: trigger_build
run: echo "build=true" >> $GITHUB_OUTPUT
ubuntu_test:
runs-on: ubuntu-latest
needs: deps_gen
if: needs.deps_gen.outputs.trigger_build == 'true'
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
steps:
- name: Checkout Codes
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install pip --upgrade
pip install flake8 pytest
pip install -r requirements.txt
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
make pytest
doc_test:
runs-on: ubuntu-latest
needs: deps_gen
if: needs.deps_gen.outputs.trigger_build == 'true'
strategy:
matrix:
python-version: ['3.12']
steps:
- name: Checkout Codes
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install flake8 pytest
pip install -r requirements.txt
pip install sphinx
pip install sphinx-rtd-theme
pip install sphinx-copybutton
pip install sphinx_multitoc_numbering
- name: Build the Documentation
run: |
make docu
windows_test:
runs-on: windows-latest
needs: deps_gen
if: needs.deps_gen.outputs.trigger_build == 'true'
strategy:
matrix:
python-version: ['3.12']
steps:
- name: Checkout Codes
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install flake8 pytest
pip install -r requirements.txt
- name: Test with pytest
run: |
make pytest
macos_test:
runs-on: macos-latest
needs: deps_gen
if: needs.deps_gen.outputs.trigger_build == 'true'
strategy:
matrix:
python-version: ['3.12']
steps:
- name: Checkout Codes
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install flake8 pytest
pip install -r requirements.txt
- name: Test with pytest
run: |
make pytest