Skip to content

Commit 1d08c65

Browse files
committed
build: Revamp
it's been broken since the switch to pyproject.
1 parent f45947d commit 1d08c65

File tree

2 files changed

+46
-19
lines changed

2 files changed

+46
-19
lines changed

build.sh

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,80 @@
11
#!/bin/bash
22
set -eo pipefail
33

4+
in_section=false
5+
if [ "${CI}" -eq "true" ]; then
6+
start_section () {
7+
if $in_section; then end_section; fi
8+
echo "::group::$*"
9+
export in_section=true
10+
}
11+
end_section () {
12+
echo "::endgroup::$*"
13+
in_section=false
14+
}
15+
else
16+
start_section () {
17+
if $in_section; then end_section; fi
18+
echo "=== $*"
19+
export in_section=true
20+
}
21+
end_section () {
22+
echo
23+
in_section=false
24+
}
25+
fi
26+
427
repo_name=`git config remote.origin.url | sed -e 's,^.*/,,;s/\.git$//' | tr A-Z_ a-z-`
5-
echo "=== Building package: $repo_name"
28+
echo "*** Building package: $repo_name"
629

7-
echo "=== Create and set up virtual environment"
30+
start_section "Create and set up virtual environment"
831
[ -d .venv ] || python3 -m venv .env
932
. .env/bin/activate
10-
echo "=== Install requirements"
33+
start_section "Install requirements"
1134
pip3 install wheel
12-
pip3 install -r requirements_dev.txt
13-
echo "=== Run pre-commit"
35+
pip3 install -r optional_requirements.txt
36+
start_section "Run pre-commit"
1437
pre-commit run --all-files
1538

16-
echo "=== Clone and build circuitpython unix port"
39+
start_section "Clone and build circuitpython unix port"
1740
[ -e circuitpython/py/py.mk ] || git clone --shallow-since=2021-07-01 https://github.com/adafruit/circuitpython
1841
[ -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)
1942
[ -x circuitpython/ports/unix/micropython ] || (
2043
make -C circuitpython/mpy-cross -j$(nproc)
21-
make -C circuitpython/ports/unix -j$(nproc) deplibs
44+
make -C circuitpython/ports/unix -j$(nproc) deplibs submodules
2245
make -C circuitpython/ports/unix -j$(nproc) DEBUG=1 STRIP=:
2346
)
2447

25-
echo "=== Run tests"
48+
start_section "Run tests"
2649
python -m jepler_udecimal.test
2750

28-
run-tests () {
29-
env MICROPYPATH=. PYTHONPATH=. MICROPY_MICROPYTHON=circuitpython/ports/unix/micropython circuitpython/tests/run-tests.py "$@"
51+
run_tests () {
52+
env MICROPYPATH="`readlink -f .`" PYTHONPATH="`readlink -f .`" MICROPY_MICROPYTHON=circuitpython/ports/unix/build-standard/micropython circuitpython/tests/run-tests.py --keep-path "$@"
3053
}
3154

32-
run-tests --clean-failures
33-
if ! run-tests -d examples; then
34-
run-tests --print-failures
55+
run_tests --clean-failures
56+
if ! run_tests -d examples; then
57+
run_tests --print-failures
3558
exit 1
3659
fi
3760

3861
PYTHONPATH=. python examples/test_udecimal.py > test_udecimal.exp
39-
echo "=== Build CircuitPython bundle"
62+
start_section "Build CircuitPython bundle"
4063
circuitpython-build-bundles --package_folder_prefix jepler --filename_prefix $repo_name --library_location .
4164

42-
echo "=== Build docs"
65+
start_section "Build docs"
4366
rm -rf docs/_build
4467
(cd docs && sphinx-build -E -W -b html . _build/html)
4568

46-
echo "=== Build pypi files"
47-
python setup.py sdist
48-
python setup.py bdist_wheel --universal
69+
start_section "Build pypi files"
70+
python -m build
4971

50-
echo "=== Check pypi files"
72+
start_section "Check pypi files"
5173
twine check dist/*
74+
end_section
75+
76+
echo "=== Success"
77+
5278
# SPDX-FileCopyrightText: Copyright (c) 2020 jepler for Unpythonic Networks
5379
#
5480
# SPDX-License-Identifier: MIT

optional_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# SPDX-FileCopyrightText: Copyright (c) 2020 jepler for Unpythonic Networks
33
#
44
# SPDX-License-Identifier: MIT
5+
build
56
pre-commit
67
recommonmark==0.6.0
78
sphinx

0 commit comments

Comments
 (0)