build.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. name: Builds
  2. on:
  3. pull_request:
  4. defaults:
  5. run:
  6. # reference: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell
  7. shell: bash --noprofile --norc -eo pipefail -x {0}
  8. # cancel the in-progress workflow when PR is refreshed.
  9. concurrency:
  10. group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }}
  11. cancel-in-progress: true
  12. permissions:
  13. contents: read
  14. jobs:
  15. macos-build:
  16. runs-on: macos-12
  17. if: "!contains(github.event.pull_request.labels.*.name, 'skip-ci')"
  18. steps:
  19. - name: checkout
  20. uses: actions/checkout@v4
  21. with:
  22. fetch-depth: 0
  23. - uses: actions/setup-go@v4
  24. with:
  25. go-version: "1.21"
  26. - name: Set up Helm
  27. uses: azure/setup-helm@v3
  28. with:
  29. version: v3.6.2
  30. - name: build rook
  31. run: |
  32. # Install kubectl binary as required for generating csv
  33. curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl"
  34. chmod +x ./kubectl
  35. sudo mv ./kubectl /usr/local/bin/kubectl
  36. sudo chown root: /usr/local/bin/kubectl
  37. GOPATH=$(go env GOPATH) make clean && make -j$nproc IMAGES='ceph' BUILD_CONTAINER_IMAGE=false build
  38. - name: validate build
  39. run: tests/scripts/validate_modified_files.sh build
  40. - name: run codegen
  41. run: GOPATH=$(go env GOPATH) make codegen
  42. - name: validate codegen
  43. run: tests/scripts/validate_modified_files.sh codegen
  44. - name: run mod check
  45. run: GOPATH=$(go env GOPATH) make -j $(nproc) mod.check
  46. - name: validate modcheck
  47. run: tests/scripts/validate_modified_files.sh modcheck
  48. - name: run crds-gen
  49. run: make csv-clean && GOPATH=$(go env GOPATH) make crds
  50. - name: validate crds-gen
  51. run: tests/scripts/validate_modified_files.sh crd
  52. - name: run gen-rbac
  53. run: GOPATH=$(go env GOPATH) make gen-rbac
  54. - name: validate gen-rbac
  55. run: tests/scripts/validate_modified_files.sh gen-rbac
  56. linux-build-all:
  57. runs-on: ubuntu-20.04
  58. if: "!contains(github.event.pull_request.labels.*.name, 'skip-ci')"
  59. strategy:
  60. fail-fast: false
  61. matrix:
  62. go-version: ["1.21","1.20"]
  63. steps:
  64. - name: checkout
  65. uses: actions/checkout@v4
  66. with:
  67. fetch-depth: 0
  68. - name: setup golang ${{ matrix.go-version }}
  69. uses: actions/setup-go@v4
  70. with:
  71. go-version: ${{ matrix.go-version }}
  72. - name: set up QEMU
  73. uses: docker/setup-qemu-action@master
  74. with:
  75. platforms: all
  76. - name: build.all rook with go ${{ matrix.go-version }}
  77. run: |
  78. tests/scripts/github-action-helper.sh build_rook_all