Which step do you get the error in? I assume it happens in your primary/build container (Node 11.4), and you will presumably be running your tests in a step (not shown in your YAML). So, if you want to do an apt-get then do that in a run step before your tests.
A alternative to everyone have a bug like that, because is using polygon:
undefined methodproperty’ for nil:NilClass`
First, do not use st_polygon or st_point to the column. Read the doc for they, and save the column like a string, and then uses ST_GeomFromText(your_shape) to transform it directly.
This only works if Postgis is configured correctly.