Skip to content

Commit 678750e

Browse files
committed
[Tests][Added] Worflow to test coveralls
- The 3.3.1 package doesn't work on Trixie - Trying to install 4.0.2
1 parent fb11c60 commit 678750e

1 file changed

Lines changed: 294 additions & 0 deletions

File tree

Lines changed: 294 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,294 @@
1+
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Regression tests
5+
6+
on:
7+
workflow_dispatch:
8+
9+
jobs:
10+
test:
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
ki_release: [ki9]
15+
w_tests: [g2]
16+
# ki_release: [nightly]
17+
# w_tests: [gdebug]
18+
19+
runs-on: ubuntu-latest
20+
container: ghcr.io/inti-cmnb/kicad_auto_test:${{ matrix.ki_release }}
21+
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
submodules: recursive
26+
- name: Test ${{ matrix.ki_release }}
27+
env:
28+
KI_RELEASE: ${{ matrix.ki_release }}
29+
PIP_OPS: ${{ matrix.ki_release != 'ki5' && '--break-system-packages' || ''}}
30+
run: |
31+
rm -rf output
32+
rm -f tests/.local
33+
##### Experimental stuff:
34+
## Remove KiAuto
35+
#dpkg --remove --force-all kiauto
36+
## Install KiAuto@master
37+
#curl https://codeload.github.com/INTI-CMNB/KiAuto/zip/refs/heads/master --output pp.zip
38+
#unzip pp.zip
39+
#pip3 install ${PIP_OPS} KiAuto-master/
40+
## Clean the downloaded stuff
41+
#rm -rf KiAuto-master/ pp.zip
42+
## Install KiDiff@master
43+
#curl https://codeload.github.com/INTI-CMNB/KiDiff/zip/refs/heads/master --output pp.zip
44+
#unzip pp.zip
45+
#pip3 install ${PIP_OPS} KiDiff-master/
46+
## Clean the downloaded stuff
47+
#rm -rf KiDiff-master/ pp.zip
48+
## Check what we got
49+
#echo $PATH
50+
#ls -la /usr/bin/*_do || true
51+
#ls -la /usr/local/bin/*_do || true
52+
#which pcbnew_do
53+
#pcbnew_do --version
54+
# KiDiff tests
55+
#curl https://codeload.github.com/INTI-CMNB/KiDiff/zip/refs/heads/kiri_mode --output pp.zip
56+
#unzip pp.zip
57+
#prefix=/usr make -C KiDiff-kiri_mode install
58+
#rm -rf KiDiff-kiri_mode/ pp.zip
59+
#kicad-diff.py --version
60+
##### End Experimental stuff
61+
# Ensure we start a fresh coverage meassurement
62+
python3-coverage erase
63+
# Create the caches with macros
64+
python3-coverage run src/kibot --help-outputs > /dev/null
65+
# Individual run for specific tests
66+
# pytest --log-cli-level debug -k "test_ibom_parse_fail" --test_dir=output
67+
# Run the 90% faster tests (under 3 s) together
68+
# Do it in parallel
69+
./${{ matrix.w_tests }}.sh
70+
- name: Store coverage
71+
if: ${{ always() }}
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: Test_Coverage_${{ matrix.ki_release }}_${{ matrix.w_tests }}
75+
path: .coverage.*
76+
include-hidden-files: true
77+
- name: Collect coverage ${{ matrix.ki_release }}
78+
run: |
79+
python3-coverage combine
80+
python3-coverage report
81+
python3-coverage html -d output/htmlcov_${{ matrix.w_tests }}
82+
python3-coverage xml
83+
ls -la coverage* .coverage*
84+
- name: Store results
85+
if: ${{ always() }}
86+
uses: actions/upload-artifact@v4
87+
with:
88+
name: Test_Output_${{ matrix.ki_release }}_${{ matrix.w_tests }}
89+
# Important! empty directories are skipped!!!!
90+
path: output
91+
include-hidden-files: true
92+
- name: Upload Coverage
93+
# Don't mix stable coverage with development coverage
94+
# if: ${{ (github.ref == 'refs/heads/dev') && (matrix.ki_release != 'ki8') }}
95+
if: ${{ (matrix.ki_release != 'ki8') }}
96+
env:
97+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
98+
COVERALLS_FLAG_NAME: ${{ matrix.ki_release }}_${{ matrix.w_tests }}
99+
COVERALLS_PARALLEL: true
100+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101+
run: |
102+
# apt-get update
103+
# apt-get -y install python3-pip
104+
# pip3 install coveralls
105+
#coveralls --service=github
106+
#echo Disabled by now
107+
dl_deb.py set-soft/coveralls-python
108+
apt-get -y install --no-install-recommends ./*.deb
109+
coveralls --version
110+
coveralls
111+
- name: Upload Coverage optional
112+
if: ${{ (matrix.ki_release == 'ki8') }}
113+
env:
114+
COVERALLS_DEBUG: true
115+
COVERALLS_FLAG_NAME: ${{ matrix.ki_release }}_${{ matrix.w_tests }}
116+
COVERALLS_PARALLEL: true
117+
COVERALLS_ENDPOINT: https://coveralls.io
118+
# COVERALLS_GIT_BRANCH: ${{ inputs.git-branch }}
119+
# COVERALLS_GIT_COMMIT: ${{ inputs.git-commit }}
120+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
121+
# COVERALLS_COMPARE_REF: ${{ inputs.compare-ref }}
122+
# COVERALLS_COMPARE_SHA: ${{ inputs.compare-sha }}
123+
COVERALLS_SOURCE_HEADER: github-action
124+
run: |
125+
ls -la coverage* .coverage*
126+
mkdir -p ~/bin/
127+
echo ~/bin >> $GITHUB_PATH
128+
ln -s `which python3-coverage` /usr/bin/coverage
129+
python3-coverage --version
130+
coverage --version
131+
export CURDIR=`pwd`
132+
cd ~/bin/
133+
curl -sLO https://github.com/coverallsapp/coverage-reporter/releases/download/v0.6.9/coveralls-linux.tar.gz
134+
curl -sLO https://github.com/coverallsapp/coverage-reporter/releases/download/v0.6.9/coveralls-checksums.txt
135+
# curl -sLO https://github.com/coverallsapp/coverage-reporter/releases/latest/download/coveralls-linux.tar.gz
136+
# curl -sLO https://github.com/coverallsapp/coverage-reporter/releases/latest/download/coveralls-checksums.txt
137+
cat coveralls-checksums.txt | grep coveralls-linux.tar.gz | sha256sum --check
138+
tar -xzf coveralls-linux.tar.gz
139+
rm coveralls-checksums.txt
140+
ls -la ~/bin/
141+
cd ${CURDIR}
142+
~/bin/coveralls report --debug --format python .coverage
143+
144+
test_indep:
145+
strategy:
146+
fail-fast: false
147+
148+
runs-on: ubuntu-latest
149+
# We use a modern container because the GUI needs a modern wxWidgets
150+
container: ghcr.io/inti-cmnb/kicad_auto_test:ki8
151+
152+
steps:
153+
- uses: actions/checkout@v4
154+
with:
155+
submodules: recursive
156+
- name: Lint with flake8
157+
run: |
158+
# stop the build if there are Python syntax errors or undefined names
159+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
160+
# exit-zero treats all errors as warnings.
161+
flake8 . --count --exit-zero --statistics
162+
- name: Test Independent
163+
env:
164+
KI_RELEASE: latest
165+
run: |
166+
rm -rf output
167+
rm -f tests/.local
168+
# Ensure we start a fresh coverage meassurement
169+
python3-coverage erase
170+
# Create the caches with macros
171+
python3-coverage run src/kibot --help-outputs > /dev/null
172+
./g4.sh
173+
- name: Store coverage
174+
if: ${{ always() }}
175+
uses: actions/upload-artifact@v4
176+
with:
177+
name: Test_Coverage_Independent
178+
path: .coverage.*
179+
include-hidden-files: true
180+
- name: Collect coverage independent
181+
run: |
182+
python3-coverage combine
183+
python3-coverage report
184+
python3-coverage html -d output/htmlcov_independent
185+
- name: Store results
186+
if: ${{ always() }}
187+
uses: actions/upload-artifact@v4
188+
with:
189+
name: Test_Output_Independent
190+
# Important! empty directories are skipped!!!!
191+
path: output
192+
include-hidden-files: true
193+
- name: Upload Coverage
194+
# Don't mix stable coverage with development coverage
195+
# if: github.ref == 'refs/heads/dev'
196+
env:
197+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
198+
COVERALLS_FLAG_NAME: independent
199+
COVERALLS_PARALLEL: true
200+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
201+
run: |
202+
# apt-get update
203+
# apt-get -y install python3-pip
204+
# pip3 install coveralls
205+
#coveralls --service=github
206+
#echo Disabled by now
207+
coveralls
208+
209+
create_images:
210+
name: Triggers the docker images creation
211+
runs-on: ubuntu-latest
212+
needs: [test, test_indep]
213+
if: github.ref == 'refs/heads/dev'
214+
steps:
215+
- name: Trigger `dev` images build
216+
run: |
217+
curl -L -X POST -H "Authorization: Bearer ${{secrets.PAT_TOKEN}}" -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/INTI-CMNB/KiBot/actions/workflows/dev_images.yml/dispatches --data '{"ref": "dev"}'
218+
219+
consolidate_coverage:
220+
name: Consolidate coverage data
221+
runs-on: ubuntu-latest
222+
container: setsoft/kicad_auto_test:ki7
223+
needs: [test, test_indep]
224+
# Don't mix stable coverage with development coverage
225+
#if: github.ref == 'refs/heads/dev'
226+
227+
steps:
228+
- uses: actions/checkout@v4
229+
with:
230+
submodules: recursive
231+
232+
- name: Download coverage k5 g1
233+
uses: actions/download-artifact@v4
234+
with:
235+
name: Test_Coverage_ki5_g1
236+
237+
- name: Download coverage k5 g2
238+
uses: actions/download-artifact@v4
239+
with:
240+
name: Test_Coverage_ki5_g2
241+
242+
- name: Download coverage k5 g3
243+
uses: actions/download-artifact@v4
244+
with:
245+
name: Test_Coverage_ki5_g3
246+
247+
- name: Download coverage k6 g1
248+
uses: actions/download-artifact@v4
249+
with:
250+
name: Test_Coverage_ki6_g1
251+
252+
- name: Download coverage k6 g2
253+
uses: actions/download-artifact@v4
254+
with:
255+
name: Test_Coverage_ki6_g2
256+
257+
- name: Download coverage k6 g3
258+
uses: actions/download-artifact@v4
259+
with:
260+
name: Test_Coverage_ki6_g3
261+
262+
- name: Download coverage independent
263+
uses: actions/download-artifact@v4
264+
with:
265+
name: Test_Coverage_Independent
266+
267+
- name: Combine coverage
268+
run: |
269+
pip3 install --upgrade --break-system-packages coverage==5.1
270+
ln -s /usr/local/bin/coverage3 /usr/local/bin/python3-coverage || true
271+
python3-coverage combine
272+
python3-coverage report
273+
python3-coverage html -d htmlcov
274+
275+
- name: Store result
276+
uses: actions/upload-artifact@v4
277+
with:
278+
name: Test_Coverage_combined
279+
path: htmlcov
280+
include-hidden-files: true
281+
282+
coveralls:
283+
name: Finish Coveralls
284+
needs: [test, test_indep]
285+
runs-on: ubuntu-latest
286+
# Don't mix stable coverage with development coverage
287+
#if: github.ref == 'refs/heads/dev'
288+
steps:
289+
- name: Finished
290+
env:
291+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
292+
run: |
293+
curl -k https://coveralls.io/webhook?repo_token=$COVERALLS_REPO_TOKEN -d "payload[build_num]="$GITHUB_RUN_ID"&payload[status]=done"
294+

0 commit comments

Comments
 (0)