Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

install postgresql-17 package in test job if necessary #218

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion internal/ghworkflow/workflow_ci.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package ghworkflow

import (
"fmt"
"strings"

"github.com/sapcc/go-makefile-maker/internal/core"
Expand Down Expand Up @@ -37,7 +38,16 @@ func ciWorkflow(cfg core.Configuration, sr golang.ScanResult) {

testJob := buildOrTestBaseJob("Test", cfg)
testJob.Needs = []string{"build"}
testCmd := []string{
"make build/cover.out",
}
if ghwCfg.CI.Postgres || sr.UsesPostgres {
testCmd = append([]string{
"sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y",
"sudo apt-get install --no-install-recommends postgresql-" + core.DefaultPostgresVersion,
fmt.Sprintf("export PATH=/usr/lib/postgresql/%s/bin:$PATH", core.DefaultPostgresVersion),
}, testCmd...)
// TODO remove this service once all users migrated to use github.com/sapcc/go-bits/easypg
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't easily detect this. A shame.

testJob.Services = map[string]jobService{"postgres": {
Image: "postgres:" + core.DefaultPostgresVersion,
Env: map[string]string{"POSTGRES_PASSWORD": "postgres"},
Expand All @@ -53,7 +63,7 @@ func ciWorkflow(cfg core.Configuration, sr golang.ScanResult) {
}
testJob.addStep(jobStep{
Name: "Run tests and generate coverage report",
Run: "make build/cover.out",
Run: makeMultilineYAMLString(testCmd),
})
if ghwCfg.CI.Coveralls && !ghwCfg.IsSelfHostedRunner {
multipleOS := len(ghwCfg.CI.RunnerType) > 1
Expand Down
Loading