diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..d7445f2 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,16 @@ +name: Build + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + - name: Setup environment + run: source tools/ci.sh && ci_build_packages_setup + - name: Check manifest files + run: source tools/ci.sh && ci_build_packages_check_manifest + - name: Compile package index + run: source tools/ci.sh && ci_build_packages_compile_index diff --git a/.github/workflows/code-formatting.yml b/.github/workflows/code-formatting.yml index 88c23ee..6c7c744 100644 --- a/.github/workflows/code-formatting.yml +++ b/.github/workflows/code-formatting.yml @@ -7,8 +7,10 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v4 + with: + python-version: '3.11' - name: Install packages run: source tools/ci.sh && ci_code_formatting_setup - name: Run code formatting diff --git a/.github/workflows/pylint.yml b/.github/workflows/pylint.yml index 5f71c3f..44188a0 100644 --- a/.github/workflows/pylint.yml +++ b/.github/workflows/pylint.yml @@ -9,7 +9,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10"] + python-version: ["3.8"] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} @@ -19,7 +19,14 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip + pip -v install micropython-stubber + pip -v install -U micropython-esp32-stubs pip install pylint + pwd + ls -a + ls -a / + find /opt -name micropython-* + find /usr -name micropython-* - name: Analysing the code with pylint run: | pylint $(git ls-files 'adc1_cal.py') diff --git a/.pylintrc b/.pylintrc new file mode 100644 index 0000000..e2b5a0a --- /dev/null +++ b/.pylintrc @@ -0,0 +1,7 @@ +[MASTER] +# Loaded Stubs: esp32-micropython-1.11.0 +init-hook='import sys;sys.path[1:1] = ["src/lib", "all-stubs/cpython-core", "all-stubs/mpy_1_12/frozen/esp32/GENERIC", "all-stubs/esp32_1_13_0-103",]' + +disable = missing-docstring, line-too-long, trailing-newlines, broad-except, logging-format-interpolation, invalid-name, + no-method-argument, assignment-from-no-return, too-many-function-args, unexpected-keyword-arg + # the 2nd line deals with the limited information in the generated stubs. diff --git a/README.md b/README.md index a0538e4..404a00a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ -[![formatting: lint](https://github.com/matthias-bs/MicroPython-ADC_Cal/actions/workflows/ci.yml/badge.svg)](https://github.com/matthias-bs/MicroPython-ADC_Cal/actions/workflows/ci.yml) +[![formatting: lint](https://github.com/matthias-bs/MicroPython-ADC_Cal/actions/workflows/code-formatting.yml/badge.svg)](https://github.com/matthias-bs/MicroPython-ADC_Cal/actions/workflows/ci.yml) [![GitHub release](https://img.shields.io/github/release/matthias-bs/MicroPython-ADC_Cal?maxAge=3600)](https://github.com/matthias-bs/MicroPython-ADC_Cal/releases) -[![License: GPLv3](https://img.shields.io/badge/license-GPLv3-green)](https://github.com/matthias-bs/MicroPython-ADC_Cal/blob/main/LICENSE) # MicroPython-ADC_Cal **MicroPython ESP32 library for calibrated on-chip ADC conversion** diff --git a/adc1_cal.py b/adc1_cal.py index 2529f7e..7fd8d41 100644 --- a/adc1_cal.py +++ b/adc1_cal.py @@ -1,4 +1,5 @@ """MicroPython ESP32 ADC1 conversion using V_ref calibration value""" + ############################################################################### # adc1_cal.py # diff --git a/manifest.py b/manifest.py new file mode 100644 index 0000000..ac61118 --- /dev/null +++ b/manifest.py @@ -0,0 +1,8 @@ +metadata( + version="1.0.1", + description="MicroPython ESP32 library for calibrated on-chip ADC conversion", + author="matthias-bs", + license="MIT", +) + +module("adc1_cal.py", opt=3) diff --git a/package.json b/package.json new file mode 100644 index 0000000..3be72f2 --- /dev/null +++ b/package.json @@ -0,0 +1,7 @@ +{ + "urls": [ + ["adc1_cal.py", "github:matthias-bs/MicroPython-ADC_Cal/adc1_cal.py"] + ], + "version": "1.0.1", + "deps": [] +} diff --git a/tools/README.txt b/tools/README.txt new file mode 100644 index 0000000..bf5c291 --- /dev/null +++ b/tools/README.txt @@ -0,0 +1,8 @@ +"Black" is used for MicroPython code style checking: +https://github.com/psf/black + +"uncrustify" is NOT used in this project, thus uncrustify.cfg wil not be used! + + MicroPython-ADC_Cal/.github/workflows/code-formatting.yml calls ci.sh, + which in turn executes codeformat.py, which will execute black.py. + diff --git a/tools/ci.sh b/tools/ci.sh index d0dafbc..d9e791d 100644 --- a/tools/ci.sh +++ b/tools/ci.sh @@ -27,6 +27,7 @@ function ci_build_packages_setup { # check the required programs run /tmp/micropython/mpy-cross/build/mpy-cross --version python3 /tmp/micropython/tools/manifestfile.py --help + /tmp/micropython/mpy-cross/build/mpy-cross adc1_cal.py } function ci_build_packages_check_manifest { diff --git a/tools/codeformat.py b/tools/codeformat.py index 47b12df..63c9c59 100644 --- a/tools/codeformat.py +++ b/tools/codeformat.py @@ -46,7 +46,6 @@ TOP = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) UNCRUSTIFY_CFG = os.path.join(TOP, "tools/uncrustify.cfg") -print("UNCRUSTIFY_CFG: ", UNCRUSTIFY_CFG) C_EXTS = ( ".c",