From c2d227004b758f34af609d69bc329081eb77f8f6 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Wed, 17 Aug 2022 19:17:51 -0500 Subject: [PATCH 1/8] adding mpy size actions comment --- .../.github/workflows/build.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/{{ cookiecutter.__dirname }}/.github/workflows/build.yml b/{{ cookiecutter.__dirname }}/.github/workflows/build.yml index 5812bcd..2a74d1a 100644 --- a/{{ cookiecutter.__dirname }}/.github/workflows/build.yml +++ b/{{ cookiecutter.__dirname }}/.github/workflows/build.yml @@ -54,6 +54,17 @@ jobs: pre-commit run --all-files - name: Build assets run: circuitpython-build-bundles --filename_prefix {% raw %}${{ steps.repo-name.outputs.repo-name }}{% endraw -%} {% if cookiecutter.target_bundle == 'Community' %} --package_folder_prefix {% if cookiecutter.library_prefix -%} {{ cookiecutter.library_prefix | lower | replace(' ', '_') }}_ {%- else %}""{%- endif -%}{%- endif %} --library_location . + - name: Check Sizes + run: | + git clone https://github.com/FoamyGuy/CircuitPython_Memory_Tools.git + python CircuitPython_Memory_Tools/measure_size.py > sizes.txt + - name: Size Measurement Comment + if: github.event_name == 'pull_request' + uses: machine-learning-apps/pr-comment@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + path: sizes.txt - name: Archive bundles uses: actions/upload-artifact@v2 with: From 4a8cbe2eee96a122ced9eb7453990b3967e01033 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Wed, 17 Aug 2022 19:37:57 -0500 Subject: [PATCH 2/8] add raw tags --- {{ cookiecutter.__dirname }}/.github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{ cookiecutter.__dirname }}/.github/workflows/build.yml b/{{ cookiecutter.__dirname }}/.github/workflows/build.yml index 2a74d1a..0cf79d5 100644 --- a/{{ cookiecutter.__dirname }}/.github/workflows/build.yml +++ b/{{ cookiecutter.__dirname }}/.github/workflows/build.yml @@ -62,7 +62,7 @@ jobs: if: github.event_name == 'pull_request' uses: machine-learning-apps/pr-comment@master env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }} {% endraw %} with: path: sizes.txt - name: Archive bundles From 96fd6cbccc5c05bdc2235761dcd3cddbfe97ff3f Mon Sep 17 00:00:00 2001 From: foamyguy Date: Wed, 24 Aug 2022 19:51:05 -0500 Subject: [PATCH 3/8] update actions task for conditional comment --- .../.github/workflows/build.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/{{ cookiecutter.__dirname }}/.github/workflows/build.yml b/{{ cookiecutter.__dirname }}/.github/workflows/build.yml index 0cf79d5..f0903ae 100644 --- a/{{ cookiecutter.__dirname }}/.github/workflows/build.yml +++ b/{{ cookiecutter.__dirname }}/.github/workflows/build.yml @@ -56,13 +56,18 @@ jobs: run: circuitpython-build-bundles --filename_prefix {% raw %}${{ steps.repo-name.outputs.repo-name }}{% endraw -%} {% if cookiecutter.target_bundle == 'Community' %} --package_folder_prefix {% if cookiecutter.library_prefix -%} {{ cookiecutter.library_prefix | lower | replace(' ', '_') }}_ {%- else %}""{%- endif -%}{%- endif %} --library_location . - name: Check Sizes run: | - git clone https://github.com/FoamyGuy/CircuitPython_Memory_Tools.git - python CircuitPython_Memory_Tools/measure_size.py > sizes.txt + git clone https://github.com/circuitpython/CircuitPython_Org_size_tools.git + python CircuitPython_Org_size_tools/size_tools.py + - name: Check sizes.txt file existence + id: check_sizes_file + uses: andstor/file-existence-action@v1 + with: + files: "sizes.txt" - name: Size Measurement Comment - if: github.event_name == 'pull_request' + if: github.event_name == 'pull_request' && steps.check_sizes_file.outputs.files_exists == 'true' uses: machine-learning-apps/pr-comment@master env: - GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }} {% endraw %} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: path: sizes.txt - name: Archive bundles From f539521d4c4154e4c809f3bfa5b2a696c8367cb1 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Wed, 24 Aug 2022 19:55:45 -0500 Subject: [PATCH 4/8] fix raw tag --- {{ cookiecutter.__dirname }}/.github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{ cookiecutter.__dirname }}/.github/workflows/build.yml b/{{ cookiecutter.__dirname }}/.github/workflows/build.yml index f0903ae..730fafc 100644 --- a/{{ cookiecutter.__dirname }}/.github/workflows/build.yml +++ b/{{ cookiecutter.__dirname }}/.github/workflows/build.yml @@ -67,7 +67,7 @@ jobs: if: github.event_name == 'pull_request' && steps.check_sizes_file.outputs.files_exists == 'true' uses: machine-learning-apps/pr-comment@master env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }} {% endraw %} with: path: sizes.txt - name: Archive bundles From 730d4b0d641193aa1679a4189335a80f4510b3b5 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Wed, 24 Aug 2022 21:58:06 -0500 Subject: [PATCH 5/8] use checkout action to clone --- {{ cookiecutter.__dirname }}/.github/workflows/build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/{{ cookiecutter.__dirname }}/.github/workflows/build.yml b/{{ cookiecutter.__dirname }}/.github/workflows/build.yml index 730fafc..19cadaa 100644 --- a/{{ cookiecutter.__dirname }}/.github/workflows/build.yml +++ b/{{ cookiecutter.__dirname }}/.github/workflows/build.yml @@ -54,9 +54,13 @@ jobs: pre-commit run --all-files - name: Build assets run: circuitpython-build-bundles --filename_prefix {% raw %}${{ steps.repo-name.outputs.repo-name }}{% endraw -%} {% if cookiecutter.target_bundle == 'Community' %} --package_folder_prefix {% if cookiecutter.library_prefix -%} {{ cookiecutter.library_prefix | lower | replace(' ', '_') }}_ {%- else %}""{%- endif -%}{%- endif %} --library_location . + - name: Clone Size Tools + uses: actions/checkout@v3 + with: + repository: 'circuitpython/CircuitPython_Org_size_tools' + path: 'CircuitPython_Org_size_tools' - name: Check Sizes run: | - git clone https://github.com/circuitpython/CircuitPython_Org_size_tools.git python CircuitPython_Org_size_tools/size_tools.py - name: Check sizes.txt file existence id: check_sizes_file From 5c3eb220fcd948d8ec5aee22c1795bc286e851ed Mon Sep 17 00:00:00 2001 From: foamyguy Date: Mon, 29 Aug 2022 18:53:46 -0500 Subject: [PATCH 6/8] remove extra space --- {{ cookiecutter.__dirname }}/.github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{ cookiecutter.__dirname }}/.github/workflows/build.yml b/{{ cookiecutter.__dirname }}/.github/workflows/build.yml index 19cadaa..7728822 100644 --- a/{{ cookiecutter.__dirname }}/.github/workflows/build.yml +++ b/{{ cookiecutter.__dirname }}/.github/workflows/build.yml @@ -71,7 +71,7 @@ jobs: if: github.event_name == 'pull_request' && steps.check_sizes_file.outputs.files_exists == 'true' uses: machine-learning-apps/pr-comment@master env: - GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }} {% endraw %} + GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} with: path: sizes.txt - name: Archive bundles From dde02266808987655fe888275a91efd4c42d8e99 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Sat, 24 Sep 2022 11:25:01 -0500 Subject: [PATCH 7/8] clone and build main branch for size measurements --- .../.github/workflows/build.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/{{ cookiecutter.__dirname }}/.github/workflows/build.yml b/{{ cookiecutter.__dirname }}/.github/workflows/build.yml index 7728822..fb91fc9 100644 --- a/{{ cookiecutter.__dirname }}/.github/workflows/build.yml +++ b/{{ cookiecutter.__dirname }}/.github/workflows/build.yml @@ -59,7 +59,16 @@ jobs: with: repository: 'circuitpython/CircuitPython_Org_size_tools' path: 'CircuitPython_Org_size_tools' - - name: Check Sizes + - name: Clone Main Branch + uses: actions/checkout@v3 + with: + path: 'main_branch_repo' + ref: 'main' + - name: Build main + run: | + cd main_branch_repo + circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location . + - name: Measure Sizes run: | python CircuitPython_Org_size_tools/size_tools.py - name: Check sizes.txt file existence From 549f559fb6543abf96ec6476c56cfb3895407d86 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Sat, 24 Sep 2022 11:34:23 -0500 Subject: [PATCH 8/8] fix template var --- {{ cookiecutter.__dirname }}/.github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{ cookiecutter.__dirname }}/.github/workflows/build.yml b/{{ cookiecutter.__dirname }}/.github/workflows/build.yml index fb91fc9..3f9128c 100644 --- a/{{ cookiecutter.__dirname }}/.github/workflows/build.yml +++ b/{{ cookiecutter.__dirname }}/.github/workflows/build.yml @@ -67,7 +67,7 @@ jobs: - name: Build main run: | cd main_branch_repo - circuitpython-build-bundles --filename_prefix ${{ steps.repo-name.outputs.repo-name }} --library_location . + circuitpython-build-bundles --filename_prefix {% raw %}${{ steps.repo-name.outputs.repo-name }}{% endraw -%} --library_location . - name: Measure Sizes run: | python CircuitPython_Org_size_tools/size_tools.py