ci.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. name: Continuous integration
  2. on:
  3. push:
  4. branches:
  5. - main
  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: Validate imports
  24. run: make import-restrictions
  25. - name: Run golangci-lint
  26. env:
  27. BUILD_TAGS: kube,e2e
  28. run: |
  29. curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b /usr/bin/ v1.39.0
  30. make -f builder.Makefile lint
  31. # only on main branch, costs too much for the gain on every PR
  32. validate-cross-build:
  33. name: Validate cross build
  34. runs-on: ubuntu-latest
  35. if: github.ref == 'refs/heads/main'
  36. env:
  37. GO111MODULE: "on"
  38. steps:
  39. - name: Set up Go 1.16
  40. uses: actions/setup-go@v2
  41. with:
  42. go-version: 1.16
  43. id: go
  44. - name: Checkout code into the Go module directory
  45. uses: actions/checkout@v2
  46. - uses: actions/cache@v2
  47. with:
  48. path: ~/go/pkg/mod
  49. key: go-${{ hashFiles('**/go.sum') }}
  50. # Ensure we don't discover cross platform build issues at release time.
  51. # Time used to build linux here is gained back in the build for local E2E step
  52. - name: Build packages
  53. run: make -f builder.Makefile cross cross-compose-plugin
  54. build:
  55. name: Build
  56. runs-on: ubuntu-latest
  57. env:
  58. GO111MODULE: "on"
  59. steps:
  60. - name: Set up Go 1.16
  61. uses: actions/setup-go@v2
  62. with:
  63. go-version: 1.16
  64. id: go
  65. - name: Set up gosum
  66. run: |
  67. go get -u gotest.tools/gotestsum
  68. - name: Setup docker CLI
  69. run: |
  70. curl https://download.docker.com/linux/static/stable/x86_64/docker-20.10.3.tgz | tar xz
  71. sudo cp ./docker/docker /usr/bin/ && rm -rf docker && docker version
  72. - name: Checkout code into the Go module directory
  73. uses: actions/checkout@v2
  74. - uses: actions/cache@v2
  75. with:
  76. path: ~/go/pkg/mod
  77. key: go-${{ hashFiles('**/go.sum') }}
  78. - name: Test
  79. env:
  80. BUILD_TAGS: kube
  81. run: make -f builder.Makefile test
  82. - name: Build for local E2E
  83. env:
  84. BUILD_TAGS: e2e
  85. run: make -f builder.Makefile cli compose-plugin
  86. - name: E2E Test
  87. run: make e2e-local