dssg / triage

General Purpose Risk Modeling and Prediction Toolkit for Policy and Social Good Problems
Other
181 stars 61 forks source link

Remove postgres service for Github Action #899

Closed jtwalsh0 closed 1 year ago

jtwalsh0 commented 2 years ago

The postgres service in the github test suite is unnecessary: https://github.com/dssg/triage/blob/ab052a7a09a430e905823fb5cf4b47cb2ffbc361/.github/workflows/test.yaml#L9-L22

testing.postgresql initializes a local database. The service is created but goes unused.

I ran test.yaml without the service and it still passed: https://github.com/jtwalsh0/triage/actions/runs/2443440699

thcrock commented 1 year ago

I'm surprised this works. testing.postgresql doesn't install Postgres; it expects to interface with a Postgres server that already exists. I would find it surprising for the base image to come with a server that is auto started. If this continues to work, well, that's fine, but I don't think it's out of a question that a change like this would initially work due to how CI's tend to cache the build environment but then later fail when the cache expires

jtwalsh0 commented 1 year ago

testing.postgresql uses initdb to start a new db cluster: https://github.com/tk0miya/testing.postgresql/blob/c81ded434d00ec8424de0f9e1f4063c778c6aaa8/src/testing/postgresql.py#L36

jtwalsh0 commented 1 year ago

I think the biggest reason the tests take so long is that every call to testing.postgresql.Postgresql initiates a db cluster.