Use an enum for state machine (#151) #312
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| on: | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| name: run tests | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: checkout code | |
| uses: actions/checkout@v6 | |
| - name: install python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.13' | |
| - name: linter | |
| run: | | |
| pip install cpplint==2.0.0 | |
| make lint | |
| test: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: checkout code | |
| uses: actions/checkout@v6 | |
| - name: install python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.13' | |
| - name: Cache PlatformIO | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.platformio | |
| ~/.cache/pip | |
| key: ${{ runner.os }}-pio-${{ hashFiles('**/platformio.ini') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pio- | |
| - name: install tools | |
| uses: ./.github/actions/setup-platformio | |
| with: | |
| install-gcovr: 'true' | |
| - name: run tests | |
| run: | | |
| cd test | |
| make clean test OPT=-O2 | |
| make clean coverage OPT=-O0 | |
| - name: Upload coverage to coveralls | |
| uses: coverallsapp/github-action@v2.3.6 | |
| with: | |
| github-token: ${{ secrets.github_token }} | |
| file: test/coverage.json | |
| git-commit: ${{ github.event.pull_request.head.sha || github.sha }} | |
| - name: Upload HTML coverage report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: test/report/ | |
| setup-examples: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: checkout code | |
| uses: actions/checkout@v6 | |
| - name: install python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.13' | |
| - name: Cache PlatformIO | |
| id: cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.platformio | |
| ~/.cache/pip | |
| key: ${{ runner.os }}-pio-${{ hashFiles('**/platformio.ini', '.github/workflows/test.yml') | |
| }} | |
| restore-keys: | | |
| ${{ runner.os }}-pio- | |
| - name: install tools | |
| uses: ./.github/actions/setup-platformio | |
| - name: install rpipico platform and toolchain | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: | | |
| pio platform install "https://github.com/maxgerhardt/platform-raspberrypi.git" | |
| pio ci --board=rpipico \ | |
| --lib="src" \ | |
| --project-option="board_build.core = earlephilhower" \ | |
| "examples/hello/hello.ino" | |
| examples: | |
| needs: setup-examples | |
| runs-on: ubuntu-24.04 | |
| strategy: | |
| matrix: | |
| board: [uno, esp01, nano33ble, esp32dev, rpipico] | |
| example: | |
| - custom_hal | |
| - morse | |
| - candle | |
| - multiled | |
| - user_func | |
| - hello | |
| - breathe | |
| - simple_on | |
| - fade_on | |
| - sequence | |
| - hires | |
| include: | |
| - board: esp32dev | |
| extra_flags: --project-option="build_flags = -DLED_BUILTIN=1" | |
| - board: rpipico | |
| extra_flags: --project-option="board_build.core = earlephilhower" | |
| - example: morse | |
| extra_libs: --lib="examples/morse" | |
| - board: nucleo_f401re | |
| example: multiled_mbed | |
| extra_flags: --project-option="framework=mbed" | |
| ext: cpp | |
| steps: | |
| - name: checkout code | |
| uses: actions/checkout@v6 | |
| - name: Cache PlatformIO | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.platformio | |
| ~/.cache/pip | |
| key: ${{ runner.os }}-pio-${{ hashFiles('**/platformio.ini', '.github/workflows/test.yml') | |
| }} | |
| restore-keys: | | |
| ${{ runner.os }}-pio- | |
| - name: install python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.13' | |
| - name: install tools | |
| uses: ./.github/actions/setup-platformio | |
| - name: build examples | |
| run: |- | |
| # the mbed examples explicitely sets the extension to cpp, default is ino | |
| EXT=${{matrix.ext || 'ino'}} | |
| pio ci --board="${{matrix.board}}" \ | |
| --lib="src" ${{matrix.extra_libs}} \ | |
| ${{matrix.extra_flags}} \ | |
| "examples/${{matrix.example}}/${{matrix.example}}.${EXT}" |