Skip to content

Commit

Permalink
ci: add test ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Nils Ponsard committed Apr 8, 2024
1 parent 90b0aef commit 74036fc
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Go

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.22

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

- name: Run tests
run: go test -v ./...

golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: latest
6 changes: 5 additions & 1 deletion database/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ func Init() *gorm.DB {
panic(err)
}

db.AutoMigrate(models...)
err = db.AutoMigrate(models...)

if err != nil {
panic(err)
}

return db
}
7 changes: 6 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@ func main() {
db := database.Init()

r := routes.GetRoutes(db)
r.Run()
err := r.Run()

if err != nil {
panic(err)
}

}

0 comments on commit 74036fc

Please sign in to comment.