ci.yml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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.37.0
  30. make -f builder.Makefile lint
  31. build:
  32. name: Build
  33. runs-on: ubuntu-latest
  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. run: |
  43. go get -u gotest.tools/gotestsum
  44. - name: Setup docker CLI
  45. run: |
  46. curl https://download.docker.com/linux/static/stable/x86_64/docker-20.10.3.tgz | tar xz
  47. sudo cp ./docker/docker /usr/bin/ && rm -rf docker && docker version
  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. - name: Test
  59. env:
  60. BUILD_TAGS: kube
  61. run: make -f builder.Makefile test
  62. - name: Build for local E2E
  63. env:
  64. BUILD_TAGS: e2e
  65. run: make -f builder.Makefile cli
  66. - name: E2E Test
  67. run: make e2e-local