build-test.yaml 2.2 KB

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