[WIP] C++ linter and formatter (experimental) #207
Workflow file for this run
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
| name: Miscellaneous | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| platformio: | |
| name: PlatformIO version | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.print.outputs.version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| - name: Set up Python | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: 3.13 | |
| cache: pip | |
| cache-dependency-path: .github/platformio/requirements.txt | |
| - name: Set up PlatformIO | |
| run: pip install -r .github/platformio/requirements.txt | |
| - name: PlatformIO version | |
| id: print | |
| run: echo "version=$(pio --version | awk '{print $NF}')" >> "$GITHUB_OUTPUT" | |
| animation-splitter: | |
| name: Animation splitter | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - python-version: 3.11 | |
| - python-version: 3.14 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| - name: Set up Python | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| cache-dependency-path: tools/pyproject.toml | |
| - name: Set up Frekvens tools | |
| run: pip install tools/ | |
| - name: Animation splitter | |
| run: | | |
| cat <<EOL > Frames.csv | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,255,0,0,0,0,0,255,0,0,255,0,0,0 | |
| 0,0,0,255,0,0,0,0,0,0,0,0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,0,0,0,0,0,0,0,0,0,0 | |
| EOL | |
| sed -i 's/\r\{0,1\}$/\r/' Frames.csv | |
| python -m frekvens.AnimationSplitter -i Frames.csv | |
| - name: Frame comparison | |
| run: | | |
| cat <<EOL > Expected-1.csv | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,255,0,0,0,0,0,255,0,0,255,0,0,0 | |
| 0,0,0,255,0,0,0,0,0,0,0,0,255,0,0,0 | |
| 0,0,0,255,255,255,0,0,0,255,0,0,255,0,0,0 | |
| 0,0,0,255,0,0,255,0,0,255,0,0,255,0,0,0 | |
| 0,0,0,255,0,0,255,0,0,255,0,0,0,0,0,0 | |
| 0,0,0,255,0,0,255,0,0,255,0,0,255,0,0,0 | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| EOL | |
| cat <<EOL > Expected-2.csv | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,0,255,255,0,0,0,0,255,255,0,0,0,0 | |
| 0,0,0,0,255,255,0,0,0,0,255,255,0,0,0,0 | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,0,255,255,0,0,0,0,255,255,0,0,0,0 | |
| 0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0 | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 | |
| EOL | |
| sed -i 's/\r\{0,1\}$/\r/' Expected-1.csv Expected-2.csv | |
| cmp Frames-1.csv Expected-1.csv && \ | |
| cmp Frames-2.csv Expected-2.csv | |
| homethermometer-updater: | |
| name: Home thermometer updater | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - python-version: 3.11 | |
| - python-version: 3.14 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| - name: Set up Python | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| cache-dependency-path: tools/pyproject.toml | |
| - name: Set up Frekvens tools | |
| run: pip install tools/ | |
| - name: Set up HTTP server | |
| run: | | |
| python - << 'EOF' & | |
| import http.server | |
| class Test(http.server.BaseHTTPRequestHandler): | |
| def do_PATCH(self): | |
| self.send_response(202 if self.path == "/restful/Home%20thermometer" else 404) | |
| self.end_headers() | |
| http.server.HTTPServer(("127.0.0.1", 8080), Test).serve_forever() | |
| EOF | |
| sudo iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to-ports 8080 | |
| sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080 | |
| - name: Home thermometer updater | |
| run: python -m frekvens.HomeThermometerUpdater 127.0.0.1 --indoor=22 --outdoor=8 | |
| mode-switcher: | |
| name: Mode switcher | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - python-version: 3.11 | |
| - python-version: 3.14 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| - name: Set up Python | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| cache-dependency-path: tools/pyproject.toml | |
| - name: Set up Frekvens tools | |
| run: pip install tools/ | |
| - name: Set up HTTP server | |
| run: | | |
| python - << 'EOF' & | |
| import http.server | |
| class Test(http.server.BaseHTTPRequestHandler): | |
| def do_PATCH(self): | |
| self.send_response(202 if self.path == "/restful/Modes" else 404) | |
| self.end_headers() | |
| http.server.HTTPServer(("127.0.0.1", 8080), Test).serve_forever() | |
| EOF | |
| sudo iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to-ports 8080 | |
| sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080 | |
| - name: Mode switcher | |
| run: python -m frekvens.ModeSwitcher 127.0.0.1 --mode=Test | |
| x509_crt_bundle: | |
| name: x509 certificate bundle | |
| needs: platformio | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - python-version: 3.11 | |
| - python-version: 3.13 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| - name: Set up Python | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| cache-dependency-path: | | |
| .github/platformio/requirements.txt | |
| scripts/requirements.txt | |
| - name: Set up PlatformIO | |
| run: pip install -r .github/platformio/requirements.txt | |
| - name: Set up Cache | |
| continue-on-error: true | |
| uses: actions/cache@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1 | |
| with: | |
| key: platformio-cache-${{ runner.os }}-${{ runner.arch }}-${{ needs.platformio.outputs.version }}-${{ hashFiles('platformio.ini') }} | |
| path: | | |
| .platformio/.cache/downloads | |
| .platformio/.cache/http | |
| - name: Remove platformio.ini lib_deps | |
| continue-on-error: true | |
| run: | | |
| sed -i '/(?:arduino-irremote\/IRremote)|(?:Arduino-IRremote\/Arduino-IRremote)/d' platformio.ini | |
| sed -i '/bertmelis\/espMqttClient/d' platformio.ini | |
| sed -i '/(?:makuna\/RTC)|(?:Makuna\/Rtc)/d' platformio.ini | |
| sed -i '/vintlabs\/FauxmoESP/d' platformio.ini | |
| - name: PlatformIO build | |
| continue-on-error: true | |
| run: | | |
| cat <<EOL > .env | |
| HOSTNAME='frekvens' | |
| IKEA_FREKVENS='true' | |
| MODE_GOOGLEWEATHER='true' | |
| MODE_OPENMETEO='true' | |
| MODE_OPENWEATHER='true' | |
| MODE_WORLDWEATHERONLINE='true' | |
| MODE_WTTRIN='true' | |
| MODE_YR='true' | |
| NAME='Frekvens' | |
| EOL | |
| cat <<EOL > firmware/include/config/secrets.h | |
| #pragma once | |
| #define GOOGLEWEATHER_KEY "redacted" | |
| #define LATITUDE "0.000" | |
| #define LONGITUDE "0.000" | |
| #define OPENWEATHER_KEY "redacted" | |
| #define PIN_CS 1 | |
| #define PIN_MOSI 2 | |
| #define PIN_OE 3 | |
| #define PIN_SCLK 4 | |
| #define WIFI_KEY "redacted" | |
| #define WIFI_SSID "redacted" | |
| #define WORLDWEATHERONLINE_KEY "redacted" | |
| EOL | |
| pio run -e esp32dev | |
| - name: Checkout espressif/esp-idf | |
| uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1 | |
| with: | |
| repository: espressif/esp-idf | |
| ref: release/v5.5 | |
| path: lib/esp-idf | |
| sparse-checkout: components/mbedtls/esp_crt_bundle/gen_crt_bundle.py | |
| sparse-checkout-cone-mode: false | |
| - name: Bundle comparison | |
| run: | | |
| python lib/esp-idf/components/mbedtls/esp_crt_bundle/gen_crt_bundle.py -i firmware/certs/bundle && \ | |
| cmp x509_crt_bundle firmware/embed/x509_crt_bundle.bin |