Skip to content

Commit

Permalink
fix: tweak test ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ecshreve committed Jun 28, 2023
1 parent 04be06c commit 8439bd2
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 12 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
env:
JEPP_ENV: ci
JEPP_DB_HOST: localhost
JEPP_DB_PASSWORD: root

jobs:
test-with-db:
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/pub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ jobs:
uses: actions/checkout@v3

- name: Build image
run: docker compose build

- name: Tag image
run: |
docker tag jepp-app:latest registry.digitalocean.com/shreggie/jepp:latest
run: docker build . -t registry.digitalocean.com/shreggie/jepp:latest

- name: Install doctl
uses: digitalocean/action-doctl@v2
Expand Down
2 changes: 1 addition & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ tasks:
- pkg/models/*
- pkg/utils/*
cmds:
- task: docker:run
- task: server:run

genswag:
desc: Generates swagger docs for the API.
Expand Down
3 changes: 1 addition & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ services:
restart: unless-stopped
environment:
MARIADB_DATABASE: jeppdb
MARIADB_USER: jepp
MARIADB_PASSWORD: jepp
MARIADB_ALLOW_EMPTY_ROOT_PASSWORD: true
MARIADB_MYSQL_LOCALHOST_USER: true
ports:
Expand All @@ -30,6 +28,7 @@ services:
environment:
JEPP_ENV: ${JEPP_ENV}
JEPP_DB_HOST: db
JEPP_DB_PASSWORD: ""
ports:
- 8880:8880
depends_on:
Expand Down
5 changes: 1 addition & 4 deletions pkg/models/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,14 @@ func GetDBHandle() *sqlx.DB {

cfg := mysql.NewConfig()
cfg.User = "root"
cfg.Passwd = os.Getenv("JEPP_DB_PASSWORD")
cfg.DBName = "jeppdb"
cfg.Net = "tcp"
cfg.Addr = fmt.Sprintf("%s:3306", os.Getenv("JEPP_DB_HOST"))
cfg.AllowNativePasswords = true
cfg.ParseTime = true
cfg.MaxAllowedPacket = 64 << 20

if os.Getenv("JEPP_ENV") == "ci" {
cfg.Passwd = "root"
}

// Get a database handle.
db = sqlx.MustOpen("mysql", cfg.FormatDSN())
log.Debug("created new database handle", "db", db)
Expand Down

0 comments on commit 8439bd2

Please sign in to comment.