Skip to content

Commit

Permalink
Merge branch 'master' into recurring-tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
narthur authored Aug 24, 2022
2 parents 555e550 + 4d160a4 commit 8f37337
Show file tree
Hide file tree
Showing 6 changed files with 207 additions and 2 deletions.
82 changes: 82 additions & 0 deletions .github/workflows/bundle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Bundle
on: pull_request
jobs:
bundle_base:
runs-on: ubuntu-latest
outputs:
size: ${{ steps.size.outputs.size }}
strategy:
matrix:
node-version: ['16.15.0']
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.base_ref }}
- uses: pnpm/[email protected]
with:
version: 7
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Save bundle size
id: size
run: |
echo "::set-output name=size::$(du -s dist/ | awk '{print $1}')"
- name: Publish result
if: ${{ hashFiles('stats.html') != '' }}
run: pnpm dlx surge . https://${{ github.base_ref }}-stats.surge.sh --token ${{ secrets.SURGE_TOKEN }}

bundle_head:
runs-on: ubuntu-latest
outputs:
size: ${{ steps.size.outputs.size }}
strategy:
matrix:
node-version: ['16.15.0']
steps:
- uses: actions/checkout@v2
- uses: pnpm/[email protected]
with:
version: 7
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build
run: pnpm build
- name: Save bundle size
id: size
run: |
echo "::set-output name=size::$(du -s dist/ | awk '{print $1}')"
- name: Publish result
if: ${{ hashFiles('stats.html') != '' }}
run: pnpm dlx surge . https://${{ github.head_ref }}-stats.surge.sh --token ${{ secrets.SURGE_TOKEN }}

compare:
runs-on: ubuntu-latest
needs: [bundle_base, bundle_head]
steps:
- name: Add comment
uses: peter-evans/create-or-update-comment@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.number }}
body: |
Base: [${{needs.bundle_base.outputs.size}}](https://${{ github.base_ref }}-stats.surge.sh/stats.html)
Head: [${{needs.bundle_head.outputs.size}}](https://${{ github.head_ref }}-stats.surge.sh/stats.html)
- name: Compare bundle sizes
run: |
if [ "${{needs.bundle_base.outputs.size}}" -lt "${{needs.bundle_head.outputs.size}}" ]; then
exit 1
else
exit 0
fi
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

# testing
/coverage
stats.html

# production
/build
Expand Down
2 changes: 2 additions & 0 deletions .surgeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!stats.html
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@
"lint:fix": "eslint --max-warnings 0 --fix .",
"start": "vite",
"build": "vite build",
"test": "vitest"
"test": "vitest",
"visualize": "pnpm run build && open ./stats.html",
"size": "pnpm run build && du -s dist/ | awk '{print $1}'"
},
"dependencies": {
"@date-io/date-fns": "^1.3.13",
Expand Down Expand Up @@ -80,6 +82,7 @@
"eslint-plugin-testing-library": "^5.6.0",
"jsdom": "^20.0.0",
"prettier": "2.4.1",
"rollup-plugin-visualizer": "^5.8.0",
"tslint-config-prettier": "^1.18.0",
"typescript": "^4.7.4",
"vite": "2.7.0",
Expand Down
116 changes: 116 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
/// <reference types="vitest" />
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { visualizer } from 'rollup-plugin-visualizer';

export default defineConfig({
plugins: [react()],
plugins: [react(), visualizer()],
test: {
globals: true,
environment: 'jsdom',
Expand Down

1 comment on commit 8f37337

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.