Skip to content

Commit

Permalink
Drop ability to define postgres version
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSandro2000 committed Apr 4, 2024
1 parent be37e5e commit 3fbf014
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 21 deletions.
13 changes: 3 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,7 @@ ci:
- ubuntu-latest
- windows-latest
coveralls: true
postgres:
enabled: true
version: 12
postgres: true
ignorePaths: []
```

Expand All @@ -391,12 +389,8 @@ successful on multiple operating systems. Default value for this is `ubuntu-late

If `coveralls` is `true` then your test coverage report will be uploaded to [Coveralls]. Make sure that you have enabled Coveralls for your GitHub repo beforehand.

If `postgres.enabled` is `true` then a PostgreSQL service container will be added for the
`test` job. You can connect to this PostgreSQL service at `localhost:54321` with
`postgres` as username and password ([More info][postgres-service-container]).
`postgres.version` specifies the Docker Hub image tag for the [`postgres`
image][docker-hub-postgres] that is used for this container. By default `12` is used as
image tag.
If `postgres` is `true` then a PostgreSQL service container will be added for the `test` job.
You can connect to this PostgreSQL service at `localhost:54321` with `postgres` as username and password ([More info][postgres-service-container]).

`ignorePaths` specifies a list of filename patterns. Workflows will not trigger if a path
name matches a pattern in this list. [More info][ref-onpushpull] and [filter pattern cheat
Expand Down Expand Up @@ -461,7 +455,6 @@ license:

[codeql]: https://codeql.github.com/
[coveralls]: https://coveralls.io
[docker-hub-postgres]: https://hub.docker.com/_/postgres/
[doublestar-pattern]: https://github.com/bmatcuk/doublestar#patterns
[govulncheck]: https://github.com/golang/vuln
[misspell]: https://github.com/client9/misspell
Expand Down
7 changes: 2 additions & 5 deletions internal/core/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,7 @@ type CIWorkflowConfig struct {
IgnorePaths []string `yaml:"ignorePaths"`
RunnerType []string `yaml:"runOn"`
Coveralls bool `yaml:"coveralls"`
Postgres struct {
Enabled bool `yaml:"enabled"`
Version string `yaml:"version"`
} `yaml:"postgres"`
Postgres bool `yaml:"postgres"`
}

// LicenseWorkflowConfig appears in type Configuration.
Expand Down Expand Up @@ -243,7 +240,7 @@ func (c *Configuration) Validate() {
}

// Validate CI workflow configuration.
if ghwCfg.CI.Postgres.Enabled {
if ghwCfg.CI.Postgres {
if !ghwCfg.CI.Enabled {
logg.Fatal("githubWorkflow.ci.enabled must be set to 'true' when githubWorkflow.ci.postgres is enabled")
}
Expand Down
8 changes: 2 additions & 6 deletions internal/ghworkflow/workflow_ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,9 @@ func ciWorkflow(cfg core.Configuration) {

testJob := buildOrTestBaseJob("Test", cfg)
testJob.Needs = []string{"buildAndLint"}
if ghwCfg.CI.Postgres.Enabled {
version := core.DefaultPostgresVersion
if ghwCfg.CI.Postgres.Version != "" {
version = ghwCfg.CI.Postgres.Version
}
if ghwCfg.CI.Postgres {
testJob.Services = map[string]jobService{"postgres": {
Image: "postgres:" + version,
Image: "postgres:" + core.DefaultPostgresVersion,
Env: map[string]string{"POSTGRES_PASSWORD": "postgres"},
Ports: []string{"54321:5432"},
Options: strings.Join([]string{
Expand Down

0 comments on commit 3fbf014

Please sign in to comment.