2022-03-02 16:43:27 +01:00
|
|
|
name: build
|
2021-10-05 16:41:11 +02:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
tags:
|
|
|
|
- v*
|
|
|
|
pull_request:
|
|
|
|
release:
|
|
|
|
types: [published]
|
2021-03-14 15:34:37 +01:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-03-11 05:40:15 +01:00
|
|
|
- uses: actions/checkout@v3
|
2021-03-14 15:34:37 +01:00
|
|
|
- name: Cache pip
|
2023-03-11 05:42:11 +01:00
|
|
|
uses: actions/cache@v3
|
2021-03-14 15:34:37 +01:00
|
|
|
with:
|
|
|
|
path: ~/.cache/pip
|
|
|
|
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-pip-
|
|
|
|
- name: Cache PlatformIO
|
2023-03-11 05:42:11 +01:00
|
|
|
uses: actions/cache@v3
|
2021-03-14 15:34:37 +01:00
|
|
|
with:
|
|
|
|
path: ~/.platformio
|
|
|
|
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
|
|
|
|
- name: Set up Python
|
2023-03-11 05:42:25 +01:00
|
|
|
uses: actions/setup-python@v4
|
2021-03-14 15:34:37 +01:00
|
|
|
- name: Install PlatformIO
|
|
|
|
run: |
|
|
|
|
python -m pip install --upgrade pip
|
|
|
|
pip install --upgrade platformio
|
2021-04-03 17:17:04 +02:00
|
|
|
pio platform update
|
2021-03-20 03:22:25 +01:00
|
|
|
pio run -t clean
|
2022-08-29 19:14:25 +02:00
|
|
|
- name: Setup github_head_sha
|
|
|
|
run: echo "GITHUB_HEAD_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
|
|
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
|
|
- name: Set pr env
|
|
|
|
run: echo "PLATFORMIO_BUILD_FLAGS=-DBRANCH='\"${GITHUB_HEAD_REF}\"' -DVERSION='\"${GITHUB_HEAD_SHA::7}\"'" >> $GITHUB_ENV
|
|
|
|
if: ${{ github.event_name == 'pull_request' }}
|
|
|
|
- name: Set rel env
|
2021-03-20 03:22:25 +01:00
|
|
|
run: echo "PLATFORMIO_BUILD_FLAGS=-DVERSION='\"${GITHUB_REF#refs/*/}\"'" >> $GITHUB_ENV
|
2021-09-28 16:03:24 +02:00
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
2021-03-14 15:34:37 +01:00
|
|
|
- name: Run PlatformIO
|
2022-07-31 06:49:57 +02:00
|
|
|
run: pio run -e esp32 -e esp32c3 -e esp32-verbose -e m5stickc -e m5stickc-plus -e m5atom -e macchina-a0
|
2021-03-14 15:34:37 +01:00
|
|
|
- name: Rename firmware
|
|
|
|
run: |
|
|
|
|
cp .pio/build/esp32/firmware.bin esp32.bin
|
2022-07-31 06:49:57 +02:00
|
|
|
cp .pio/build/esp32c3/firmware.bin esp32c3.bin
|
2021-08-20 14:42:37 +02:00
|
|
|
cp .pio/build/esp32-verbose/firmware.bin esp32-verbose.bin
|
2021-03-14 15:34:37 +01:00
|
|
|
cp .pio/build/m5stickc/firmware.bin m5stickc.bin
|
|
|
|
cp .pio/build/m5stickc-plus/firmware.bin m5stickc-plus.bin
|
2022-07-31 06:49:57 +02:00
|
|
|
cp .pio/build/m5atom/firmware.bin m5atom.bin
|
|
|
|
cp .pio/build/macchina-a0/firmware.bin macchina-a0.bin
|
2022-02-10 13:09:56 +01:00
|
|
|
|
2022-07-31 06:49:57 +02:00
|
|
|
#Deprecated
|
|
|
|
cp .pio/build/m5atom/firmware.bin m5atom-matrix.bin
|
|
|
|
cp .pio/build/m5atom/firmware.bin m5atom-matrix-sensors.bin
|
|
|
|
cp .pio/build/esp32/firmware.bin adafruit-huzzah32.bin
|
|
|
|
cp .pio/build/esp32/firmware.bin adafruit-huzzah32-sensors.bin
|
2022-02-10 13:09:56 +01:00
|
|
|
|
2022-07-31 06:49:57 +02:00
|
|
|
#Deprecated Sensors
|
|
|
|
cp .pio/build/esp32/firmware.bin esp32-sensors.bin
|
|
|
|
cp .pio/build/esp32-verbose/firmware.bin esp32-verbose-sensors.bin
|
|
|
|
cp .pio/build/m5stickc/firmware.bin m5stickc-sensors.bin
|
|
|
|
cp .pio/build/m5stickc-plus/firmware.bin m5stickc-plus-sensors.bin
|
2021-03-14 15:34:37 +01:00
|
|
|
- name: Release
|
|
|
|
uses: softprops/action-gh-release@v1
|
2021-09-28 16:03:24 +02:00
|
|
|
if: startsWith(github.ref, 'refs/tags/v')
|
2021-03-14 15:34:37 +01:00
|
|
|
with:
|
|
|
|
files: "*.bin"
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2021-11-05 23:39:59 +01:00
|
|
|
- name: Archive Build
|
|
|
|
uses: kittaakos/upload-artifact-as-is@v0
|
|
|
|
with:
|
|
|
|
path: ./*.bin
|