From a297c6593719c9b770c640cac3e8b9fa30e2d1e6 Mon Sep 17 00:00:00 2001 From: Rune Harlyk Date: Sun, 17 Mar 2024 14:56:48 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=8F=20Add=20gated=20check=20for=20embe?= =?UTF-8?q?dded=20app=20build?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build-restriction.yml | 48 +++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/build-restriction.yml diff --git a/.github/workflows/build-restriction.yml b/.github/workflows/build-restriction.yml new file mode 100644 index 0000000..6736dd3 --- /dev/null +++ b/.github/workflows/build-restriction.yml @@ -0,0 +1,48 @@ +name: Embedded app build size + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + # defaults: + # run: + # working-directory: ./app + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 'latest' + cache: 'pnpm' + cache-dependency-path: './app/pnpm-lock.yaml' + + - name: Install dependencies + run: cd app && pnpm install + - name: Build app + run: cd app && pnpm build + - name: List files + run: cd esp32 && ls + + + - name: Check index.html size + run: | + SIZE=$(stat --format=%s esp32/data/index.html.gz) + MAXSIZE=204800 + if [ $SIZE -gt $MAXSIZE ]; then + echo "index.html is larger than 200KB ($SIZE bytes)" + exit 1 + else + echo "index.html size is within limit ($SIZE bytes)" + fi \ No newline at end of file