Skip to content

Refactor INI configuration #172

Refactor INI configuration

Refactor INI configuration #172

Workflow file for this run

name: Release Binaries
on:
workflow_dispatch:
release:
types:
- created
- prereleased
pull_request:
branches:
- master
- develop
paths:
- '.github/workflows/release.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build-bhaptics:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- bhaptics_tactsuit_x16
- bhaptics_tactsuit_x16_pca9685
- bhaptics_tactsuit_x40
- bhaptics_tactosy2_forearm_left
- bhaptics_tactosy2_forearm_right
- bhaptics_tactosyh_hand_left
- bhaptics_tactosyh_hand_right
- bhaptics_tactosyf_foot_left
- bhaptics_tactosyf_foot_right
- bhaptics_tactal
- bhaptics_tactvisor
- bhaptics_tactglove_left
- bhaptics_tactglove_right
battery_flag:
- SS_BATTERY_ENABLED=true
env:
PLATFORMIO_BUILD_FLAGS: >-
${{ matrix.battery_flag && format('-D {0}', matrix.battery_flag) || '' }}
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Get firmware name
id: firmware_name
run: python3 ./.github/scripts/get-firmware-name.py ${{ matrix.target }} ""
- name: Cache PlatformIO target
uses: actions/cache@v4
with:
path: |
./.pio/build/${{ matrix.target }}
key: ${{ runner.os }}-pio-${{ matrix.target }}-${{ steps.firmware_name.outputs.firmware }}-${{ hashFiles('**/*.ini') }}
restore-keys: |
${{ runner.os }}-pio-${{ matrix.target }}-${{ steps.firmware_name.outputs.firmware }}-
${{ runner.os }}-pio-${{ matrix.target }}-
${{ runner.os }}-pio-
- name: Setup PlatformIO
uses: ./.github/actions/setup-platformio
with:
build_cache_dir: ./.pio/build_cache
cache: 'pip cache build_cache'
- name: Install libs
shell: bash
run: |
pio pkg install -e ${{matrix.target}}
- name: Build
run: |
pio run --environment ${{matrix.target}} --target release-archive
unzip -l ./.pio/${{ matrix.target }}/build/firmware.zip
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: firmware-${{matrix.target}}
path: ./.pio/${{ matrix.target }}/build/firmware.zip
retention-days: 5
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'senseshift/senseshift-firmware'
with:
asset_name: ${{matrix.target}}.zip
file: ./build/firmware.zip
tag: ${{github.ref}}
build-opengloves:
if: github.repository == 'senseshift/senseshift-firmware'
runs-on: ubuntu-latest
strategy:
matrix:
target:
- lucidgloves-prototype3
- lucidgloves-prototype4
- lucidgloves-prototype4-ffb
- indexer-c
- indexer-cf
- indexer-cs
- indexer-csf
comm_flag:
- OPENGLOVES_COMMUNICATION=OPENGLOVES_COMM_SERIAL
- OPENGLOVES_COMMUNICATION=OPENGLOVES_COMM_BTSERIAL
env:
PLATFORMIO_BUILD_FLAGS: >-
${{ matrix.comm_flag && format('-D {0}', matrix.comm_flag) || '' }}
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Get firmware name
id: firmware_name
run: python3 ./.github/scripts/get-firmware-name.py ${{ matrix.target }} '${{ matrix.comm_flag }}'
- name: Cache PlatformIO target
uses: actions/cache@v4
with:
path: |
./.pio/build/${{ matrix.target }}
key: ${{ runner.os }}-pio-${{ matrix.target }}-${{ steps.firmware_name.outputs.firmware }}-${{ hashFiles('**/*.ini') }}
restore-keys: |
${{ runner.os }}-pio-${{ matrix.target }}-${{ steps.firmware_name.outputs.firmware }}-
${{ runner.os }}-pio-${{ matrix.target }}-
${{ runner.os }}-pio-
- name: Setup PlatformIO
uses: ./.github/actions/setup-platformio
with:
build_cache_dir: ./.pio/build_cache
cache: 'pip cache build_cache'
- name: Install libs
shell: bash
run: |
pio pkg install -e ${{matrix.target}}
- name: Update build command (non-Windows)
run: |
sed -i '/\[env\]/p; s/\[env\]/upload_protocol = custom/' platformio.ini
sed -i '/\[env\]/p; s/\[env\]/upload_command = \$PYTHONEXE .\/.github\/scripts\/create-release-archive.py \$FLASH_EXTRA_IMAGES \$ESP32_APP_OFFSET \$SOURCE/' platformio.ini
- name: Build
run: |
mkdir build
echo "::group::platformio.ini"
cat platformio.ini
echo "::endgroup::"
echo "::group::pio run"
pio run --environment ${{matrix.target}} --target upload
echo "::endgroup::"
unzip -l ./build/firmware.zip
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: firmware-${{ steps.firmware_name.outputs.firmware }}
path: ./build/firmware.zip
retention-days: 5
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
if: startsWith(github.ref, 'refs/tags/') && github.repository == 'senseshift/senseshift-firmware'
with:
asset_name: ${{ steps.firmware_name.outputs.firmware }}.zip
file: ./build/firmware.zip
tag: ${{github.ref}}