Contains just enough logic from the upstream zonkyio/embedded-postgres-binaries
to build the binaries supported by fergusstrange/embedded-postgres.
Forked to include PostGIS by default, patch up a couple of issues related to getting it
to build and eliminate the complexity of providing actual maven/java compatibility given that the intended use case is for go projects.
The intent is to support versions both exported as defaults by fergusstrange/embedded-postgres and supported by PostGIS (>= v12).
At the time of this writing:
// Predefined supported Postgres versions.
const (
V15 = PostgresVersion("15.3.0")
V14 = PostgresVersion("14.8.0")
V13 = PostgresVersion("13.11.0")
V12 = PostgresVersion("12.15.0")
)
Currently, PostGIS version is 3.3, the most recent version that supports all postgres versions above.
The build process of this repo generates artifacts in a format ready to be consumed by the embedded postgres testing library. A snapshot of the most recent build is available at https://strivewrt.github.io/embedded-postgres-binaries/.
package test
import (
"testing"
embeddedpostgres "github.com/fergusstrange/embedded-postgres"
)
func TestStuff(t *testing.T){
cfg := embeddedpostgres.
DefaultConfig().
BinaryRepositoryURL("https://strivewrt.github.io/embedded-postgres-binaries/").
Version(embeddedpostgres.V15) // see version support above
postgres := embeddedpostgres.NewDatabase(cfg)
// test things that need a database
}
Upstream build scripts are written in a combination of gradle and bash and require a compatible JDK installation to run. This repo attempts to simplify that process into a combination of Docker and Make, providing caching based on Docker layers and Make targets to avoid unnecessary rebuilds.
Running make
in the project folder will generate JAR files for each supported version of Postgres, in both
debian and alpine compatible formats. These aren't real JAR files and are not compatible with Java projects but
they are in a format and folder structure that is compatible with the embedded postgres testing library.
The test suite in this repo confirms that the artifacts generated by the build process can be brought in and launched
successfully, connected to via pgx/v5
and that PostGIS is working. Both debian and alpine variants are tested via:
$ make test