Skip to content

Commit 575b025

Browse files
committed
Run tests in circuitpython unix port too
1 parent e95553d commit 575b025

File tree

3 files changed

+43
-2
lines changed

3 files changed

+43
-2
lines changed

.github/workflows/build.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,26 @@ jobs:
5454
run: |
5555
pylint $( find . -path './jepler*.py' )
5656
([[ ! -d "examples" ]] || pylint --disable=missing-docstring,invalid-name,bad-whitespace $( find . -path "./examples/*.py" ))
57+
- name: Clone and build circuitpython unix port
58+
run: |
59+
set -e
60+
[ -e circuitpython/py/py.mk ] || git clone --depth=1 https://github.com/adafruit/circuitpython
61+
[ -e circuitpython/lib/libffi/autogen.sh ] || (cd circuitpython && git submodule update --init lib/libffi lib/axtls lib/berkeley-db-1.xx tools/huffman lib/uzlib extmod/ulab)
62+
[ -x circuitpython/ports/unix/micropython ] || (
63+
make -C circuitpython/mpy-cross -j$(nproc)
64+
make -C circuitpython/ports/unix -j$(nproc) deplibs
65+
make -C circuitpython/ports/unix -j$(nproc) DEBUG=1 STRIP=:
66+
)
5767
- name: Unit Test
58-
run: python -m jepler_udecimal.test
68+
run: |
69+
python -m jepler_udecimal.test
70+
if ! env MICROPYPATH=. PYTHONPATH=. MICROPY_MICROPYTHON=circuitpython/ports/unix/micropython circuitpython/tests/run-tests -d examples; then
71+
for exp in *.exp; do
72+
testbase=$(basename $exp .exp);
73+
echo -e "\nFAILURE $testbase";
74+
diff -u $testbase.exp $testbase.out;
75+
done
76+
fi
5977
- name: Build assets
6078
run: circuitpython-build-bundles --package_folder_prefix jepler --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location .
6179
- name: Build docs

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ dist
1717
**/*.egg-info
1818
.vscode
1919
docs/api
20+
circuitpython

build.sh

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ set -eo pipefail
44
repo_name=`git config remote.origin.url | sed -e 's,^.*/,,;s/\.git$//' | tr A-Z_ a-z-`
55
echo "=== Building package: $repo_name"
66

7-
87
echo "=== Create and set up virtual environment"
98
[ -d .venv ] || python3 -m venv .env
109
. .env/bin/activate
@@ -18,16 +17,39 @@ pylint jepler_udecimal
1817
if [ -d examples ]; then
1918
pylint --disable=missing-docstring,invalid-name,bad-whitespace examples
2019
fi
20+
21+
echo "=== Clone and build circuitpython unix port"
22+
[ -e circuitpython/py/py.mk ] || git clone --depth=1 https://github.com/adafruit/circuitpython
23+
[ -e circuitpython/lib/libffi/autogen.sh ] || (cd circuitpython && git submodule update --init lib/libffi lib/axtls lib/berkeley-db-1.xx tools/huffman lib/uzlib extmod/ulab)
24+
[ -x circuitpython/ports/unix/micropython ] || (
25+
make -C circuitpython/mpy-cross -j$(nproc)
26+
make -C circuitpython/ports/unix -j$(nproc) deplibs
27+
make -C circuitpython/ports/unix -j$(nproc) DEBUG=1 STRIP=:
28+
)
29+
2130
echo "=== Run tests"
2231
python -m jepler_udecimal.test
32+
33+
if ! env MICROPYPATH=. PYTHONPATH=. MICROPY_MICROPYTHON=circuitpython/ports/unix/micropython circuitpython/tests/run-tests -d examples; then
34+
for exp in *.exp; do
35+
testbase=$(basename $exp .exp);
36+
echo -e "\nFAILURE $testbase";
37+
diff -u $testbase.exp $testbase.out;
38+
done
39+
fi
40+
41+
PYTHONPATH=. python examples/test_udecimal.py > test_udecimal.exp
2342
echo "=== Build CircuitPython bundle"
2443
circuitpython-build-bundles --package_folder_prefix jepler --filename_prefix $repo_name --library_location .
44+
2545
echo "=== Build docs"
2646
rm -rf docs/_build
2747
(cd docs && sphinx-build -E -W -b html . _build/html)
48+
2849
echo "=== Build pypi files"
2950
python setup.py sdist
3051
python setup.py bdist_wheel --universal
52+
3153
echo "=== Check pypi files"
3254
twine check dist/*
3355
# SPDX-FileCopyrightText: Copyright (c) 2020 jepler for Unpythonic Networks

0 commit comments

Comments
 (0)