pr_push_checks.yaml 2.6 KB

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