Skip to content

Commit

Permalink
Fix CI by using separate action to install PlatformIO environment
Browse files Browse the repository at this point in the history
*  Use action from [micro_ros_platformio](https://github.com/micro-ROS/micro_ros_platformio/tree/main) to install PlatformIO in workflow runner.

* Removes hacky and problematic  workarounds from workflow (manually messing with `.platformio` and `penv`, python install).

(cherry picked from commit fc39599)
  • Loading branch information
atticusrussell authored and mergify[bot] committed Nov 13, 2023
1 parent 105a2b0 commit 04b22bf
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 27 deletions.
15 changes: 15 additions & 0 deletions .github/actions/platformio-env/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: 'platformio-env'
description: 'Install Platform.IO environment'
runs:
using: "composite"
steps:
- id: install-platformio-env
shell: bash
run: |
sudo apt-get update
export DEBIAN_FRONTEND=noninteractive
sudo apt-get install -y git curl python3 python3-pip python3-venv git cmake
curl -fsSL -o get-platformio.py https://raw.githubusercontent.com/platformio/platformio-core-installer/master/get-platformio.py
python3 get-platformio.py
echo 'export PATH=$PATH:~/.platformio/penv/bin' >> ~/.bashrc
39 changes: 12 additions & 27 deletions .github/workflows/reusable-platformio-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.reference }}
path: repo

# Cache dependencies to speed up workflows
- uses: actions/cache@v3
Expand All @@ -36,16 +37,13 @@ jobs:
~/.platformio/.cache
key: ${{ runner.os }}-pio

- uses: actions/setup-python@v4
with:
python-version: '3.9'

- name: Install PlatformIO Core
run: pip install --upgrade platformio
- name: Install environment
uses: ./repo/.github/actions/platformio-env

- name: Build Calibration
run: |
cd calibration
export PATH=$PATH:~/.platformio/penv/bin
cd repo/calibration
pio run
Expand Down Expand Up @@ -93,38 +91,25 @@ jobs:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.reference }}
path: repo

# speed up workflows by caching dependencies
# Cache dependencies to speed up workflows
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio

- uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Install PlatformIO Core
run: pip3 install --upgrade platformio

- name: Initialize Platformio, manually create .platformio and penv if needed
run: |
pio --version
if [ ! -d ~/.platformio ]; then
mkdir ~/.platformio
fi
if [ ! -d ~/.platformio/penv ]; then
cd ~/.platformio
python3 -m venv penv
fi
- name: Install environment
uses: ./repo/.github/actions/platformio-env

# Build the firmware for each environment in parallel
- name: Build Firmware
env:
ROS_DISTRO: ${{ inputs.ros_distro }}
shell: bash
run: |
cd firmware
export PATH=$PATH:~/.platformio/penv/bin
cd repo/firmware
pio run -e ${{ matrix.env }}

0 comments on commit 04b22bf

Please sign in to comment.