1
+ name : Lint, Test & Build
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - ' *'
7
+
8
+ jobs :
9
+ lint :
10
+ name : Lint
11
+ timeout-minutes : 20
12
+ strategy :
13
+ fail-fast : false
14
+ matrix :
15
+ os : [ ubuntu-latest ]
16
+ python-version : [ '3.10' ]
17
+ runs-on : ${{ matrix.os }}
18
+ steps :
19
+ - name : Checkout Repository
20
+ uses : actions/checkout@v4
21
+
22
+ - name : Set up Python
23
+ uses : actions/setup-python@v5
24
+ with :
25
+ python-version : ${{ matrix.python-version }}
26
+
27
+ - name : Install Dependencies
28
+ run : |
29
+ python -m pip install --upgrade pip
30
+ pip install flake8
31
+
32
+ - name : Run Lint
33
+ run : |
34
+ flake8 --verbose --color auto --count --statistics --format=default --output-file=flake8-report
35
+
36
+ - name : Upload Report
37
+ if : ${{ always() }}
38
+ uses : actions/upload-artifact@v4
39
+ with :
40
+ name : lint-report-${{ matrix.python-version }}-${{ matrix.os }}
41
+ path : flake8-report
42
+
43
+ test :
44
+ name : Test
45
+ timeout-minutes : 20
46
+ strategy :
47
+ fail-fast : false
48
+ matrix :
49
+ os : [ ubuntu-latest, windows-latest, macos-latest ]
50
+ python-version : [ '3.10', '3.11', '3.12' ]
51
+ runs-on : ${{ matrix.os }}
52
+ needs : lint
53
+ steps :
54
+ - name : Checkout Repository
55
+ uses : actions/checkout@v4
56
+
57
+ - name : Set up Python
58
+ uses : actions/setup-python@v5
59
+ with :
60
+ python-version : ${{ matrix.python-version }}
61
+
62
+ - name : Install Dependencies
63
+ run : |
64
+ python -m pip install --upgrade pip
65
+ pip install pytest
66
+ pip install pytest-html
67
+ pip install -r requirements.txt
68
+
69
+ - name : Run Tests
70
+ run : |
71
+ pytest tests -vv -rEPW -o pytest_collection_order=alphabetical --cache-clear --color=yes --html=pytest_results.html --self-contained-html
72
+
73
+ - name : Upload Report
74
+ if : ${{ always() }}
75
+ uses : actions/upload-artifact@v4
76
+ with :
77
+ name : test-${{ matrix.os }}-${{ matrix.python-version }}
78
+ path : pytest_results.html
79
+
80
+ build :
81
+ name : Build
82
+ timeout-minutes : 20
83
+ strategy :
84
+ fail-fast : false
85
+ matrix :
86
+ os : [ ubuntu-latest, windows-latest, macos-latest ]
87
+ python-version : [ '3.10' ]
88
+ runs-on : ${{ matrix.os }}
89
+ needs : test
90
+ steps :
91
+ - name : Checkout Repository
92
+ uses : actions/checkout@v4
93
+
94
+ - name : Set up Python
95
+ uses : actions/setup-python@v5
96
+ with :
97
+ python-version : ${{ matrix.python-version }}
98
+
99
+ - name : Install Dependencies
100
+ run : |
101
+ python -m pip install --upgrade pip
102
+ pip install setuptools wheel
103
+
104
+ - name : Build Package
105
+ run : |
106
+ python setup.py sdist
107
+
108
+ - name : Get Package Name (Windows)
109
+ if : matrix.os == 'windows-latest'
110
+ run : |
111
+ $path_separator = "\\"
112
+ $latestFile = Get-ChildItem -Path "dist\\" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
113
+ Write-Host "Latest file: $latestFile"
114
+ Write-Output "PACKAGE_NAME=dist$path_separator$($latestFile.Name)" | Out-File -FilePath $env:GITHUB_ENV -Append
115
+
116
+ - name : Get Package Name (Ubuntu and macOS)
117
+ if : matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
118
+ run : |
119
+ path_separator="/"
120
+ latestFile=$(ls -t dist/ | head -n 1)
121
+ echo "Latest file: $latestFile"
122
+ echo "PACKAGE_NAME=dist$path_separator$latestFile" >> $GITHUB_ENV
123
+
124
+ - name : Install Package
125
+ run : |
126
+ pip install ${{ env.PACKAGE_NAME }}
127
+
128
+ release_check :
129
+ name : Release Check
130
+ timeout-minutes : 20
131
+ strategy :
132
+ fail-fast : true
133
+ matrix :
134
+ os : [ ubuntu-latest ]
135
+ python-version : [ '3.10' ]
136
+ runs-on : ${{ matrix.os }}
137
+ needs : build
138
+ steps :
139
+ - name : Checkout Repository
140
+ uses : actions/checkout@v4
141
+
142
+ - name : Set up Python
143
+ uses : actions/setup-python@v5
144
+ with :
145
+ python-version : ${{ matrix.python-version }}
146
+
147
+ - name : Install Dependencies
148
+ run : |
149
+ python -m pip install --upgrade pip
150
+ pip install setuptools wheel twine
151
+
152
+ - name : Build Package
153
+ run : |
154
+ python setup.py sdist bdist_wheel
155
+
156
+ - name : Get Package Name (Windows)
157
+ if : matrix.os == 'windows-latest'
158
+ run : |
159
+ $path_separator = "\\"
160
+ $latestFile = Get-ChildItem -Path "dist\\" | Sort-Object LastWriteTime -Descending | Select-Object -First 1
161
+ Write-Host "Latest file: $latestFile"
162
+ Write-Output "PACKAGE_NAME=dist$path_separator$($latestFile.Name)" | Out-File -FilePath $env:GITHUB_ENV -Append
163
+
164
+ - name : Get Package Name (Ubuntu and macOS)
165
+ if : matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
166
+ run : |
167
+ path_separator="/"
168
+ latestFile=$(ls -t dist/ | head -n 1)
169
+ echo "Latest file: $latestFile"
170
+ echo "PACKAGE_NAME=dist$path_separator$latestFile" >> $GITHUB_ENV
171
+
172
+ - name : Release Check
173
+ run : |
174
+ twine check ${{ env.PACKAGE_NAME }}
0 commit comments