added web service to proxy downloads. added logging to FW downloader.… #76
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: CI | |
| on: | |
| # Triggers the workflow on push or pull request events but only for the master branch | |
| push: | |
| branches: [master] | |
| tags: ["v*.*.*"] | |
| pull_request: | |
| branches: [master] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
| - uses: actions/checkout@v2 | |
| # ensure we have the python version required for Platform IO. | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| # for CI builds. edit version.h to contain the branch name | |
| - name: write version.h | |
| run: | | |
| export BRANCH_OR_TAG=${GITHUB_REF#refs/*/} | |
| cat firmware/include/version.h | |
| echo BRANCH_OR_TAG | |
| echo "#define VERSION \"${BRANCH_OR_TAG}\"" > firmware/include/version.h | |
| cat firmware/include/version.h | |
| - name: Install PlatformIO Core | |
| run: pip install --upgrade platformio | |
| - name: Build PlatformIO Project | |
| run: | | |
| mkdir output | |
| cd firmware | |
| pio run | |
| pio run -t buildfs | |
| cp .pio/build/featheresp32/firmware.bin ../output/firmware.bin | |
| cp .pio/build/featheresp32/firmware.elf ../output/firmware.elf | |
| cp .pio/build/featheresp32/spiffs.bin ../output/spiffs.bin | |
| # Build the machine-readable metadata block that the web app reads out of | |
| # the release body (no extra per-release download). The fs hash must match | |
| # the device-side sha256 of the raw SPIFFS partition. | |
| - name: Build release metadata | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| FS_SHA=$(sha256sum output/spiffs.bin | awk '{print $1}') | |
| FS_SIZE=$(stat -c%s output/spiffs.bin) | |
| BRANCH_OR_TAG=${GITHUB_REF#refs/*/} | |
| { | |
| echo "Del Sol Clock firmware ${BRANCH_OR_TAG}." | |
| echo "" | |
| echo "<!-- delsol-meta" | |
| echo "{\"proto\":2,\"app\":\"${BRANCH_OR_TAG}\",\"fsSha256\":\"${FS_SHA}\",\"fsSize\":${FS_SIZE}}" | |
| echo "-->" | |
| } > output/release_body.md | |
| echo "Release body:" | |
| cat output/release_body.md | |
| # publish tags as releases. | |
| - name: Release | |
| uses: softprops/action-gh-release@v1 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| # firmware.elf is for debugging; the web app reads firmware.bin + spiffs.bin. | |
| files: | | |
| output/firmware.bin | |
| output/firmware.elf | |
| output/spiffs.bin | |
| body_path: output/release_body.md |