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

Fix CI by using separate action to install PlatformIO environment #73

Merged
merged 1 commit into from
Nov 13, 2023
Merged
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
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 }}