tests.yml 928 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. name: Run Tests
  2. on:
  3. pull_request:
  4. branches:
  5. - main
  6. push:
  7. branches:
  8. - main
  9. concurrency:
  10. group: test-${{ github.head_ref || github.run_id }}
  11. cancel-in-progress: true
  12. jobs:
  13. test:
  14. runs-on: ubuntu-latest
  15. services:
  16. redis:
  17. image: redis
  18. ports:
  19. - 6379:6379
  20. options: -e REDIS_PASSWORD=difyai123456
  21. postgres:
  22. image: postgres
  23. env:
  24. POSTGRES_USER: postgres
  25. POSTGRES_PASSWORD: difyai123456
  26. POSTGRES_DB: difyai
  27. ports:
  28. - 5432:5432
  29. steps:
  30. - uses: actions/checkout@v2
  31. - name: Setup Golang 1.21.6
  32. uses: actions/setup-go@v5
  33. with:
  34. go-version: '1.21.6'
  35. - name: Setup License
  36. run: go run cmd/license/generate/main.go
  37. - name: Install dependencies
  38. run: go mod download
  39. - name: Run tests
  40. run: go test -v ./...