|
| 1 | +# |
| 2 | +# Modified platformio-run-action to only build tests. |
| 3 | +# https://github.com/karniv00l/platformio-run-action |
| 4 | +# |
| 5 | +# MIT License https://github.com/karniv00l/platformio-run-action/blob/master/LICENSE |
| 6 | +# |
| 7 | +name: PlatformIO Test without testing/uploading |
| 8 | +description: Run PlatformIO project targets over environments declared in platformio.ini |
| 9 | +author: Piotr Rogowski <[email protected]> |
| 10 | +branding: |
| 11 | + icon: cpu |
| 12 | + color: orange |
| 13 | +inputs: |
| 14 | + environments: |
| 15 | + description: Process specified environments (comma separated). |
| 16 | + required: false |
| 17 | + targets: |
| 18 | + description: Process specified targets (comma separated). |
| 19 | + required: false |
| 20 | + project-dir: |
| 21 | + description: Specify the path to project directory. By default, project-dir is equal to current working directory (CWD). |
| 22 | + required: false |
| 23 | + project-conf: |
| 24 | + description: Process project with a custom platformio.ini |
| 25 | + required: false |
| 26 | + jobs: |
| 27 | + description: Control a number of parallel build jobs. Default is a number of CPUs in a system. |
| 28 | + required: false |
| 29 | + silent: |
| 30 | + description: Suppress progress reporting. |
| 31 | + required: false |
| 32 | + verbose: |
| 33 | + description: Shows detailed information when processing environments. |
| 34 | + required: false |
| 35 | + disable-auto-clean: |
| 36 | + description: Disable auto-clean of build_dir when platformio.ini or src_dir (project structure) have been modified. |
| 37 | + required: false |
| 38 | + |
| 39 | +runs: |
| 40 | + using: composite |
| 41 | + steps: |
| 42 | + - name: Cache pip |
| 43 | + uses: actions/cache@v4 |
| 44 | + with: |
| 45 | + path: ~/.cache/pip |
| 46 | + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} |
| 47 | + restore-keys: | |
| 48 | + ${{ runner.os }}-pip- |
| 49 | + - name: Cache PlatformIO |
| 50 | + uses: actions/cache@v4 |
| 51 | + with: |
| 52 | + path: ~/.platformio |
| 53 | + key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} |
| 54 | + - name: Set up Python |
| 55 | + uses: actions/setup-python@v5 |
| 56 | + with: |
| 57 | + python-version: '3.10' |
| 58 | + - name: Install PlatformIO |
| 59 | + shell: bash |
| 60 | + run: | |
| 61 | + python -m pip install --upgrade pip |
| 62 | + pip install --upgrade platformio |
| 63 | + - name: Run PlatformIO |
| 64 | + shell: bash |
| 65 | + run: | |
| 66 | + environments=${{ inputs.environments }} |
| 67 | + targets=${{ inputs.targets }} |
| 68 | + project_dir=${{ inputs.project-dir }} |
| 69 | + project_conf=${{ inputs.project-conf }} |
| 70 | + jobs=${{ inputs.jobs }} |
| 71 | + silent=${{ inputs.silent }} |
| 72 | + verbose=${{ inputs.verbose }} |
| 73 | + disable_auto_clean=${{ inputs.disable-auto-clean }} |
| 74 | +
|
| 75 | + args=() |
| 76 | +
|
| 77 | + if [ -n "$environments" ]; then args+=("--environment ${environments//,/ -e }"); fi |
| 78 | + if [ -n "$targets" ]; then args+=("--target ${targets//,/ -t }"); fi |
| 79 | + if [ -n "$project_dir" ]; then args+=("--project-dir $project_dir"); fi |
| 80 | + if [ -n "$project_conf" ]; then args+=("--project-conf $project_conf"); fi |
| 81 | + if [ -n "$jobs" ]; then args+=("--jobs $jobs"); fi |
| 82 | + if [ -n "$silent" ]; then args+=("--silent"); fi |
| 83 | + if [ -n "$verbose" ]; then args+=("--verbose"); fi |
| 84 | + if [ -n "$disable_auto_clean" ]; then args+=("--disable-auto-clean"); fi |
| 85 | +
|
| 86 | + echo ${args[*]} | xargs pio test --without-testing --without-uploading |
| 87 | +
|
0 commit comments