Lora interface + repeater service, client subscription to log notific… #89
This file contains 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: PlatformIO CI | |
on: [push] | |
jobs: | |
# generate workspace artifact that will be used by next job to build firmware | |
workspace_setup: | |
name: Generate workspace | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
env: | |
LIB_NAME: esp32-toolkit-lib | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: Cache pip | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Cache PlatformIO | |
uses: actions/cache@v2 | |
with: | |
path: ~/.platformio | |
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
- name: Install PlatformIO | |
run: | | |
python -m pip install --upgrade pip | |
pip install --upgrade platformio | |
- name: Setup PlatformIO project | |
run: | | |
pio init --board esp32doit-devkit-v1 | |
# cd lib/ && git clone [email protected]/GITHUB_REPOSITORY | |
- uses: actions/checkout@v3 | |
with: | |
# fetch-depth: 0 | |
path: lib/${{ env.LIB_NAME }} | |
- name: Configure workspace | |
env: | |
MKLITTLEFS_BIN_URL: "https://github.com/earlephilhower/mklittlefs/releases/download/3.0.0/x86_64-linux-gnu-mklittlefs-295fe9b.tar.gz" | |
DIGIPOT_LIB_URL: "https://electropeak.com/learn/wp-content/uploads/2021/02/DigiPotX9Cxxx.zip" | |
run: | | |
rm platformio.ini # remove default pio config to allow symlink to custom config later | |
# @todo check if sym link can be included in workspace artifact | |
# rm platformio.ini && ln -s lib/$LIB_NAME/.config/platformio.ini platformio.ini | |
# ln -s lib/$LIB_NAME/.config/.gitmodules .gitmodules | |
# ln -s lib/$LIB_NAME/.config/scripts/replace_fs.py replace_fs.py | |
# ln -s ../lib/$LIB_NAME/.config/main.cpp src/main.cpp | |
cd lib/$LIB_NAME && git remote set-url origin [email protected]:$GITHUB_REPOSITORY.git | |
cd /home/runner/work/ | |
wget -O mklittlefs.tar.gz $MKLITTLEFS_BIN_URL && tar -xf mklittlefs.tar.gz && mv mklittlefs/mklittlefs $GITHUB_WORKSPACE | |
wget $DIGIPOT_LIB_URL && unzip DigiPotX9Cxxx.zip && mv DigiPotX9Cxxx/ $GITHUB_WORKSPACE/lib/ | |
ls -laR $GITHUB_WORKSPACE | |
- name: Workspace artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: pio-workspace-artifact | |
path: | | |
./ | |
# This job retrieve workspace artifact from previous job and builds firmware | |
build_firmware: | |
name: Build firmware | |
needs: workspace_setup | |
runs-on: ubuntu-latest | |
env: | |
LIB_NAME: esp32-toolkit-lib | |
PIO_ENV_CONF: esp32-latest | |
FIRMWARE_SRC: firmware-main.cpp # firmware source file to build | |
steps: | |
- name: Retrieve workspace artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: pio-workspace-artifact | |
- name: Create symlinks | |
run: | | |
ln -s lib/esp32-toolkit-lib/.config/platformio.ini platformio.ini | |
ln -s lib/esp32-toolkit-lib/.config/.gitmodules .gitmodules | |
ln -s lib/esp32-toolkit-lib/.config/scripts/replace_fs.py replace_fs.py | |
mkdir src && ln -s ../lib/esp32-toolkit-lib/examples/firmware-main.cpp src/main.cpp | |
- name: Show final workspace structure | |
run: | | |
# cat platformio.ini | |
ls -laR | |
- name: Install PlatformIO | |
run: | | |
python -m pip install --upgrade pip | |
pip install --upgrade platformio | |
- name: Build project | |
run: | | |
# link to selected firmware source file | |
rm src/main.cpp && ln -s ../lib/$LIB_NAME/examples/$FIRMWARE_SRC src/main.cpp | |
pio run -e $PIO_ENV_CONF | |
- name: Firmware artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: firmware-release | |
path: | | |
.pio/build/${{ env.PIO_ENV_CONF }}/firmware.bin |