Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Continous Integration Build of Firmware Artifacts & Fix Build Script #65

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/firmware.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Basic continuous integration for firmware
# Copyright 2024 Lea Calot
#
# @author Lea Calot
name: BuildFirmware
on:
push:
branches: [ ]
tags:
- 'v*'
workflow_dispatch:

permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install Python requirements
run: |
pip install -r requirements.txt
- name: Perform firmware build
run: |
pio run
- name: Upload firmware artifact
uses: actions/upload-artifact@v4
with:
name: FirmwareBinary
path: ./.pio/build/*
if-no-files-found: error
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# ESP32 SvelteKit - Create Amazing IoT Projects
![Firmware Build](../../actions/workflows/firmware.yaml/badge.svg)

<div style="flex">
<img src="/docs/media/Screenshot_light.png" style="height:320px">
Expand Down
14 changes: 14 additions & 0 deletions docs/buildprocess.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

The build process is controlled by [platformio.ini](https://github.com/theelims/ESP32-sveltekit/platformio.ini) and automates the build of the front end website with Vite as well as the binary compilation for the ESP32 firmware. Whenever PlatformIO is building a new binary it will call the python script [build_interface.py](https://github.com/theelims/ESP32-sveltekit/scripts/build_interface.py) to action. It will check the frontend files for changes. If necessary it will start the Vite build and gzip the resulting files either to the `data/` directory or embed them into a header file. In case the WWW files go into a LITTLEFS partition a file system image for the flash is created for the default build environment and upload to the ESP32.

All required Python packages are listed under [requirements.txt](../requirements.txt). To install platformio and these packages in a python virtual environment, use:

```bash
# Linux
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt

# Windows
python -m venv venv
call venv\Scripts\activate.bat
pip install -r requirements.txt
```

## Changing the JS package manager

This project uses NPM as the default package manager. However, many users might have different preferences and like to use YARN or PNPM instead. Just switch the interface to one of the other package managers. The build script identify the package manager by the presence of its lock-file and start the vite build process accordingly.
Expand Down
Loading