ci.yml 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. name: CI Workflow
  2. permissions: read-all
  3. on:
  4. pull_request:
  5. branches:
  6. - main
  7. jobs:
  8. unit-tests:
  9. name: Unit Tests
  10. runs-on: ${{ matrix.os }}
  11. strategy:
  12. max-parallel: 4
  13. matrix:
  14. os: [ubuntu-latest, windows-latest, macOS-latest]
  15. go-version: [1.18, 1.19]
  16. steps:
  17. - name: Set up Go
  18. uses: actions/setup-go@v3
  19. with:
  20. go-version: ${{ matrix.go-version }}
  21. - name: Checkout
  22. uses: actions/checkout@v3
  23. - name: Run unit tests
  24. run: make test
  25. integration-tests:
  26. name: Integration Tests
  27. runs-on: ubuntu-latest
  28. services:
  29. postgres:
  30. image: postgres:9.5
  31. env:
  32. POSTGRES_USER: postgres
  33. POSTGRES_PASSWORD: postgres
  34. POSTGRES_DB: postgres
  35. ports:
  36. - 5432:5432
  37. options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
  38. steps:
  39. - name: Set up Go
  40. uses: actions/setup-go@v3
  41. with:
  42. go-version: 1.19
  43. - name: Checkout
  44. uses: actions/checkout@v3
  45. - name: Install Postgres client
  46. run: sudo apt update && sudo apt install -y postgresql-client
  47. - name: Run integration tests
  48. run: make integration-test
  49. env:
  50. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  51. PGHOST: 127.0.0.1
  52. PGPASSWORD: postgres