Skip to content

Commit 60a4c47

Browse files
committed
Rewrite script in Python
This will make development, testing, and maintenance easier.
1 parent cfa00e7 commit 60a4c47

File tree

15 files changed

+1934
-309
lines changed

15 files changed

+1934
-309
lines changed

.github/workflows/libraries_compile-examples.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,18 @@ jobs:
1818
- name: Install dependencies
1919
run: |
2020
python -m pip install --upgrade pip
21+
pip install --requirement "$GITHUB_WORKSPACE/libraries/compile-examples/compilesketches/requirements.txt"
2122
pip install --requirement "$GITHUB_WORKSPACE/libraries/compile-examples/reportsizetrends/requirements.txt"
2223
2324
- name: Lint with flake8
2425
run: |
2526
pip install --quiet flake8
2627
pip install --quiet pep8-naming
28+
flake8 --show-source "$GITHUB_WORKSPACE/libraries/compile-examples/compilesketches"
2729
flake8 --show-source "$GITHUB_WORKSPACE/libraries/compile-examples/reportsizetrends"
2830
2931
- name: Run Python unit tests
3032
run: |
31-
export PYTHONPATH="$GITHUB_WORKSPACE/libraries/compile-examples/reportsizetrends"
33+
export PYTHONPATH="$GITHUB_WORKSPACE/libraries/compile-examples/compilesketches:$GITHUB_WORKSPACE/libraries/compile-examples/reportsizetrends"
34+
pytest "$GITHUB_WORKSPACE/libraries/compile-examples/compilesketches/tests"
3235
python -m unittest discover "$GITHUB_WORKSPACE/libraries/compile-examples/reportsizetrends/tests"

Dockerfile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
FROM python:3.8.2
22

3-
# Install prerequisites
4-
RUN apt-get update && apt-get install -y git wget jq curl \
5-
&& rm -rf /var/lib/apt/lists/*
3+
ENV PYTHONPATH="/reportsizetrends"
64

75
# Copies your code file from your action repository to the filesystem path `/` of the container
8-
COPY entrypoint.sh /entrypoint.sh
6+
COPY compilesketches /compilesketches
97
COPY reportsizetrends /reportsizetrends
108

119
# Install python dependencies
10+
RUN pip install -r /compilesketches/requirements.txt
1211
RUN pip install -r /reportsizetrends/requirements.txt
1312

1413
# Code file to execute when the docker container starts up (`entrypoint.sh`)
15-
ENTRYPOINT ["/entrypoint.sh"]
14+
ENTRYPOINT ["python", "/compilesketches/compilesketches.py"]

action.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,3 @@ inputs:
4040
runs:
4141
using: 'docker'
4242
image: 'Dockerfile'
43-
args:
44-
- ${{ inputs.cli-version }}
45-
- ${{ inputs.fqbn }}
46-
- ${{ inputs.libraries }}
47-
- ${{ inputs.sketch-paths }}
48-
- ${{ inputs.github-token }}
49-
- ${{ inputs.size-report-sketch }}
50-
- ${{ inputs.enable-size-deltas-report }}
51-
- ${{ inputs.size-deltas-report-folder-name }}
52-
- ${{ inputs.enable-size-trends-report }}
53-
- ${{ inputs.size-trends-report-spreadsheet-id }}
54-
- ${{ inputs.size-trends-report-sheet-name }}

compilesketches/.flake8

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[flake8]
2+
doctests = True
3+
# W503 and W504 are mutually exclusive. PEP 8 recommends line break before.
4+
ignore = W503
5+
max-complexity = 10
6+
max-line-length = 120
7+
select = E,W,F,C,N

compilesketches/compilesketches.py

Lines changed: 789 additions & 0 deletions
Large diffs are not rendered by default.

compilesketches/requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
gitpython==3.1.1
2+
PyGithub==1.47
3+
pytest==5.4.1
4+
pytest-mock==3.1.0

compilesketches/tests/pytest.ini

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[pytest]
2+
filterwarnings =
3+
error
4+
ignore::DeprecationWarning
5+
ignore::ResourceWarning

compilesketches/tests/test_compilesketches.py

Lines changed: 1116 additions & 0 deletions
Large diffs are not rendered by default.

compilesketches/tests/testdata/HasSketches/NotSketch/Foo.bar

Whitespace-only changes.

compilesketches/tests/testdata/HasSketches/Sketch1/Sketch1.ino

Whitespace-only changes.

0 commit comments

Comments
 (0)