build-test.yaml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. -
  26. name: Install just
  27. uses: extractions/setup-just@v1
  28. - name: install protobuf-go
  29. run: |
  30. go install github.com/golang/protobuf/protoc-gen-go
  31. -
  32. name: Validate
  33. run: |
  34. export PATH=${PATH}:`go env GOPATH`/bin
  35. just validate-protobuf
  36. backend:
  37. runs-on: ubuntu-latest
  38. steps:
  39. - uses: actions/checkout@v4
  40. with:
  41. path: ./
  42. -
  43. name: Install just
  44. uses: extractions/setup-just@v1
  45. -
  46. name: Install Go
  47. uses: actions/setup-go@v5
  48. with:
  49. go-version: 'stable'
  50. # Saves us from having to redownload all modules
  51. - name: Go Mod cache
  52. uses: actions/cache@v4
  53. with:
  54. path: |
  55. ~/.cache/go-build
  56. ~/go/pkg/mod
  57. key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
  58. -
  59. name: Test
  60. run: |
  61. just test
  62. -
  63. name: Build
  64. run: |
  65. just build-local
  66. - name: get-pr-info
  67. shell: bash
  68. env:
  69. PR_NUM: ${{ github.event.number }}
  70. run: |
  71. echo $PR_NUM > pr_num.txt
  72. echo $GITHUB_BASE_REF > base.txt
  73. echo $GITHUB_HEAD_REF > head.txt
  74. - name: Upload code coverage
  75. uses: actions/upload-artifact@v4
  76. with:
  77. name: oc-code-coverage
  78. path: |
  79. coverage.out
  80. pr_num.txt
  81. base.txt
  82. head.txt
  83. frontend:
  84. runs-on: ubuntu-latest
  85. steps:
  86. - uses: actions/checkout@v4
  87. with:
  88. path: ./
  89. -
  90. name: Install just
  91. uses: extractions/setup-just@v1
  92. -
  93. name: Install node
  94. uses: actions/setup-node@v4
  95. with:
  96. node-version: '18.3.0'
  97. - name: Get npm cache directory
  98. id: npm-cache-dir
  99. shell: bash
  100. run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
  101. - uses: actions/cache@v4
  102. id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
  103. with:
  104. path: ${{ steps.npm-cache-dir.outputs.dir }}
  105. key: ${{ runner.os }}-node-${{ hashFiles('./ui/**/package-lock.json') }}
  106. restore-keys: |
  107. ${{ runner.os }}-node-
  108. -
  109. name: Build
  110. working-directory: ./ui
  111. run: |
  112. just build-local