Skip to content

Commit 8648c35

Browse files
authored
Merge pull request #40 from per1234/rewrite-compile-examples
libraries/compile-examples: rewrite script in Python
2 parents cfa00e7 + eb96987 commit 8648c35

File tree

16 files changed

+1942
-309
lines changed

16 files changed

+1942
-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"]

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ List of library dependencies to install (space separated). Default `""`.
2424

2525
List of paths containing sketches to compile. These paths will be searched recursively. Default `"examples"`.
2626

27+
### `verbose`
28+
29+
Set to true to show verbose output in the log. Default `false`
30+
2731
### `github-token`
2832

2933
GitHub access token used to get information from the GitHub API. Only needed if you're using the size report features with private repositories. It will be convenient to use [`${{ secrets.GITHUB_TOKEN }}`](https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token). Default `""`.

action.yml

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ inputs:
1313
sketch-paths:
1414
description: 'List of paths containing sketches to compile.'
1515
default: 'examples'
16+
verbose:
17+
description: 'Set to true to show verbose output in the log'
18+
default: false
1619
github-token:
1720
description: 'GitHub access token used to get information from the GitHub API. Only needed if you are using the size report features with private repositories.'
1821
default: ''
@@ -40,15 +43,3 @@ inputs:
4043
runs:
4144
using: 'docker'
4245
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

0 commit comments

Comments
 (0)