go.yml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. name: Go
  2. on:
  3. push:
  4. pull_request:
  5. branches: [master]
  6. jobs:
  7. build:
  8. runs-on: ubuntu-latest
  9. strategy:
  10. matrix:
  11. go: [stable, oldstable]
  12. services:
  13. # Label used to access the service container
  14. postgres:
  15. # Docker Hub image
  16. image: postgres
  17. # Provide the password for postgres
  18. env:
  19. POSTGRES_DB: postgres_db
  20. POSTGRES_PASSWORD: ""
  21. POSTGRES_HOST_AUTH_METHOD: trust # allow no password
  22. POSTGRES_PORT: 5432
  23. POSTGRES_USER: postgres
  24. # Set health checks to wait until postgres has started
  25. options: >-
  26. --health-cmd pg_isready
  27. --health-interval 10s
  28. --health-timeout 5s
  29. --health-retries 5
  30. ports:
  31. - 5432:5432
  32. mysql:
  33. image: mysql
  34. env:
  35. MYSQL_ALLOW_EMPTY_PASSWORD: yes
  36. MYSQL_ROOT_PASSWORD: ""
  37. ports:
  38. - 3306:3306
  39. options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
  40. env:
  41. GOFLAGS: "-mod=vendor"
  42. GODEBUG: "x509sha1=1"
  43. BUILD_TAGS: "postgresql"
  44. PGHOST: localhost
  45. MYSQL_HOST: 127.0.0.1
  46. steps:
  47. - run: psql -c 'create database certdb_development;' -U postgres;
  48. - run: mysql -e 'create database certdb_development;' -u root;
  49. - run: mysql -e 'SET global sql_mode = 0;' -u root;
  50. - uses: actions/checkout@v3
  51. - name: Set up Go
  52. uses: actions/setup-go@v4
  53. with:
  54. go-version: ${{ matrix.go }}
  55. - name: Build
  56. run: go build -v ./...
  57. - run: make bin/goose;
  58. - run: ./bin/goose -path certdb/pg up;
  59. - run: ./bin/goose -path certdb/mysql up;
  60. - name: Test
  61. run: ./test.sh
  62. - uses: codecov/codecov-action@v3
  63. golangci:
  64. name: lint
  65. runs-on: ubuntu-latest
  66. steps:
  67. - uses: actions/setup-go@v4
  68. with:
  69. go-version: 1.18
  70. - uses: actions/checkout@v3
  71. - name: golangci-lint
  72. uses: golangci/golangci-lint-action@v3