go.yml 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. # starting with go 1.24 the GODEBUG=x509sha1=1 flag has been removed.
  12. # many tests rely on sha1 certificates. After resolving #1413 we can
  13. # run these on stable and oldstable again. Min version (1.20) can
  14. # always be run.
  15. go: ['1.23', '1.22', '1.20']
  16. services:
  17. # Label used to access the service container
  18. postgres:
  19. # Docker Hub image
  20. image: postgres
  21. # Provide the password for postgres
  22. env:
  23. POSTGRES_DB: postgres_db
  24. POSTGRES_PASSWORD: ""
  25. POSTGRES_HOST_AUTH_METHOD: trust # allow no password
  26. POSTGRES_PORT: 5432
  27. POSTGRES_USER: postgres
  28. # Set health checks to wait until postgres has started
  29. options: >-
  30. --health-cmd pg_isready
  31. --health-interval 10s
  32. --health-timeout 5s
  33. --health-retries 5
  34. ports:
  35. - 5432:5432
  36. mysql:
  37. image: mysql
  38. env:
  39. MYSQL_ALLOW_EMPTY_PASSWORD: yes
  40. MYSQL_ROOT_PASSWORD: ""
  41. ports:
  42. - 3306:3306
  43. options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
  44. env:
  45. GOFLAGS: "-mod=vendor"
  46. GODEBUG: "x509sha1=1"
  47. BUILD_TAGS: "postgresql"
  48. PGHOST: localhost
  49. MYSQL_HOST: 127.0.0.1
  50. steps:
  51. - run: psql -c 'create database certdb_development;' -U postgres;
  52. - run: mysql -e 'create database certdb_development;' -u root;
  53. - run: mysql -e 'SET global sql_mode = 0;' -u root;
  54. - uses: actions/checkout@v4
  55. - name: Set up Go
  56. uses: actions/setup-go@v5
  57. with:
  58. go-version: ${{ matrix.go }}
  59. - name: Build
  60. run: go build -v ./...
  61. - run: make bin/goose;
  62. - run: ./bin/goose -path certdb/pg up;
  63. - run: ./bin/goose -path certdb/mysql up;
  64. - name: Test
  65. run: ./test.sh
  66. - uses: codecov/codecov-action@v4
  67. golangci:
  68. name: lint
  69. runs-on: ubuntu-latest
  70. steps:
  71. - uses: actions/checkout@v4
  72. - uses: actions/setup-go@v5
  73. with:
  74. go-version: "1.20"
  75. - name: golangci-lint
  76. uses: golangci/golangci-lint-action@v6
  77. with:
  78. # There is a breaking change in 1.58 that causes the linter not to recognize
  79. # internal imports or standard library imports and results in linting errors
  80. # that cannot be ignored.
  81. # e.g certdb/certdb.go:5:2: could not import encoding/json (Config.Importer.Import(encoding/json) returned nil but no error) (typecheck)
  82. version: v1.57