Skip to content

Commit

Permalink
CI: Update GHA workflow and set PSQL env
Browse files Browse the repository at this point in the history
  • Loading branch information
thrasher- committed May 7, 2024
1 parent b7e0a70 commit ee352f5
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
- name: Set up Postgres environment
if: matrix.psql == true
run: |
echo "PSQL_GCT_CI=true" >> $GITHUB_ENV
echo "PSQL_USER=postgres" >> $GITHUB_ENV
echo "PSQL_PASS=postgres" >> $GITHUB_ENV
echo "PSQL_HOST=localhost" >> $GITHUB_ENV
Expand All @@ -71,12 +72,17 @@ jobs:
echo "SKIP_WRAPPER_CI_TESTS=true" >> $GITHUB_ENV
shell: bash

- name: Additional steps for 386 architecture
- name: Additional steps for 386
if: matrix.goarch == '386'
run: |
echo "CGO_ENABLED=1" >> $GITHUB_ENV
sudo apt-get update
sudo apt-get install gcc-multilib g++-multilib
sudo apt-get install -y gcc-multilib
shell: bash

- name: Set CGO_ENABLED for 386 and macos-latest
if: matrix.goarch == '386' || matrix.os == 'macos-latest'
run: |
echo "CGO_ENABLED=1" >> $GITHUB_ENV
shell: bash

- name: Test
Expand Down
16 changes: 16 additions & 0 deletions database/testhelpers/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package testhelpers

import (
"database/sql"
"os"
"path/filepath"
"reflect"

Expand All @@ -25,6 +26,21 @@ var (

// GetConnectionDetails returns connection details for CI or test db instances
func GetConnectionDetails() *database.Config {
if _, exists := os.LookupEnv("PSQL_GCT_CI"); exists {
return &database.Config{
Enabled: true,
Driver: "postgres",
ConnectionDetails: drivers.ConnectionDetails{
Host: "localhost",
Port: 5432,
Username: "postgres",
Password: "postgres",
Database: "gct_dev_ci",
SSLMode: "",
},
}
}

return &database.Config{
Enabled: true,
Driver: "postgres",
Expand Down

0 comments on commit ee352f5

Please sign in to comment.