build-test.yaml 2.9 KB

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