Skip to content

Commit c64283c

Browse files
committed
ci: add size limit github action
1 parent ce15d58 commit c64283c

File tree

2 files changed

+39
-7
lines changed

2 files changed

+39
-7
lines changed

.github/workflows/build.yml

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,35 @@ jobs:
4343

4444
- name: Build wasm
4545
run: cargo make wasm
46-
47-
- name: Report wasm size
48-
uses: chrysanthos/[email protected]
46+
47+
- name: Prepare size limit
48+
run: |
49+
cat << EOF > package.json
50+
{
51+
"name": "contracts",
52+
"version": "1.0.0",
53+
"description": "[![version](https://img.shields.io/github/v/release/okp4/contracts?style=for-the-badge)](https://github.com/okp4/contracts/releases) [![build](https://img.shields.io/github/workflow/status/okp4/contracts/Build?label=build&style=for-the-badge)](https://github.com/okp4/contracts/actions/workflows/build.yml) [![lint](https://img.shields.io/github/workflow/status/okp4/contracts/Lint?label=lint&style=for-the-badge)](https://github.com/okp4/contracts/actions/workflows/lint.yml) [![test](https://img.shields.io/github/workflow/status/okp4/contracts/Test?label=test&style=for-the-badge)](https://github.com/okp4/contracts/actions/workflows/test.yml) [![conventional commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=for-the-badge)](https://conventionalcommits.org) [![License](https://img.shields.io/badge/License-BSD_3--Clause-blue.svg?style=for-the-badge)](https://opensource.org/licenses/BSD-3-Clause)",
54+
"main": "index.js",
55+
"scripts": {
56+
"build": "cargo make wasm",
57+
"test": "echo \"Error: no test specified\" && exit 1"
58+
},
59+
"repository": {
60+
"type": "git",
61+
"url": "git+https://github.com/okp4/contracts.git"
62+
},
63+
"author": "",
64+
"bugs": {
65+
"url": "https://github.com/okp4/contracts/issues"
66+
},
67+
"homepage": "https://github.com/okp4/contracts#readme",
68+
"devDependencies": {
69+
"@size-limit/preset-app": "^7.0.8"
70+
}
71+
}
72+
EOF
73+
74+
- name: Report wasm size limit
75+
uses: andresz1/size-limit-action@v1
4976
with:
50-
repo-token: ${{ secrets.GITHUB_TOKEN }}
51-
files: '["target/wasm32-unknown-unknown/release/*.wasm"]'
52-
with-same: 'true'
53-
build-assets: 'cargo make wasm'
77+
github_token: ${{ secrets.GITHUB_TOKEN }}

.size-limit.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[
2+
{
3+
"path": "target/wasm32-unknown-unknown/release/cw_template.wasm",
4+
"running": false,
5+
"brotli": false,
6+
"gzip": false
7+
}
8+
]

0 commit comments

Comments
 (0)