diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5ec1568..4ac5673 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,55 +42,18 @@ jobs: # (e.g. - apt-get: gettext, etc; pip: circuitpython-build-tools, requirements.txt; etc.) run: | source actions-ci/install.sh - - name: Pip install Sphinx, pre-commit - run: | - pip install --force-reinstall Sphinx sphinx-rtd-theme pre-commit sphinx-autoapi - name: Library version run: git describe --dirty --always --tags - - name: Setup problem matchers - uses: adafruit/circuitpython-action-library-ci-problem-matchers@v1 - - name: Pre-commit hooks + - name: Perform build & test run: | - pre-commit run --all-files - - name: Clone and build circuitpython unix port - run: | - set -e - [ -e circuitpython/py/py.mk ] || (git clone --depth=1 https://github.com/adafruit/circuitpython && cd circuitpython && git fetch --tags --recurse-submodules=no --shallow-since="2021-07-01" https://github.com/adafruit/circuitpython HEAD) - [ -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) - [ -x circuitpython/ports/unix/micropython ] || ( - make -C circuitpython/mpy-cross -j$(nproc) - make -C circuitpython/ports/unix -j$(nproc) deplibs - make -C circuitpython/ports/unix -j$(nproc) DEBUG=1 STRIP=: - ) - - name: Unit Test - run: | - python -m jepler_udecimal.test - if ! env MICROPYPATH=. PYTHONPATH=. MICROPY_MICROPYTHON=circuitpython/ports/unix/micropython circuitpython/tests/run-tests.py -d examples; then - for exp in *.exp; do - testbase=$(basename $exp .exp); - echo -e "\nFAILURE $testbase"; - diff -u $testbase.exp $testbase.out; - done - exit 1 - fi - - name: Build assets - run: circuitpython-build-bundles --package_folder_prefix jepler --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location . - - name: Build docs - working-directory: docs - run: sphinx-build -E -W -b html . _build/html + ./build.sh - name: Archive bundles uses: actions/upload-artifact@v2 with: name: bundles path: ${{ github.workspace }}/bundles/ - - name: Check For setup.py - id: need-pypi - run: | - echo ::set-output name=setup-py::$( find . -wholename './setup.py' ) - - name: Build Python package - if: contains(steps.need-pypi.outputs.setup-py, 'setup.py') - run: | - pip install --upgrade setuptools wheel twine readme_renderer testresources - python setup.py sdist - python setup.py bdist_wheel --universal - twine check dist/* + - name: Archive docs + uses: actions/upload-artifact@v2 + with: + name: docs + path: ${{ github.workspace }}/_build/html diff --git a/build.sh b/build.sh index 9d4dc37..a314d47 100755 --- a/build.sh +++ b/build.sh @@ -9,17 +9,12 @@ echo "=== Create and set up virtual environment" . .env/bin/activate echo "=== Install requirements" pip3 install wheel -pip3 install -r requirements.txt +pip3 install -r requirements_dev.txt echo "=== Run pre-commit" pre-commit run --all-files -echo "=== Run pylint" -pylint jepler_udecimal -if [ -d examples ]; then - pylint --disable=missing-docstring,invalid-name,bad-whitespace examples -fi echo "=== Clone and build circuitpython unix port" -[ -e circuitpython/py/py.mk ] || git clone --depth=1 https://github.com/adafruit/circuitpython +[ -e circuitpython/py/py.mk ] || git clone --shallow-since=2021-07-01 https://github.com/adafruit/circuitpython [ -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) [ -x circuitpython/ports/unix/micropython ] || ( make -C circuitpython/mpy-cross -j$(nproc) @@ -30,12 +25,14 @@ make -C circuitpython/ports/unix -j$(nproc) DEBUG=1 STRIP=: echo "=== Run tests" python -m jepler_udecimal.test -if ! env MICROPYPATH=. PYTHONPATH=. MICROPY_MICROPYTHON=circuitpython/ports/unix/micropython circuitpython/tests/run-tests -d examples; then - for exp in *.exp; do - testbase=$(basename $exp .exp); - echo -e "\nFAILURE $testbase"; - diff -u $testbase.exp $testbase.out; - done +run-tests () { + env MICROPYPATH=. PYTHONPATH=. MICROPY_MICROPYTHON=circuitpython/ports/unix/micropython circuitpython/tests/run-tests.py "$@" +} + +run-tests --clean-failures +if ! run-tests -d examples; then + run-tests --print-failures + exit 1 fi PYTHONPATH=. python examples/test_udecimal.py > test_udecimal.exp diff --git a/requirements_dev.txt b/requirements_dev.txt index 82911ac..7913ee8 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: MIT pre-commit recommonmark==0.6.0 -sphinx<4 +sphinx sphinx-autoapi sphinxcontrib-svg2pdfconverter==0.1.0 sphinx-rtd-theme