build-test.yaml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. name: Build/Test
  2. on:
  3. push:
  4. branches:
  5. - develop
  6. pull_request:
  7. branches:
  8. - develop
  9. - plugin-working-branch # can be removed before plugin 1.0 merge
  10. jobs:
  11. validate-protobuf:
  12. runs-on: ubuntu-latest
  13. steps:
  14. - uses: actions/checkout@v4
  15. with:
  16. path: ./
  17. -
  18. name: Install Go
  19. uses: actions/setup-go@v5
  20. with:
  21. go-version: 'stable'
  22. -
  23. name: Install protoc
  24. uses: arduino/setup-protoc@v3
  25. with:
  26. version: '25.3'
  27. -
  28. name: Install just
  29. uses: extractions/setup-just@v1
  30. - name: install protobuf-go
  31. run: |
  32. go install github.com/golang/protobuf/protoc-gen-go
  33. go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
  34. which protoc-gen-go-grpc
  35. -
  36. name: Validate
  37. run: |
  38. just validate-protobuf
  39. backend:
  40. runs-on: ubuntu-latest
  41. steps:
  42. - uses: actions/checkout@v4
  43. with:
  44. path: ./
  45. -
  46. name: Install just
  47. uses: extractions/setup-just@v1
  48. -
  49. name: Install Go
  50. uses: actions/setup-go@v5
  51. with:
  52. go-version: 'stable'
  53. # Saves us from having to redownload all modules
  54. - name: Go Mod cache
  55. uses: actions/cache@v4
  56. with:
  57. path: |
  58. ~/.cache/go-build
  59. ~/go/pkg/mod
  60. key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
  61. -
  62. name: Test
  63. run: |
  64. just test
  65. -
  66. name: Build
  67. run: |
  68. just build-local
  69. - name: get-pr-info
  70. shell: bash
  71. env:
  72. PR_NUM: ${{ github.event.number }}
  73. run: |
  74. echo $PR_NUM > pr_num.txt
  75. echo $GITHUB_BASE_REF > base.txt
  76. echo $GITHUB_HEAD_REF > head.txt
  77. - name: Upload code coverage
  78. uses: actions/upload-artifact@v4
  79. with:
  80. name: oc-code-coverage
  81. path: |
  82. coverage.out
  83. pr_num.txt
  84. base.txt
  85. head.txt
  86. frontend:
  87. runs-on: ubuntu-latest
  88. steps:
  89. - uses: actions/checkout@v4
  90. with:
  91. path: ./
  92. -
  93. name: Install just
  94. uses: extractions/setup-just@v1
  95. -
  96. name: Install node
  97. uses: actions/setup-node@v4
  98. with:
  99. node-version: '18.3.0'
  100. - name: Get npm cache directory
  101. id: npm-cache-dir
  102. shell: bash
  103. run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
  104. - uses: actions/cache@v4
  105. id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
  106. with:
  107. path: ${{ steps.npm-cache-dir.outputs.dir }}
  108. key: ${{ runner.os }}-node-${{ hashFiles('./ui/**/package-lock.json') }}
  109. restore-keys: |
  110. ${{ runner.os }}-node-
  111. -
  112. name: Build
  113. working-directory: ./ui
  114. run: |
  115. just build-local