ci.yml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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.16
  15. uses: actions/setup-go@v2
  16. with:
  17. go-version: 1.16
  18. id: go
  19. - name: Checkout code into the Go module directory
  20. uses: actions/checkout@v2
  21. - name: Validate go-mod is up-to-date and license headers
  22. run: make validate
  23. - name: Run golangci-lint
  24. env:
  25. BUILD_TAGS: e2e
  26. run: |
  27. curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b /usr/bin/ v1.39.0
  28. make -f builder.Makefile lint
  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.16
  38. uses: actions/setup-go@v2
  39. with:
  40. go-version: 1.16
  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:
  53. name: Build
  54. runs-on: ubuntu-latest
  55. env:
  56. GO111MODULE: "on"
  57. steps:
  58. - name: Set up Go 1.16
  59. uses: actions/setup-go@v2
  60. with:
  61. go-version: 1.16
  62. id: go
  63. - name: Set up gosum
  64. run: |
  65. go get -u gotest.tools/gotestsum
  66. - name: Setup docker CLI
  67. run: |
  68. curl https://download.docker.com/linux/static/stable/x86_64/docker-20.10.3.tgz | tar xz
  69. sudo cp ./docker/docker /usr/bin/ && rm -rf docker && docker version
  70. - name: Checkout code into the Go module directory
  71. uses: actions/checkout@v2
  72. - uses: actions/cache@v2
  73. with:
  74. path: ~/go/pkg/mod
  75. key: go-${{ hashFiles('**/go.sum') }}
  76. - name: Test
  77. env:
  78. BUILD_TAGS: kube
  79. run: make -f builder.Makefile test
  80. - name: Build for local E2E
  81. env:
  82. BUILD_TAGS: e2e
  83. run: make -f builder.Makefile compose-plugin
  84. - name: E2E Test
  85. run: make e2e-compose