pr_push_checks.yaml 2.6 KB

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