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

feat: Closes #36 add workflow for building and testing #37

Merged
merged 1 commit into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
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
23 changes: 23 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Test and Build

on: [push]

jobs:
build:
runs-on: ubuntu-latest
env:
ENV: test
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
check-latest: true

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...
37 changes: 22 additions & 15 deletions server/db/initialize.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package db
import (
"errors"
"fmt"
"os"
"strings"

"github.com/doncicuto/glim/models"
Expand Down Expand Up @@ -102,14 +103,17 @@ func createManager(db *gorm.DB, initialPassword string) error {
}).Error; err != nil {
return err
}
fmt.Println("")
fmt.Println("------------------------------------- WARNING -------------------------------------")
fmt.Println("A new user with manager permissions has been created:")
fmt.Println("- Username: admin") // TODO - Allow username with env
fmt.Printf("- Password %s\n", chosenPassword)
fmt.Println("Please store or write down this password to manage Glim.")
fmt.Println("You can delete this user once you assign manager permissions to another user")
fmt.Println("-----------------------------------------------------------------------------------")

if os.Getenv("ENV") != "test" {
fmt.Println("")
fmt.Println("------------------------------------- WARNING -------------------------------------")
fmt.Println("A new user with manager permissions has been created:")
fmt.Println("- Username: admin") // TODO - Allow username with env
fmt.Printf("- Password %s\n", chosenPassword)
fmt.Println("Please store or write down this password to manage Glim.")
fmt.Println("You can delete this user once you assign manager permissions to another user")
fmt.Println("-----------------------------------------------------------------------------------")
}

return nil
}
Expand Down Expand Up @@ -150,13 +154,16 @@ func createReadonly(db *gorm.DB, initialPassword string) error {
}).Error; err != nil {
return err
}
fmt.Println("")
fmt.Println("------------------------------------- WARNING -------------------------------------")
fmt.Println("A new user with read-only permissions has been created:")
fmt.Println("- Username: search") // TODO - Allow username with env
fmt.Printf("- Password %s\n", chosenPassword)
fmt.Println("Please store or write down this password to perform search queries in Glim.")
fmt.Println("-----------------------------------------------------------------------------------")

if os.Getenv("ENV") != "test" {
fmt.Println("")
fmt.Println("------------------------------------- WARNING -------------------------------------")
fmt.Println("A new user with read-only permissions has been created:")
fmt.Println("- Username: search") // TODO - Allow username with env
fmt.Printf("- Password %s\n", chosenPassword)
fmt.Println("Please store or write down this password to perform search queries in Glim.")
fmt.Println("-----------------------------------------------------------------------------------")
}

return nil
}
Expand Down