CI: Run builds for individual firmwares only on corresponding changes #19
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Run workflow, step, or job based on file changes GitHub Actions | |
# https://how.wtf/run-workflow-step-or-job-based-on-file-changes-github-actions.html | |
# | |
# GitHub Actions run on certain file type change | |
# https://www.scivision.dev/github-actions-selective-run/ | |
# | |
# GitHub Actions configuration for PlatformIO | |
# https://docs.platformio.org/en/stable/integration/ci/github-actions.html | |
# | |
name: PlatformIO CI | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- "**.cpp" | |
- "**.h" | |
- "**.ini" | |
- "**.ino" | |
- "**.yaml" | |
pull_request: | |
branches: [ main ] | |
paths: | |
- "**.cpp" | |
- "**.h" | |
- "**.ini" | |
- "**.ino" | |
- "**.yaml" | |
# Allow job to be triggered manually. | |
workflow_dispatch: | |
# Cancel in-progress jobs when pushing to the same branch. | |
concurrency: | |
cancel-in-progress: true | |
group: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
changes: | |
runs-on: ubuntu-latest | |
outputs: | |
scale-adjust: ${{ steps.changes.outputs.scale-adjust }} | |
node-gprs-http: ${{ steps.changes.outputs.node-gprs-http }} | |
node-wifi-mqtt: ${{ steps.changes.outputs.node-wifi-mqtt }} | |
node-esp8266-generic: ${{ steps.changes.outputs.node-esp8266-generic }} | |
node-esp32-generic: ${{ steps.changes.outputs.node-esp32-generic }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dorny/paths-filter@v2 | |
id: changes | |
with: | |
filters: | | |
scale-adjust: | |
- 'scale-adjust/**' | |
node-gprs-http: | |
- 'node-gprs-http/**' | |
node-wifi-mqtt: | |
- 'node-wifi-mqtt/**' | |
node-esp8266-generic: | |
- 'node-esp8266-generic/**' | |
node-esp32-generic: | |
- 'node-esp32-generic/**' | |
build: | |
needs: changes | |
runs-on: ubuntu-latest | |
steps: | |
- name: Acquire sources | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- name: Cache PlatformIO | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
~/.platformio/.cache | |
~/.pio | |
key: ${{ runner.os }}-pio | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
cache: 'pip' | |
cache-dependency-path: | | |
requirements*.txt | |
- name: Install PlatformIO | |
run: | | |
pip install --upgrade --requirement requirements-test.txt | |
- name: Build scale-adjust / ADS1231 | |
if: ${{ needs.changes.outputs.scale-adjust == 'true' }} | |
run: | | |
pio run --project-dir scale-adjust/ADS1231 | |
- name: Build scale-adjust / HX711 | |
if: ${{ needs.changes.outputs.scale-adjust == 'true' }} | |
run: | | |
pio run --project-dir scale-adjust/HX711 | |
- name: Build node-gprs-http | |
if: ${{ needs.changes.outputs.node-gprs-http == 'true' }} | |
run: | | |
pio run --project-dir node-gprs-http | |
- name: Build node-wifi-mqtt | |
if: ${{ needs.changes.outputs.node-wifi-mqtt == 'true' }} | |
run: | | |
pio run --project-dir node-wifi-mqtt | |
- name: Build node-esp8266-generic | |
if: ${{ needs.changes.outputs.node-esp8266-generic == 'true' }} | |
run: | | |
pio run --project-dir node-esp8266-generic | |
- name: Build node-esp32-generic | |
if: ${{ needs.changes.outputs.node-esp32-generic == 'true' }} | |
run: | | |
pio run --project-dir node-esp32-generic |