-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
action.yml
137 lines (128 loc) · 4.44 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: "Compile Arduino Sketches"
description: >-
Checks whether Arduino sketches will compile and produces a report of data from the compilations
inputs:
cli-version:
description: >-
Version of Arduino CLI to use when building
default: "latest"
required: true
fqbn:
description: >-
Full qualified board name, with Boards Manager URL if needed
default: "arduino:avr:uno"
required: true
libraries:
description: >-
YAML-format list of library dependencies to install
default: "- source-path: ./"
required: true
platforms:
description: >-
YAML-format list of platform dependencies to install
default: ""
required: true
sketch-paths:
description: >-
YAML-format list of paths containing sketches to compile.
default: "- examples"
required: true
cli-compile-flags:
description: >-
YAML-format list of flags to add to the Arduino CLI sketch compilation command.
default: ""
required: false
verbose:
description: >-
Set to true to show verbose output in the log
default: "false"
required: true
sketches-report-path:
description: >-
Path in which to save a JSON formatted file containing data from the sketch compilations
default: "sketches-reports"
required: true
github-token:
description: >-
GitHub access token used to get information from the GitHub API.
Only needed if you are using the deltas report feature in a private repository.
default: ""
required: true
enable-deltas-report:
description: >-
Set to true to cause the action to determine the change in memory usage and compiler warnings of the compiled
sketches between the head and base refs of a PR and the immediate parent commit of a push
default: "false"
required: true
enable-warnings-report:
description: >-
Set to true to cause the action to record the compiler warning count for each sketch compilation in the sketches
report
default: "false"
required: true
runs:
using: composite
steps:
# User installations of external Python package platform dependencies will be located here.
- name: Get system Python "user site-packages" path
id: system-user-site-packages
shell: bash
run: |
# Get system Python "user site-packages" path.
echo "path=$(python -m site --user-site)" >> $GITHUB_OUTPUT
- name: Install Python
uses: actions/setup-python@v5
with:
python-version-file: ${{ github.action_path }}/pyproject.toml
- name: Action setup
shell: bash
working-directory: ${{ github.action_path }}
run: |
echo "::group::Action setup"
# Install Poetry.
pipx install \
--python "$(which python)" \
"poetry==$( \
yq \
--input-format toml \
--output-format yaml \
'.tool.poetry.group.pipx.dependencies.poetry' \
< pyproject.toml
)"
# Install Python dependencies.
poetry install \
--only main,external
# Make user-installed Python packages available to platforms.
readonly PYTHON_ENVIRONMENT_PATH="$(
poetry env info \
--path
)"
readonly VENV_SITE_PACKAGES_PATH="$(
poetry run \
python -c \
'import site; print(site.getsitepackages()[0])'
)"
echo \
"${{ steps.system-user-site-packages.outputs.path }}" > \
"${VENV_SITE_PACKAGES_PATH}/system-user-site-packages.pth"
# Terminate action setup group
echo "::endgroup::"
- name: Run script
shell: bash
env:
INPUT_CLI-VERSION: ${{ inputs.cli-version }}
INPUT_FQBN: ${{ inputs.fqbn }}
INPUT_LIBRARIES: ${{ inputs.libraries }}
INPUT_PLATFORMS: ${{ inputs.platforms }}
INPUT_SKETCH-PATHS: ${{ inputs.sketch-paths }}
INPUT_CLI-COMPILE-FLAGS: ${{ inputs.cli-compile-flags }}
INPUT_VERBOSE: ${{ inputs.verbose }}
INPUT_GITHUB-TOKEN: ${{ inputs.github-token }}
INPUT_ENABLE-DELTAS-REPORT: ${{ inputs.enable-deltas-report }}
INPUT_ENABLE-WARNINGS-REPORT: ${{ inputs.enable-warnings-report }}
INPUT_SKETCHES-REPORT-PATH: ${{ inputs.sketches-report-path }}
working-directory: ${{ github.action_path }}
run: |
# Run action
poetry run \
python compilesketches/compilesketches.py