This project contains a GitHub Actions workflow to run performance tests using ClinicJS and Autocannon. It also includes a test project with an endpoint that simulates a data handling process.
Ensure you have the following programs installed on your system:
- Git: Download and install Git
- Node.js 20: Download and install Node.js 20
Follow these steps to install and set up the project on your local machine:
git clone https://github.com/dfloresc/clinicjs-pipeline.git
cd clinicjs-pipeline
If you do not have Node.js 20 installed, you can download and install it from here. You can also use a Node.js version manager like nvm
:
nvm install 20
nvm use 20
Once you have Node.js 20 installed, install the project dependencies using npm
:
npm install
Start the application in development mode to test the pipeline:
npm serve
This will build and start the application at http://localhost:3000.
You can access the test endpoint at http://localhost:3000/process-simulator. This endpoint runs a process that handles data by creating random data, iterating, sorting, and grouping it to simulate a workload.
ClinicJS is a performance analysis and diagnosis tool for Node.js. To run a test with ClinicJS Doctor:
npm run doctor
To run a test with ClinicJS Flame:
npm run flame
This repository includes a GitHub Actions workflow to automate performance tests.
The pipeline runs automatically in the following situations:
- When creating a Pull Request.
- When committing to any branch.
-
Run performance tests with ClinicJS Doctor and ClinicJS Flame:
- These tests analyze the application's performance and generate reports.
-
Save assets as artifacts:
- The test results are stored as artifacts.
-
Process and publish results with
performance-reporter
:- This action processes the generated artifacts, publishes them on GitHub Pages, and comments on the Pull Request with links to the performance reports.
An example of this can be seen in PR #2. In this PR, you can see an initial comment indicating the performance results of the unchanged version, followed by another comment showing the performance results after making specific changes to increase the processing time. You can click on the links in the comments to view the reports and compare the differences.
This project uses GitHub Pages to publish performance test results, which is suitable for open-source projects. For private or different environments, it is recommended to use another provider that offers hosting and privacy, such as CloudFront, S3, or another private hosting service.