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

CI for each ROS distro branch #45

Merged
merged 4 commits into from
Aug 26, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
35 changes: 35 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
pull_request_rules:
- name: Backport to Humble at reviewer's discretion
conditions:
- base=master
- "label=backport-humble"
actions:
backport:
branches:
- humble

- name: Backport to Galactic at reviewer's discretion
conditions:
- base=master
- "label=backport-galactic"
actions:
backport:
branches:
- galactic

- name: Backport to Foxy at reviewer's discretion
conditions:
- base=master
- "label=backport-foxy"
actions:
backport:
branches:
- foxy

- name: Ask to resolve conflict
conditions:
- conflict
- author!=mergify
actions:
comment:
message: This pull request is in conflict. Could you fix it @{{author}}?
41 changes: 41 additions & 0 deletions .github/workflows/foxy-firmware-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: ROS Foxy Firmware Build

on:
pull_request:
# Run on PRs only to branches starting with 'foxy'
branches:
- foxy*
# Don't run when the following files are changed which don't effect firmware.
paths-ignore:
- 'docs/**'
- .gitignore
- LICENSE
- README.md

push:
# Run on pushes only to branches starting with 'foxy'
branches:
- foxy*
# Don't run when the following files are changed which don't effect firmware.
paths-ignore:
- 'docs/**'
- .gitignore
- LICENSE
- README.md

# Run daily at midnight to detect flakiness and broken dependencies
schedule:
- cron: '0 0 * * *'

# Allow manual triggering
workflow_dispatch:


jobs:
firmware:
# The current file calls the firmware workflow with the following parameters
uses: ./.github/workflows/reusable-platformio-ci.yml
with:
ros_distro: foxy
# The reference field will be set to 'foxy' only if the event that triggered the workflow is schedule. Otherwise, it will be left blank.
reference: ${{ github.event_name == 'schedule' && 'foxy' || '' }}
41 changes: 41 additions & 0 deletions .github/workflows/galactic-firmware-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: ROS Galactic Firmware Build

on:
pull_request:
# Run on PRs only to branches starting with 'galactic'
branches:
- galactic*
# Don't run when the following files are changed which don't effect firmware.
paths-ignore:
- 'docs/**'
- .gitignore
- LICENSE
- README.md

push:
# Run on pushes only to branches starting with 'galactic'
branches:
- galactic*
# Don't run when the following files are changed which don't effect firmware.
paths-ignore:
- 'docs/**'
- .gitignore
- LICENSE
- README.md

# Run daily at midnight to detect flakiness and broken dependencies
schedule:
- cron: '0 0 * * *'

# Allow manual triggering
workflow_dispatch:


jobs:
firmware:
# The current file calls the firmware workflow with the following parameters
uses: ./.github/workflows/reusable-platformio-ci.yml
with:
ros_distro: galactic
# The reference field will be set to 'galactic' only if the event that triggered the workflow is schedule. Otherwise, it will be left blank.
reference: ${{ github.event_name == 'schedule' && 'galactic' || '' }}
41 changes: 41 additions & 0 deletions .github/workflows/humble-firmware-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: ROS Humble Firmware Build

on:
pull_request:
# Run on PRs only to branches starting with 'humble'
branches:
- humble*
# Don't run when the following files are changed which don't effect firmware.
paths-ignore:
- 'docs/**'
- .gitignore
- LICENSE
- README.md

push:
# Run on pushes only to branches starting with 'humble'
branches:
- humble*
# Don't run when the following files are changed which don't effect firmware.
paths-ignore:
- 'docs/**'
- .gitignore
- LICENSE
- README.md

# Run daily at midnight to detect flakiness and broken dependencies
schedule:
- cron: '0 0 * * *'

# Allow manual triggering
workflow_dispatch:


jobs:
firmware:
# The current file calls the firmware workflow with the following parameters
uses: ./.github/workflows/reusable-platformio-ci.yml
with:
ros_distro: humble
# The reference field will be set to 'humble' only if the event that triggered the workflow is schedule. Otherwise, it will be left blank.
reference: ${{ github.event_name == 'schedule' && 'humble' || '' }}
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
name: PlatformIO CI
name: Reusable PlatformIO CI

# Controls when this action will run.
on:
push:
pull_request:
workflow_dispatch:
workflow_call:
inputs:
ros_distro:
description: 'ROS_DISTRO variable'
required: true
type: string

reference:
description: 'Branch or tag of repo to checkout for build.'
default: ''
required: false
type: string


jobs:
# This job is used to build the calibration firmware
Expand All @@ -15,6 +25,8 @@ jobs:
steps:
# Check out the repository
- uses: actions/checkout@v3
with:
ref: ${{ inputs.reference }}

# Cache dependencies to speed up workflows
- uses: actions/cache@v3
Expand Down Expand Up @@ -47,13 +59,16 @@ jobs:
steps:
# check out the repository
- uses: actions/checkout@v3
with:
ref: ${{ inputs.reference }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'

# run the python script to parse the platformio.ini file and output as json to a matrix
# pass the ros distros desired as arguments
- name: Parse platformio.ini
id: set-matrix
run: |
Expand All @@ -65,7 +80,7 @@ jobs:
# require the pio-fw-matrix job to complete before running
needs: pio-fw-matrix
runs-on: ubuntu-latest
name: Build ${{ matrix.env }} firmware
name: Build ${{ matrix.env }} firmware on ROS ${{ inputs.ros_distro }}
strategy:
# don't stop all jobs if one fails
fail-fast: false
Expand All @@ -76,6 +91,8 @@ jobs:
steps:
# Check out the repository
- uses: actions/checkout@v3
with:
ref: ${{ inputs.reference }}

# speed up workflows by caching dependencies
- uses: actions/cache@v3
Expand All @@ -87,30 +104,27 @@ jobs:

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

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

- name: Install PIO in Home
run: |
python3 -c "$(curl -fsSL https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platformio.py)"
echo "PATH=\"\$PATH:\$HOME/.platformio/penv/bin\"" >> $HOME/.bashrc
source $HOME/.bashrc
run: pip3 install --upgrade platformio

# NOTE all req. PIO pip packages should already be installed, but found these to be necessary
# Missing packages determined from error messages
- name: Install required pip packages
- name: Initialize Platformio, manually create .platformio and penv if needed
run: |
source $HOME/.platformio/penv/bin/activate
pip install --upgrade catkin_pkg
pip uninstall em
pip install empy lark

pio --version
if [ ! -d ~/.platformio ]; then
mkdir ~/.platformio
fi

if [ ! -d ~/.platformio/penv ]; then
cd ~/.platformio
python3 -m venv penv
fi

# Build the firmware for each environment in parallel
- name: Build Firmware
env:
ROS_DISTRO: rolling
ROS_DISTRO: ${{ inputs.ros_distro }}
run: |
cd firmware
pio run -e ${{ matrix.env }}
48 changes: 48 additions & 0 deletions .github/workflows/rolling-firmware-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: ROS Rolling Firmware Build

# Get the default branch name from the repository settings
env:
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}

on:
pull_request:
# Run only on PRs to the default branch (usually main or master)
branches:
- DEFAULT_BRANCH
# Don't run when the following files are changed which don't effect firmware.
paths-ignore:
- 'docs/**'
- .gitignore
- LICENSE
- README.md

push:
# Run on pushes to any branches except these distro-specific branches
branches-ignore:
- iron*
- humble*
- galactic*
- foxy*
# Don't run when the following files are changed which don't effect firmware.
paths-ignore:
- 'docs/**'
- .gitignore
- LICENSE
- README.md

# Run daily at midnight to detect flakiness and broken dependencies
schedule:
- cron: '0 0 * * *'

# Allow manual triggering
workflow_dispatch:


jobs:
firmware:
# The current file calls the firmware workflow with the following parameters
uses: ./.github/workflows/reusable-platformio-ci.yml
with:
ros_distro: rolling
# The reference field will be set to the default branch only if the event that triggered the workflow is schedule. Otherwise, it will be left blank.
reference: ${{ github.event_name == 'schedule' && github.event.repository.default_branch || '' }}
9 changes: 9 additions & 0 deletions README.md
atticusrussell marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
## Build status
<!-- Build Status populated by Github Actions runs -->
ROS 2 Distro | Branch | Build status
:----------: | :----: | :----------:
**Rolling** | [`master`](../../tree/master) | [![Rolling Firmware Build](../../actions/workflows/rolling-firmware-build.yml/badge.svg?branch=master)](../../actions/workflows/rolling-firmware-build.yml?branch=master)
**Humble** | [`humble`](../../tree/humble) | [![Humble Firmware Build](../../actions/workflows/humble-firmware-build.yml/badge.svg?branch=humble)](../../actions/workflows/humble-firmware-build.yml?branch=humble)
**Galactic** | [`galactic`](../../tree/galactic) | [![Galactic Firmware Build](../../actions/workflows/galactic-firmware-build.yml/badge.svg?branch=galactic)](../../actions/workflows/galactic-firmware-build.yml?branch=galactic)
**Foxy** | [`foxy`](../../tree/foxy) | [![Foxy Firmware Build](../../actions/workflows/foxy-firmware-build.yml/badge.svg?branch=foxy)](../../actions/workflows/foxy-firmware-build.yml?branch=foxy)

## Installation
All software mentioned in this guide must be installed on the robot computer.

Expand Down