pr_push_checks.yaml 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. name: PR Checks
  2. on:
  3. pull_request:
  4. types: [ready_for_review]
  5. jobs:
  6. testing_matrix:
  7. strategy:
  8. matrix:
  9. os: [ubuntu-latest]
  10. folder: [cli, api, cmd, internal, provisioner]
  11. name: Running Go Tests
  12. runs-on: ${{ matrix.os }}
  13. steps:
  14. - uses: actions/checkout@v3
  15. - name: Setup Go Cache
  16. uses: actions/cache@v3
  17. with:
  18. path: |
  19. ~/.cache/go-build
  20. ~/go/pkg/mod
  21. key: porter-go-${{ hashFiles('**/go.sum') }}
  22. - uses: actions/setup-go@v4
  23. with:
  24. cache: false
  25. go-version: '1.20.5'
  26. go-version-file: go.mod
  27. - name: Download Go Modules
  28. run: go mod download
  29. - name: Run Go tests
  30. run: go test ./${{ matrix.folder }}/...
  31. linting:
  32. name: Go Linter
  33. runs-on: ubuntu-latest
  34. steps:
  35. - uses: actions/setup-go@v4
  36. with:
  37. cache: false
  38. go-version: '1.20.5'
  39. go-version-file: go.mod
  40. - uses: actions/checkout@v3
  41. - name: Setup Go Cache
  42. uses: actions/cache@v3
  43. with:
  44. path: |
  45. ~/.cache/go-build
  46. ~/go/pkg/mod
  47. key: porter-go-${{ hashFiles('**/go.sum') }}
  48. restore-keys: porter-go-`
  49. - name: golangci-lint
  50. uses: golangci/golangci-lint-action@v3
  51. with:
  52. version: latest
  53. args: -c .github/golangci-lint.yaml --verbose
  54. skip-pkg-cache: true
  55. only-new-issues: true # this is needed until the following is merged: https://github.com/golangci/golangci-lint-action/issues/820
  56. build-npm:
  57. name: Running smoke test npm build
  58. runs-on: ubuntu-latest
  59. steps:
  60. - name: Checkout code
  61. uses: actions/checkout@v3
  62. - name: Setup Node
  63. uses: actions/setup-node@v3
  64. with:
  65. node-version: 16
  66. - name: Setup NPM
  67. working-directory: dashboard
  68. run: |
  69. # installing updated npm
  70. # Verify npm works before capturing and ensure its stderr is inspectable later
  71. version="$(jq -r '.engines.npm' package.json)"
  72. npm --version 2>&1 1>/dev/null
  73. npm_version="$(npm --version)"
  74. echo "Bootstrapping npm $version (replacing $npm_version)..."
  75. npm install --unsafe-perm -g --quiet "npm@$version"
  76. # Verify npm works before capturing and ensure its stderr is inspectable later
  77. npm --version 2>&1 1>/dev/null
  78. echo "npm $(npm --version) installed"
  79. - name: Install NPM Dependencies
  80. working-directory: dashboard
  81. run: |
  82. npm i --legacy-peer-deps
  83. - name: Run NPM Build
  84. working-directory: dashboard
  85. run: |
  86. npm run build