Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
karniv00l committed Nov 14, 2021
0 parents commit 2307622
Show file tree
Hide file tree
Showing 2 changed files with 109 additions and 0 deletions.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# PlatformIO Run

GitHub Action for PlatformIO Run.

## Usage

`.github/workflows/platformio-build.yml`

```yml
name: PlatformIO

on: pull_request

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: PlatformIO Run
- uses: karniv00l/[email protected]
with:
environments: "teensy35,teensy36,teensy41"
targets: "teensy35,teensy36,teensy41"
project-dir: "./some_dir"
project-conf: "./some_dir/custom.ini"
jobs: 6
silent: false
verbose: true
disable-auto-clean: false
```
78 changes: 78 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: PlatformIO Run
description: Run project targets over environments declared in platformio.ini
author: Piotr Rogowski <[email protected]>
branding:
icon: cpu
color: orange
inputs:
environments:
description: Process specified environments (comma separated).
required: false
targets:
description: Process specified targets (comma separated).
required: false
project-dir:
description: Specify the path to project directory. By default, project-dir is equal to current working directory (CWD).
required: false
project-conf:
description: Process project with a custom platformio.ini
required: false
jobs:
description: Control a number of parallel build jobs. Default is a number of CPUs in a system.
required: false
silent:
description: Suppress progress reporting.
required: false
verbose:
description: Shows detailed information when processing environments.
required: false
disable-auto-clean:
description: Disable auto-clean of build_dir when platformio.ini or src_dir (project structure) have been modified.
required: false

runs:
using: composite
steps:
- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v2
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v2
- name: Install PlatformIO
shell: bash
run: |
python -m pip install --upgrade pip
pip install --upgrade platformio
- name: Run PlatformIO
shell: bash
run: |
environments=${{ inputs.environments }}
targets=${{ inputs.targets }}
project_dir=${{ inputs.project-dir }}
project_conf=${{ inputs.project-conf }}
jobs=${{ inputs.jobs }}
silent=${{ inputs.silent }}
verbose=${{ inputs.verbose }}
disable_auto_clean=${{ inputs.disable-auto-clean }}
args=()
if [ -n "$environments" ]; then args+=("--environment ${environments//,/ -e }"); fi
if [ -n "$targets" ]; then args+=("--target ${targets//,/ -t }"); fi
if [ -n "$project_dir" ]; then args+=("--project-dir $project_dir"); fi
if [ -n "$project_conf" ]; then args+=("--project-conf $project_conf"); fi
if [ -n "$jobs" ]; then args+=("--jobs $jobs"); fi
if [ -n "$silent" ]; then args+=("--silent"); fi
if [ -n "$verbose" ]; then args+=("--verbose"); fi
if [ -n "$disable_auto_clean" ]; then args+=("--disable-auto-clean"); fi
echo $args | xargs pio run

0 comments on commit 2307622

Please sign in to comment.