mirror of
https://github.com/rjNemo/rentease.git
synced 2026-06-06 02:36:49 +00:00
add CI
This commit is contained in:
parent
967df34451
commit
cd61bdf2f1
3 changed files with 43 additions and 2 deletions
39
.github/workflows/ci.yml
vendored
Normal file
39
.github/workflows/ci.yml
vendored
Normal 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 .
|
||||
2
Makefile
2
Makefile
|
|
@ -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:
|
||||
|
|
|
|||
4
main.go
4
main.go
|
|
@ -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{
|
||||
|
|
|
|||
Loading…
Reference in a new issue