fix: replace per-tick EMA with true hourly mean for consumption stats #199
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: Build Sonnen SmartSwitch Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| WORKDIR: smartswitch.espxx | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ${{ env.WORKDIR }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| with: | |
| # Install a specific version of uv. | |
| version: "0.10.9" | |
| - name: Cache dependencies | |
| uses: actions/cache@v5 | |
| with: | |
| path: /tmp/.uv-cache | |
| key: uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | |
| restore-keys: | | |
| uv-${{ runner.os }}-${{ hashFiles('uv.lock') }} | |
| uv-${{ runner.os }} | |
| - name: Install the project | |
| run: | |
| uv sync --locked --all-extras --dev | |
| - name: Run Tests | |
| run: | |
| uv run pio test -e native | |
| - name: Build ESP32 and ESP8266 firmware | |
| run: | |
| uv run pio run -e esp32 -e esp8266 | |
| - name: Minimize uv cache | |
| run: | |
| uv cache prune --ci | |
| - name: Rename firmware files | |
| run: | | |
| mv .pio/build/esp8266/firmware.bin .pio/build/smartswitch.esp8266.ino.bin | |
| mv .pio/build/esp32/firmware.bin .pio/build/smartswitch.esp32.ino.bin | |
| gzip -9 -k .pio/build/smartswitch.esp8266.ino.bin | |
| gzip -9 -k .pio/build/smartswitch.esp32.ino.bin | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: smartswitch-artifacts | |
| path: | | |
| ${{ env.WORKDIR }}/.pio/build/smartswitch.esp8266.ino.bin.gz | |
| ${{ env.WORKDIR }}/.pio/build/smartswitch.esp32.ino.bin | |
| retention-days: 1 # delete after build | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Download build artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: smartswitch-artifacts | |
| path: . | |
| - name: Create Release | |
| id: create_release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| tag: v${{ github.run_number }} | |
| name: Release ${{ github.run_number }} | |
| body: Automatically generated release ${{ github.run_number }} | |
| draft: false | |
| prerelease: false | |
| artifactContentType: "application/gzip" | |
| artifacts: | | |
| smartswitch.esp8266.ino.bin.gz | |
| smartswitch.esp32.ino.bin |