version bump #24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Shield badges | |
| on: | |
| push: | |
| branches: [fix/bug-fixes] | |
| jobs: | |
| bundle-size: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| - run: npm install | |
| - run: npm run build | |
| - name: Measure bundle size (gzip) | |
| id: size | |
| run: | | |
| BYTES=$(gzip -9 -c dist/umd/Sandbox.min.js | wc -c) | |
| echo "bytes=$BYTES" >> $GITHUB_OUTPUT | |
| - name: Format size | |
| id: fmt | |
| run: | | |
| python3 -c " | |
| b = ${{ steps.size.outputs.bytes }} | |
| if b >= 1024*1024: | |
| s = f'{b/1024/1024:.1f} MB' | |
| elif b >= 1024: | |
| s = f'{b/1024:.1f} kB' | |
| else: | |
| s = f'{b} B' | |
| print('size=' + s) | |
| " >> $GITHUB_OUTPUT | |
| - name: Update Gist badge | |
| uses: schneegans/dynamic-badges-action@v1.7.0 | |
| with: | |
| auth: ${{ secrets.GIST_TOKEN }} | |
| gistID: dd4a46f4c2fff1c43d4f2e8fb4b52862 | |
| filename: bundle-size.json | |
| label: minified (gzip) | |
| message: ${{ steps.fmt.outputs.size }} | |
| color: blue | |
| tests: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| - run: npm install | |
| - name: Run tests with JSON reporter | |
| id: test | |
| run: | | |
| NODE_OPTIONS='--no-warnings=ExperimentalWarning' npx jest --json --outputFile=jest-results.json || true | |
| - name: Extract test counts | |
| id: counts | |
| run: | | |
| python3 -c " | |
| import json | |
| with open('jest-results.json') as f: | |
| data = json.load(f) | |
| passed = data['numPassedTests'] | |
| total = data['numTotalTests'] | |
| print(f'passed={passed}') | |
| print(f'total={total}') | |
| print(f'message={passed}/{total}') | |
| color = '#97c901' if passed == total else 'red' | |
| print(f'color={color}') | |
| " >> $GITHUB_OUTPUT | |
| - name: Update Gist badge | |
| uses: schneegans/dynamic-badges-action@v1.7.0 | |
| with: | |
| auth: ${{ secrets.GIST_TOKEN }} | |
| gistID: dd4a46f4c2fff1c43d4f2e8fb4b52862 | |
| filename: tests.json | |
| label: passing tests | |
| message: ${{ steps.counts.outputs.message }} | |
| color: ${{ steps.counts.outputs.color }} | |
| sandbox-badge: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| - name: Prepare sandbox badge | |
| id: sandbox_badge | |
| run: | | |
| # collapse SVG to a single line | |
| svg_inline="$(tr -d '\n' < ./logo.svg)" | |
| echo "message=Sandbox protected" >> "$GITHUB_OUTPUT" | |
| echo "color=#202830" >> "$GITHUB_OUTPUT" | |
| echo "label=" >> "$GITHUB_OUTPUT" | |
| echo "logoSvg=${svg_inline}" >> "$GITHUB_OUTPUT" | |
| - name: Update Gist badge | |
| uses: schneegans/dynamic-badges-action@v1.7.0 | |
| with: | |
| auth: ${{ secrets.GIST_TOKEN }} | |
| gistID: dd4a46f4c2fff1c43d4f2e8fb4b52862 | |
| filename: sandbox-protected.json | |
| label: ${{ steps.sandbox_badge.outputs.label }} | |
| message: ${{ steps.sandbox_badge.outputs.message }} | |
| color: ${{ steps.sandbox_badge.outputs.color }} | |
| logoSvg: ${{ steps.sandbox_badge.outputs.logoSvg }} |