This commit is contained in:
Ruidy 2024-07-14 23:39:31 +02:00
parent 967df34451
commit cd61bdf2f1
No known key found for this signature in database
GPG key ID: E00F51288CB857CC
3 changed files with 43 additions and 2 deletions

39
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,39 @@
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22
- name: Install dependencies
run: |
go mod download
- name: Lint code
run: |
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
golangci-lint run
- name: Run tests
run: |
go test ./...
- name: Build Docker image
run: |
docker build -t rentease .

View file

@ -9,6 +9,8 @@ run: build
@docker run -p ${PORT}:${PORT} -e DATABASE_URL="host=docker.for.mac.host.internal user=${DB_USER} database=${DB_NAME}" -e PORT=${PORT} ${NAME}
dev: templ
@air cmd/main.go
test:
@go test ./...
cron:
@go run cmd/cron/main.go
templ:

View file

@ -34,8 +34,8 @@ func main() {
}
}
func run(ctx context.Context, getEnv func(string) string) error {
ctx, cancel := signal.NotifyContext(ctx, os.Interrupt)
func run(c context.Context, getEnv func(string) string) error {
ctx, cancel := signal.NotifyContext(c, os.Interrupt)
defer cancel()
if err := sentry.Init(sentry.ClientOptions{