ci.yml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. jobs:
  14. lint:
  15. name: Lint
  16. runs-on: ubuntu-latest
  17. env:
  18. GO111MODULE: "on"
  19. steps:
  20. - name: Set up Go 1.18
  21. uses: actions/setup-go@v2
  22. with:
  23. go-version: 1.18.3
  24. id: go
  25. - name: Checkout code into the Go module directory
  26. uses: actions/checkout@v2
  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. env:
  41. GO111MODULE: "on"
  42. steps:
  43. - name: Set up Go 1.18
  44. uses: actions/setup-go@v2
  45. with:
  46. go-version: 1.18.3
  47. id: go
  48. - name: Checkout code into the Go module directory
  49. uses: actions/checkout@v2
  50. - uses: actions/cache@v2
  51. with:
  52. path: ~/go/pkg/mod
  53. key: go-${{ hashFiles('**/go.sum') }}
  54. # Ensure we don't discover cross platform build issues at release time.
  55. # Time used to build linux here is gained back in the build for local E2E step
  56. - name: Build packages
  57. run: make -f builder.Makefile cross
  58. build-plugin:
  59. name: Build and tests in plugin mode
  60. runs-on: ubuntu-latest
  61. env:
  62. GO111MODULE: "on"
  63. steps:
  64. - name: Set up Go 1.18
  65. uses: actions/setup-go@v2
  66. with:
  67. go-version: 1.18.3
  68. id: go
  69. - name: Setup docker CLI
  70. run: |
  71. curl https://download.docker.com/linux/static/stable/x86_64/docker-20.10.3.tgz | tar xz
  72. sudo cp ./docker/docker /usr/bin/ && rm -rf docker && docker version
  73. - name: Checkout code into the Go module directory
  74. uses: actions/checkout@v2
  75. - uses: actions/cache@v2
  76. with:
  77. path: ~/go/pkg/mod
  78. key: go-${{ hashFiles('**/go.sum') }}
  79. - name: Test
  80. run: make -f builder.Makefile test
  81. - name: Build for local E2E
  82. env:
  83. BUILD_TAGS: e2e
  84. run: make GIT_TAG=e2e-PR-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }} -f builder.Makefile compose-plugin
  85. - name: E2E Test in plugin mode
  86. run: make e2e-compose
  87. build-standalone:
  88. name: Build and tests in standalone mode
  89. runs-on: ubuntu-latest
  90. env:
  91. GO111MODULE: "on"
  92. steps:
  93. - name: Set up Go 1.18
  94. uses: actions/setup-go@v2
  95. with:
  96. go-version: 1.18.3
  97. id: go
  98. - name: Setup docker CLI
  99. run: |
  100. curl https://download.docker.com/linux/static/stable/x86_64/docker-20.10.3.tgz | tar xz
  101. sudo cp ./docker/docker /usr/bin/ && rm -rf docker && docker version
  102. - name: Checkout code into the Go module directory
  103. uses: actions/checkout@v2
  104. - uses: actions/cache@v2
  105. with:
  106. path: ~/go/pkg/mod
  107. key: go-${{ hashFiles('**/go.sum') }}
  108. - name: Build for local E2E
  109. env:
  110. BUILD_TAGS: e2e
  111. run: make GIT_TAG=e2e-PR-${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }} -f builder.Makefile compose-plugin
  112. - name: Setup tmate session
  113. uses: mxschmitt/action-tmate@v3
  114. with:
  115. limit-access-to-actor: true
  116. github-token: ${{ secrets.GITHUB_TOKEN }}
  117. if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }}
  118. - name: E2E Test in standalone mode
  119. run: |
  120. rm -f /usr/local/bin/docker-compose
  121. cp bin/docker-compose /usr/local/bin
  122. make e2e-compose-standalone