ci.yml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. name: Continuous integration
  2. on:
  3. push:
  4. branches:
  5. - v2
  6. pull_request:
  7. jobs:
  8. lint:
  9. name: Lint
  10. runs-on: ubuntu-latest
  11. env:
  12. GO111MODULE: "on"
  13. steps:
  14. - name: Set up Go 1.17
  15. uses: actions/setup-go@v2
  16. with:
  17. go-version: 1.17
  18. id: go
  19. - name: Checkout code into the Go module directory
  20. uses: actions/checkout@v2
  21. - name: Validate go-mod, license headers and docs are up-to-date
  22. run: make validate
  23. - name: Run golangci-lint
  24. env:
  25. BUILD_TAGS: e2e
  26. uses: golangci/golangci-lint-action@v2
  27. with:
  28. args: --timeout=180s
  29. # only on main branch, costs too much for the gain on every PR
  30. validate-cross-build:
  31. name: Validate cross build
  32. runs-on: ubuntu-latest
  33. if: github.ref == 'refs/heads/main'
  34. env:
  35. GO111MODULE: "on"
  36. steps:
  37. - name: Set up Go 1.17
  38. uses: actions/setup-go@v2
  39. with:
  40. go-version: 1.17
  41. id: go
  42. - name: Checkout code into the Go module directory
  43. uses: actions/checkout@v2
  44. - uses: actions/cache@v2
  45. with:
  46. path: ~/go/pkg/mod
  47. key: go-${{ hashFiles('**/go.sum') }}
  48. # Ensure we don't discover cross platform build issues at release time.
  49. # Time used to build linux here is gained back in the build for local E2E step
  50. - name: Build packages
  51. run: make -f builder.Makefile cross
  52. build-plugin:
  53. name: Build and tests in plugin mode
  54. runs-on: ubuntu-latest
  55. env:
  56. GO111MODULE: "on"
  57. steps:
  58. - name: Set up Go 1.17
  59. uses: actions/setup-go@v2
  60. with:
  61. go-version: 1.17
  62. id: go
  63. - name: Setup docker CLI
  64. run: |
  65. curl https://download.docker.com/linux/static/stable/x86_64/docker-20.10.3.tgz | tar xz
  66. sudo cp ./docker/docker /usr/bin/ && rm -rf docker && docker version
  67. - name: Checkout code into the Go module directory
  68. uses: actions/checkout@v2
  69. - uses: actions/cache@v2
  70. with:
  71. path: ~/go/pkg/mod
  72. key: go-${{ hashFiles('**/go.sum') }}
  73. - name: Test
  74. run: make -f builder.Makefile test
  75. - name: Build for local E2E
  76. env:
  77. BUILD_TAGS: e2e
  78. run: make -f builder.Makefile compose-plugin
  79. - name: E2E Test in plugin mode
  80. run: make e2e-compose
  81. build-standalone:
  82. name: Build and tests in standalone mode
  83. runs-on: ubuntu-latest
  84. env:
  85. GO111MODULE: "on"
  86. steps:
  87. - name: Set up Go 1.17
  88. uses: actions/setup-go@v2
  89. with:
  90. go-version: 1.17
  91. id: go
  92. - name: Setup docker CLI
  93. run: |
  94. curl https://download.docker.com/linux/static/stable/x86_64/docker-20.10.3.tgz | tar xz
  95. sudo cp ./docker/docker /usr/bin/ && rm -rf docker && docker version
  96. - name: Checkout code into the Go module directory
  97. uses: actions/checkout@v2
  98. - uses: actions/cache@v2
  99. with:
  100. path: ~/go/pkg/mod
  101. key: go-${{ hashFiles('**/go.sum') }}
  102. - name: Build for local E2E
  103. env:
  104. BUILD_TAGS: e2e
  105. run: make -f builder.Makefile compose-plugin
  106. - name: E2E Test in standalone mode
  107. run: make e2e-compose-standalone