Skip to content

Commit

Permalink
only run on merge
Browse files Browse the repository at this point in the history
  • Loading branch information
BlakeHolifield committed Jul 10, 2023
1 parent 2655ee6 commit 7a0a642
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
push:
branches:
- main
# This can be a security risk, but our vars are container defaults with no data
pull_request_target:

jobs:
pr_check:
Expand Down Expand Up @@ -63,9 +61,9 @@ jobs:
with:
go-version: '1.18'

- name: 'Create env file'
- name: 'Create env test file'
run: |
echo "${{ env.ENV_FILE }}" > .env
cat ./env.actions > .env
- name: Test
run: make test
7 changes: 7 additions & 0 deletions env.actions
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
PGSQL_USER=chrome
PGSQL_PASSWORD=chrome
PGSQL_HOSTNAME=0.0.0.0
PGSQL_PORT=5432
PGSQL_DATABASE=postgres
UNLEASH_API_TOKEN=default:development.unleash-insecure-api-token
UNLEASH_ADMIN_TOKEN=*:*.unleash-insecure-api-token
17 changes: 0 additions & 17 deletions rest/util/testutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ package util

import (
"fmt"
"os"
"regexp"

"github.com/RedHatInsights/chrome-service-backend/config"
"github.com/joho/godotenv"
)

const ProjectName = "chrome-service-backend"
Expand All @@ -25,16 +21,3 @@ func SetupTestConfig() *config.ChromeServiceConfig {
cfg.FeatureFlagConfig.FullURL = fmt.Sprintf("%s://%s:%d/api/", cfg.FeatureFlagConfig.Scheme, cfg.FeatureFlagConfig.Hostname, cfg.FeatureFlagConfig.Port)
return cfg
}

// TODO: Break test config out into env files in the future
// LoadEnv loads env vars from .env
func LoadEnv() {
re := regexp.MustCompile(`^(.*` + ProjectName + `)`)
cwd, _ := os.Getwd()
rootPath := re.Find([]byte(cwd))

err := godotenv.Load(string(rootPath) + `/.env.test`)
if err != nil {
fmt.Println(err)
}
}

0 comments on commit 7a0a642

Please sign in to comment.