Skip to content

Commit ebb9102

Browse files
committed
github/workflows: Add workflow to run package tests.
All of the runable package tests are run together in the new `ci.sh` function. This is added to a new GitHub workflow to test the packages as part of CI. Eventually it would be good to unify all the package tests to use `unittest`. Signed-off-by: Damien George <[email protected]>
1 parent 2b3bd5b commit ebb9102

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

.github/workflows/package_tests.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Package tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
- uses: actions/setup-python@v4
11+
- name: Setup environment
12+
run: source tools/ci.sh && ci_packge_tests_setup
13+
- name: Run tests
14+
run: source tools/ci.sh && ci_packge_tests_run

tools/ci.sh

+62
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,68 @@ function ci_commit_formatting_run {
1212
tools/verifygitlog.py -v upstream/master..HEAD --no-merges
1313
}
1414

15+
########################################################################################
16+
# package tests
17+
18+
MICROPYTHON=/tmp/micropython/ports/unix/build-standard/micropython
19+
20+
function ci_package_tests_setup {
21+
git clone https://github.com/micropython/micropython.git /tmp/micropython
22+
23+
# build mpy-cross and micropython (use -O0 to speed up the build)
24+
make -C /tmp/micropython/mpy-cross -j CFLAGS_EXTRA=-O0
25+
make -C /tmp/micropython/ports/unix submodules
26+
make -C /tmp/micropython/ports/unix -j CFLAGS_EXTRA=-O0
27+
}
28+
29+
function ci_package_tests_run {
30+
for test in \
31+
./micropython/drivers/storage/sdcard/sdtest.py \
32+
./micropython/ucontextlib/tests.py \
33+
./micropython/xmltok/test_xmltok.py \
34+
./python-ecosys/requests/test_requests.py \
35+
./python-stdlib/argparse/test_argparse.py \
36+
./python-stdlib/base64/test_base64.py \
37+
./python-stdlib/binascii/test_binascii.py \
38+
./python-stdlib/collections-defaultdict/test_defaultdict.py \
39+
./python-stdlib/functools/test_partial.py \
40+
./python-stdlib/functools/test_reduce.py \
41+
./python-stdlib/heapq/test_heapq.py \
42+
./python-stdlib/hmac/test_hmac.py \
43+
./python-stdlib/itertools/test_itertools.py \
44+
./python-stdlib/operator/test_operator.py \
45+
./python-stdlib/os-path/test_path.py \
46+
./python-stdlib/pickle/test_pickle.py \
47+
./python-stdlib/shutil/test_shutil.py \
48+
./python-stdlib/string/test_translate.py \
49+
./python-stdlib/tempfile/test_tempfile.py \
50+
./python-stdlib/time/test_time.py \
51+
./unix-ffi/gettext/test_gettext.py \
52+
./unix-ffi/pwd/test_getpwnam.py \
53+
./unix-ffi/re/test_re.py \
54+
./unix-ffi/time/test_strftime.py \
55+
; do
56+
echo "Running test $test"
57+
(cd `dirname $test` && $MICROPYTHON `basename $test`)
58+
if [ $? -ne 0 ]; then
59+
false # make this function return an error code
60+
return
61+
fi
62+
done
63+
64+
(cd micropython/usb/usb-device && $MICROPYTHON -m tests.test_core_buffer)
65+
if [ $? -ne 0 ]; then false; return; fi
66+
67+
(cd python-ecosys/cbor2 && $MICROPYTHON -m examples.cbor_test)
68+
if [ $? -ne 0 ]; then false; return; fi
69+
70+
(cd python-stdlib/pathlib && $MICROPYTHON -m unittest)
71+
if [ $? -ne 0 ]; then false; return; fi
72+
73+
(cd python-stdlib/unittest-discover/tests && $MICROPYTHON -m unittest)
74+
if [ $? -ne 0 ]; then false; return; fi
75+
}
76+
1577
########################################################################################
1678
# build packages
1779

0 commit comments

Comments
 (0)