ci.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. name: Continuous integration
  2. on:
  3. push:
  4. branches:
  5. - v2
  6. pull_request:
  7. workflow_dispatch:
  8. inputs:
  9. debug_enabled:
  10. description: 'To run with tmate enter "debug_enabled"'
  11. required: false
  12. default: "false"
  13. env:
  14. GO_VERSION: 1.18.5
  15. jobs:
  16. lint:
  17. name: Lint
  18. runs-on: ubuntu-latest
  19. steps:
  20. - name: Checkout code into the Go module directory
  21. uses: actions/checkout@v3
  22. - name: Set up Go ${{ env.GO_VERSION }}
  23. uses: actions/setup-go@v3
  24. with:
  25. go-version: ${{ env.GO_VERSION }}
  26. cache: true
  27. - name: Validate go-mod, license headers and docs are up-to-date
  28. run: make validate
  29. - name: Run golangci-lint
  30. env:
  31. BUILD_TAGS: e2e
  32. uses: golangci/golangci-lint-action@v2
  33. with:
  34. args: --timeout=180s
  35. # only on main branch, costs too much for the gain on every PR
  36. validate-cross-build:
  37. name: Validate cross build
  38. runs-on: ubuntu-latest
  39. if: github.ref == 'refs/heads/main'
  40. steps:
  41. - name: Checkout code into the Go module directory
  42. uses: actions/checkout@v3
  43. - name: Set up Go ${{ env.GO_VERSION }}
  44. uses: actions/setup-go@v3
  45. with:
  46. go-version: ${{ env.GO_VERSION }}
  47. cache: true
  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. steps:
  56. - name: Checkout code into the Go module directory
  57. uses: actions/checkout@v3
  58. - name: Set up Go ${{ env.GO_VERSION }}
  59. uses: actions/setup-go@v3
  60. with:
  61. go-version: ${{ env.GO_VERSION }}
  62. cache: true
  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: Test
  68. run: make -f builder.Makefile test
  69. - name: Build for local E2E
  70. env:
  71. BUILD_TAGS: e2e
  72. run: make GIT_TAG=e2e-PR-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }} -f builder.Makefile compose-plugin
  73. - name: E2E Test in plugin mode
  74. run: make e2e-compose
  75. build-standalone:
  76. name: Build and tests in standalone mode
  77. runs-on: ubuntu-latest
  78. steps:
  79. - name: Checkout code into the Go module directory
  80. uses: actions/checkout@v3
  81. - name: Set up Go ${{ env.GO_VERSION }}
  82. uses: actions/setup-go@v3
  83. with:
  84. go-version: ${{ env.GO_VERSION }}
  85. cache: true
  86. - name: Setup docker CLI
  87. run: |
  88. curl https://download.docker.com/linux/static/stable/x86_64/docker-20.10.3.tgz | tar xz
  89. sudo cp ./docker/docker /usr/bin/ && rm -rf docker && docker version
  90. - name: Build for local E2E
  91. env:
  92. BUILD_TAGS: e2e
  93. run: make GIT_TAG=e2e-PR-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }} -f builder.Makefile compose-plugin
  94. - name: Setup tmate session
  95. uses: mxschmitt/action-tmate@v3
  96. with:
  97. limit-access-to-actor: true
  98. github-token: ${{ secrets.GITHUB_TOKEN }}
  99. if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
  100. - name: E2E Test in standalone mode
  101. run: |
  102. rm -f /usr/local/bin/docker-compose
  103. cp bin/docker-compose /usr/local/bin
  104. make e2e-compose-standalone