All Projects → preactjs → Compressed Size Action

preactjs / Compressed Size Action

Licence: mit
GitHub Action that adds compressed size changes to your PRs.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Compressed Size Action

HumanBytes
A library to convert byte sizes to a human readable form
Stars: ✭ 28 (-90.67%)
Mutual labels:  bytes, size
Processjs
Stars: ✭ 48 (-84%)
Mutual labels:  action, workflow
Ssh Agent
GitHub Action to setup `ssh-agent` with a private key
Stars: ✭ 365 (+21.67%)
Mutual labels:  action, workflow
Zoo
🌈 Cute pet zoo. Come and adopt a cute you like. 萌萌乐园,全自动领养自己喜欢的萌物。
Stars: ✭ 121 (-59.67%)
Mutual labels:  action, workflow
Filesize.js
JavaScript library to generate a human readable String describing the file size
Stars: ✭ 997 (+232.33%)
Mutual labels:  size, bytes
Upload To Release
A GitHub Action that uploads a file to a new release.
Stars: ✭ 144 (-52%)
Mutual labels:  action, workflow
Action Download Artifact
⚙️ A GitHub Action to download an artifact associated with given workflow and commit or other criteria
Stars: ✭ 107 (-64.33%)
Mutual labels:  action, workflow
xbytes
Parse bytes to human readable sizes (4747) → ('4.75 KB') and vice versa.
Stars: ✭ 17 (-94.33%)
Mutual labels:  bytes, size
action-sync-node-meta
GitHub Action that syncs package.json with the repository metadata.
Stars: ✭ 25 (-91.67%)
Mutual labels:  workflow, action
Celery Director
Simple and rapid framework to build workflows with Celery
Stars: ✭ 263 (-12.33%)
Mutual labels:  workflow
Stepperview
SwiftUI iOS component for Step Indications.
Stars: ✭ 281 (-6.33%)
Mutual labels:  workflow
Polyaxon
Machine Learning Platform for Kubernetes (MLOps tools for experimentation and automation)
Stars: ✭ 2,966 (+888.67%)
Mutual labels:  workflow
Qualitis
Qualitis is a one-stop data quality management platform that supports quality verification, notification, and management for various datasource. It is used to solve various data quality problems caused by data processing. https://github.com/WeBankFinTech/Qualitis
Stars: ✭ 268 (-10.67%)
Mutual labels:  workflow
Streamsheets
An open-source tool for processing stream data using a spreadsheet-like interface.
Stars: ✭ 281 (-6.33%)
Mutual labels:  workflow
Stick
solution of "sticking packets" for TCP network transmission
Stars: ✭ 261 (-13%)
Mutual labels:  bytes
Sciluigi
A light-weight wrapper library around Spotify's Luigi workflow library to make writing scientific workflows more fluent, flexible and modular
Stars: ✭ 290 (-3.33%)
Mutual labels:  workflow
Workflow Kotlin
A Swift and Kotlin library for making composable state machines, and UIs driven by those state machines.
Stars: ✭ 255 (-15%)
Mutual labels:  workflow
Docker Camunda Bpm Platform
Docker images for the camunda BPM platform
Stars: ✭ 259 (-13.67%)
Mutual labels:  workflow
Rails workflow
Check Wiki for details
Stars: ✭ 295 (-1.67%)
Mutual labels:  workflow
Workflow Core
Lightweight workflow engine for .NET Standard
Stars: ✭ 3,605 (+1101.67%)
Mutual labels:  workflow

compressed-size-action

A GitHub action that reports changes in compressed file sizes on your PRs.

  • Automatically uses yarn or npm ci when lockfiles are present
  • Builds your PR, then builds the target and compares between the two
  • Doesn't upload anything or rely on centralized storage
  • Supports custom build scripts and file patterns

Usage:

Add a workflow (.github/workflows/main.yml):

name: Compressed Size

on: [pull_request]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/[email protected]
    - uses: preactjs/[email protected]
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"

Customizing the Build

By default, compressed-size-action will try to build your PR by running the "build" npm script in your package.json.

If you need to perform some tasks after dependencies are installed but before building, you can use a "postinstall" npm script to do so. For example, in Lerna-based monorepo:

{
  "scripts": {
    "postinstall": "lerna bootstrap",
    "build": "lerna run build"
  }
}

It is also possible to define a "prebuild" npm script, which runs after "postinstall" but before "build".

You can also specify a completely different npm script to run instead of the default ("build"). To do this, add a build-script option to your yml workflow:

name: Compressed Size

on: [pull_request]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/[email protected]
    - uses: preactjs/[email protected]
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"
+       build-script: "ci"

Customizing the list of files

compressed-size-action defaults to tracking the size of all JavaScript files within dist/ directories - anywhere in your repository, not just at the root. You can change the list of files to be tracked and reported using the pattern and exclude options, both of which are minimatch patterns:

name: Compressed Size
on: [pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/[email protected]
    - uses: preactjs/[email protected]
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"
+       pattern: "./build-output/**/*.{js,css,html,json}"
+       exclude: "{./build-output/manifest.json,**/*.map,**/node_modules/**}"

Files are collected by finding matches for pattern, then any of those that match exclude are ignored. For that reason, most project don't need to modify exclude. The default values for pattern and exclude are as follows:

with:
  # Any JS files anywhere within a dist directory:
  pattern: "**/dist/**/*.js"

  # Always ignore SourceMaps and node_modules:
  exclude: "{**/*.map,**/node_modules/**}"

Dealing with hashed filenames

A strip-hash option was added in v2 that allows passing a custom Regular Expression pattern that will be used to remove hashes from filenames. The un-hashed filenames are used both for size comparison and display purposes.

By default, the characters matched by the regex are removed from filenames. In the example below, a filename foo.abcde.js will be converted to foo.js:

  strip-hash: "\\b\\w{5}\\."

This can be customized further using parens to create submatches, which mark where a hash occurs. When a submatch is detected, it will be replaced with asterisks. This is particularly useful when mix of hashed and unhashed filenames are present. In the example below, a filename foo.abcde.chunk.js will be converted to foo.*****.chunk.js:

  strip-hash: "\\.(\\w{5})\\.chunk\\.js$"

Increasing the required threshold

By default, a file that's been changed by a single byte will be reported as changed. If you'd prefer to require a certain minimum threshold for a file to be changed, you can specify minimum-change-threshold in bytes:

  minimum-change-threshold: 100

In the above example, a file with a delta of less than 100 bytes will be reported as unchanged.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].