This GitHub action allows you to measure and track TypeScript performance regressions in your projects by comparing tsc --diagnostics
(or --extendedDiagnostics
based on your configuration) outputs between the base branch and the current branch.
base-branch
: The branch that the actions should use to compare TSC performance (default: 'main').custom-command
: Allows to override the default type check command. Your custom command should print either --diagnostics or --extendedDiagnostics output. (default:yarn tsc --noEmit --incremental false --diagnostics/--extendedDiagnostics
).leave-comment
: Indicates whether the action should leave a comment on a PR. Enabling this requires providing the github-token input (default: false).github-token
: GitHub API token. Necessary to leave comments on your PRs.extended
: Indicates whether the actions should use --extendedDiagnostics over --diagnostics (default: false).
You can add this action to your workflow file like this:
name: Check TypeScript Performance
on:
pull_request:
jobs:
check-performance:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v2
with:
node-version: 16.x
- name: Install dependencies
run: npm ci
- name: TSC Diagnostics Diff
uses: beerose/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
leave-comment: true
This example uses GITHUB_TOKEN
to leave a comment on PRs with the diagnostics comparison.
![CleanShot 2023-05-18 at 14 17 53@2x](https://private-user-images.githubusercontent.com/9019397/239243307-63df1847-3461-4c8b-beb6-045af27e62ea.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM2ODQ1MzMsIm5iZiI6MTcyMzY4NDIzMywicGF0aCI6Ii85MDE5Mzk3LzIzOTI0MzMwNy02M2RmMTg0Ny0zNDYxLTRjOGItYmViNi0wNDVhZjI3ZTYyZWEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgxNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MTVUMDExMDMzWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YzhhOGJmYzI5YjZiZjg2MjQ5MzEwMTU1MTkzNTE4YmE0ZGMyYTgxZDNiZDExMjcwYjZhZTExMGU0YTBiMGMzOSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.elJI_BLYiHtDOPsNWyjFi21t9BGC5kpOqKjzTjb8OT0)
Install the dependencies
$ npm install
Build the typescript and package it for distribution
$ npm run build && npm run package
Run the tests ✔️
$ npm test
PASS ./index.test.js
✓ throws invalid number (3ms)
✓ wait 500 ms (504ms)
✓ test runs (95ms)
...
Actions are run from GitHub repos so we will checkin the packed dist folder.
Then run ncc and push the results:
$ npm run package
$ git add dist
$ git commit -a -m "prod dependencies"
$ git push origin releases/v1
You can now validate the action by referencing ./
in a workflow in your repo (see test.yml)
uses: ./
with: ...
See the actions tab for runs of this action! 🚀