Skip to content

Commit

Permalink
Conditional build / test pipeline (OpenEPaperLink#287)
Browse files Browse the repository at this point in the history
* POC: Conditional Build Jobs / Steps

Demonstrate a built/test pipeline which make use of both conditional jobs and steps.

* use paths-filter fallback (no token)

* fix typo in cache key

* remove test file

* add in nRF_Bootloader to confitional build
  • Loading branch information
kelchm authored May 6, 2024
1 parent e4351c2 commit 1ec762f
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 54 deletions.
34 changes: 34 additions & 0 deletions .github/actions/setup-pio/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Setup PlatformIO
description: 'Installs PlatformIO and necessary dependencies.'

inputs:
python-version:
description: 'Set Python version (optional)'
required: false
default: '3.9'

runs:
using: "composite"
steps:
- name: Cache pip
id: cache-pip
uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-${{ inputs.python-version }}-pio

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}

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

- name: Install intelhex
shell: bash
run: pip install --upgrade intelhex

19 changes: 19 additions & 0 deletions .github/path-filters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
arm-tag_common: &arm-tag_common
- 'ARM_Tag_FW/common/**'

arm-tag_88MZ100:
- '*arm-tag_common'
- 'ARM_Tag_FW/88MZ100/**'

arm-tag_newton-m3-nrf52811:
- '*arm-tag_common'
- 'ARM_Tag_FW/Newton_M3_nRF52811/**'

arm-tag_nrf-bootloader:
- 'ARM_Tag_FW/nRF_Bootloader/**'

arm-tag_nrf52811-pio-ap:
- 'ARM_Tag_FW/nrf52811_Platformio_AP/**'

esp32-ap:
- 'ESP32_AP-Flasher/**'
54 changes: 0 additions & 54 deletions .github/workflows/build-test.yml

This file was deleted.

85 changes: 85 additions & 0 deletions .github/workflows/conditional-build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: FW Build / Test (Conditional Job PoC)

on: [push, pull_request]

jobs:
determine-builds:
name: Evaluate Required Builds
runs-on: ubuntu-20.04
timeout-minutes: 1
# Map a step output to job output
outputs:
arm-tag_newton-m3-nrf52811: ${{ steps.filter.outputs.arm-tag_newton-m3-nrf52811 }}
arm-tag_nrf-bootloader: ${{ steps.filter.outputs.arm-tag_nrf-bootloader }}
arm-tag_nrf52811-pio-ap: ${{ steps.filter.outputs.arm-tag_nrf52811-pio-ap }}
arm-tag_88MZ100: ${{ steps.filter.outputs.arm-tag_88MZ100 }}
esp32-ap: ${{ steps.filter.outputs.esp32-ap }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
# TODO: work around issue with paths-filter (https://github.com/dorny/paths-filter/issues/227)
token: ''
filters: .github/path-filters.yml

tag-build:
name: Build Tag FW
needs: [determine-builds]
runs-on: ubuntu-22.04
steps:
- name: Checkout Code (with submodules)
uses: actions/checkout@v4
with:
submodules: 'recursive'
- uses: ./.github/actions/setup-pio

- name: ARM_Tag_FW/nRF_Bootloader
if: ${{ needs.determine-builds.outputs.arm-tag_nrf-bootloader == 'true' }}
run: |
cd ARM_Tag_FW/nRF_Bootloader
pio run --environment nRFBootload
- name: ARM_Tag_FW/Newton_M3_nRF52811
if: ${{ needs.determine-builds.outputs.arm-tag_newton-m3-nrf52811 == 'true' }}
run: |
pio --version
cd ARM_Tag_FW/Newton_M3_nRF52811
pio run --environment Newton_M3_Universal
- name: ARM_Tag_FW/nrf52811_Platformio_AP
if: ${{ needs.determine-builds.outputs.arm-tag_nrf52811-pio-ap == 'true' }}
run: |
cd ARM_Tag_FW/nrf52811_Platformio_AP
pio run --environment nrf52811_OEPL_AP
- name: ARM_Tag_FW/88MZ100_OpenEpaperLink_7.4
if: ${{ needs.determine-builds.outputs.arm-tag_88MZ100 == 'true' }}
# TODO: Implement build for 88MZ100
run: |
echo "Note: build for 88MZ100 has not been implementted yet."
ap-build:
name: Build AP FW
needs: [determine-builds]
if: ${{ needs.determine-builds.outputs.esp32-ap == 'true' }}
strategy:
matrix:
environment:
- OpenEPaperLink_Mini_AP
- OpenEPaperLink_AP_and_Flasher
- ESP32_S3_16_8_YELLOW_AP
- OpenEPaperLink_Mini_AP_v4
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v4
- uses: ./.github/actions/setup-pio

- name: Build ${{ matrix.environment }}
run: |
cd ESP32_AP-Flasher
pio run --environment ${{ matrix.environment }}
pio run --target buildfs --environment ${{ matrix.environment }}

0 comments on commit 1ec762f

Please sign in to comment.