ci.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. name: go
  2. on:
  3. push:
  4. branches:
  5. - main
  6. pull_request:
  7. jobs:
  8. build:
  9. name: test
  10. runs-on: ubuntu-latest
  11. services:
  12. postgres:
  13. image: postgres:11
  14. env:
  15. POSTGRES_USER: postgres
  16. POSTGRES_PASSWORD: postgres
  17. POSTGRES_DB: postgres
  18. ports:
  19. - 5432:5432
  20. # needed because the postgres container does not provide a healthcheck
  21. options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
  22. mysql:
  23. image: mysql:8
  24. env:
  25. MYSQL_ROOT_PASSWORD: mysecretpassword
  26. MYSQL_DATABASE: mysql
  27. ports:
  28. - 3306:3306
  29. steps:
  30. - uses: actions/checkout@v2.4.0
  31. - uses: actions/setup-go@v2
  32. with:
  33. go-version: '1.17'
  34. - name: test ./...
  35. run: go test --tags=examples ./...
  36. env:
  37. PG_USER: postgres
  38. PG_HOST: localhost
  39. PG_DATABASE: postgres
  40. PG_PASSWORD: postgres
  41. PG_PORT: ${{ job.services.postgres.ports['5432'] }}
  42. MYSQL_DATABASE: mysql
  43. MYSQL_HOST: localhost
  44. MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }}
  45. MYSQL_ROOT_PASSWORD: mysecretpassword
  46. - name: build internal/endtoend
  47. run: go build ./...
  48. working-directory: internal/endtoend/testdata
  49. - name: test internal/endtoend
  50. run: go test ./...
  51. working-directory: internal/endtoend/testdata