build-test.yaml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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@v2
  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@v4
  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. - name: Upload code coverage
  47. uses: actions/upload-artifact@v3
  48. with:
  49. name: oc-code-coverage
  50. path: |
  51. coverage.out
  52. pr_num.txt
  53. frontend:
  54. runs-on: ubuntu-latest
  55. steps:
  56. - uses: actions/checkout@v2
  57. with:
  58. path: ./
  59. -
  60. name: Install just
  61. uses: extractions/setup-just@v1
  62. -
  63. name: Install node
  64. uses: actions/setup-node@v3
  65. with:
  66. node-version: '18.3.0'
  67. - name: Get npm cache directory
  68. id: npm-cache-dir
  69. shell: bash
  70. run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
  71. - uses: actions/cache@v3
  72. id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
  73. with:
  74. path: ${{ steps.npm-cache-dir.outputs.dir }}
  75. key: ${{ runner.os }}-node-${{ hashFiles('./ui/**/package-lock.json') }}
  76. restore-keys: |
  77. ${{ runner.os }}-node-
  78. -
  79. name: Build
  80. working-directory: ./ui
  81. run: |
  82. just build-local