hirosystems / stacks-blockchain-api

API for the Stacks blockchain
https://stacks-blockchain-api.vercel.app
GNU General Public License v3.0
178 stars 114 forks source link

Speed up `CI / test (api)` step #2137

Open zone117x opened 3 weeks ago

zone117x commented 3 weeks ago

This CI step takes 10+ minutes now. It's slow because all the tests run in-band (serial rather than in parallel) so that they don't clobber each other's postgres db.

The tests could be made to ran in parallel by having them use their own temporary postgres schema (a container/namespace within a database).

One approach is to create a jest setupFilesAfterEnv script that configures PG_SCHEMA:

process.env.PG_SCHEMA = crypto.randomUUID();
diwakergupta commented 3 weeks ago

Is it worth exploring something like https://pglite.dev/ ? It basically allows very light-weight in-memory postgres instances for CI.