Skip to content

Fix minifying strings-in-containers as if they were docstrings. #605

Fix minifying strings-in-containers as if they were docstrings.

Fix minifying strings-in-containers as if they were docstrings. #605

Workflow file for this run

# Regular tests
#
# Use this to ensure your tests are passing on every push and PR (skipped on
# pushes which only affect documentation).
#
# You should make sure you run jobs on at least the *oldest* and the *newest*
# versions of python that your codebase is intended to support.
name: tests
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
jobs:
test:
timeout-minutes: 45
defaults:
run:
shell: bash
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
BELAY_DEBUG_PROCESS_BUFFER: false
steps:
- name: Set OS Environment Variables (Windows)
if: runner.os == 'Windows'
run: |
echo 'ACTIVATE_PYTHON_VENV=.venv/scripts/activate' >> $GITHUB_ENV
echo 'BELAY_SHORT_INTEGRATION_TEST=true' >> $GITHUB_ENV
- name: Set OS Environment Variables (not Windows)
if: runner.os != 'Windows'
run: |
echo 'ACTIVATE_PYTHON_VENV=.venv/bin/activate' >> $GITHUB_ENV
- name: Check out Belay repository
uses: actions/checkout@v4
- name: Check out RP2040js repository
uses: actions/checkout@v4
with:
repository: wokwi/rp2040js
path: rp2040js
- name: Cache $HOME/.local # Significantly speeds up Poetry Install
uses: actions/cache@v4
with:
path: ~/.local
key: dotlocal-${{ runner.os }}-${{ hashFiles('.github/workflows/tests.yml') }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Cache Pi Pico MicroPython 1.17 firmware
id: cached-pi-pico-micropython-1-17-firmware
uses: actions/cache@v4
with:
path: rp2040js/micropython-v1.17.uf2
key: pi-pico-rp2040js/micropython-v1.17.uf2
- name: Download Pi Pico MicroPython 1.17 firmware
if: steps.cached-pi-pico-micropython-1-17-firmware.outputs.cache-hit != 'true'
run: |
curl https://micropython.org/resources/firmware/RPI_PICO-20210902-v1.17.uf2 -o rp2040js/micropython-v1.17.uf2
- name: Cache Pi Pico CircuitPython 7.3.3 firmware
id: cached-pi-pico-circuitpython-7-3-3-firmware
uses: actions/cache@v4
with:
path: rp2040js/circuitpython-v7.3.3.uf2
key: pi-pico-rp2040js/circuitpython-v7.3.3.uf2
- name: Download Pi Pico CircuitPython 7.3.3 firmware
if: steps.cached-pi-pico-circuitpython-7-3-3-firmware.outputs.cache-hit != 'true'
run: |
curl https://downloads.circuitpython.org/bin/raspberry_pi_pico/en_US/adafruit-circuitpython-raspberry_pi_pico-en_US-7.3.3.uf2 -o rp2040js/circuitpython-v7.3.3.uf2
- name: Cache Pi Pico CircuitPython 8.0.0 firmware
id: cached-pi-pico-circuitpython-8-0-0-firmware
uses: actions/cache@v4
with:
path: rp2040js/circuitpython-v8.0.0.uf2
key: pi-pico-rp2040js/circuitpython-v8.0.0.uf2
- name: Download Pi Pico CircuitPython 8.0.0 firmware
if: steps.cached-pi-pico-circuitpython-8-0-0-firmware.outputs.cache-hit != 'true'
run: |
curl https://downloads.circuitpython.org/bin/raspberry_pi_pico/en_US/adafruit-circuitpython-raspberry_pi_pico-en_US-8.0.0.uf2 -o rp2040js/circuitpython-v8.0.0.uf2
- name: Cache Node Modules
id: cached-npm
uses: actions/cache@v4
with:
path: rp2040js/node_modules
key: modules-${{ hashFiles('rp2040js/package-lock.json') }}
- name: Install rp2040js
if: steps.cached-npm.outputs.cache-hit != 'true'
run: |
cd rp2040js
npm install
- name: Load pip cache
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}
restore-keys: ${{ runner.os }}-pip
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install Belay dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Install Belay
run: poetry install --no-interaction
- name: Run tests (unit only)
if: runner.os == 'Windows'
run: |
source ${{ env.ACTIVATE_PYTHON_VENV }}
python -m pytest --cov=belay --cov-report=term --cov-report=xml --cov-config=.coveragerc --junitxml=testresults.xml --network tests -s
coverage report
- name: Run tests (unit + integration)
if: runner.os != 'Windows'
run: |
source ${{ env.ACTIVATE_PYTHON_VENV }}
python -m pytest --cov=belay --cov-report=term --cov-report=xml --cov-config=.coveragerc --junitxml=testresults.xml --network tests tests/integration -s
coverage report
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
env_vars: OS,PYTHON
name: Python ${{ matrix.python-version }} on ${{ runner.os }}
#----------------------------------------------
# make sure docs build
#----------------------------------------------
- name: Build HTML docs
run: |
source ${{ env.ACTIVATE_PYTHON_VENV }}
sphinx-build -b html docs/source/ docs/build/html