Bladeren bron

feat: pin node/npm versions and run npm build in CI (#3351)

Co-authored-by: Jose Diaz-Gonzalez <email@josediazgonzalez.com>
jose-fully-ported 2 jaren geleden
bovenliggende
commit
c85f13201e
2 gewijzigde bestanden met toevoegingen van 40 en 0 verwijderingen
  1. 36 0
      .github/workflows/pr_push_checks.yaml
  2. 4 0
      dashboard/package.json

+ 36 - 0
.github/workflows/pr_push_checks.yaml

@@ -1,6 +1,8 @@
 name: PR Checks
+
 on:
   - pull_request
+
 jobs:
   testing_matrix:
     strategy:
@@ -29,3 +31,37 @@ jobs:
         run: go vet ./${{ matrix.folder }}/...
       - name: Run Go tests
         run: go test ./${{ matrix.folder }}/...
+  build-npm:
+    name: Running smoke test npm build
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v3
+      - name: Setup Node
+        uses: actions/setup-node@v3
+        with:
+          node-version: 16
+      - name: Setup NPM
+        working-directory: dashboard
+        run: |
+          # installing updated npm
+
+          # Verify npm works before capturing and ensure its stderr is inspectable later
+          version="$(jq -r '.engines.npm' package.json)"
+          npm --version 2>&1 1>/dev/null
+
+          npm_version="$(npm --version)"
+          echo "Bootstrapping npm $version (replacing $npm_version)..."
+          npm install --unsafe-perm -g --quiet "npm@$version"
+
+          # Verify npm works before capturing and ensure its stderr is inspectable later
+          npm --version 2>&1 1>/dev/null
+          echo "npm $(npm --version) installed"
+      - name: Install NPM Dependencies
+        working-directory: dashboard
+        run: |
+          npm i --legacy-peer-deps
+      - name: Run NPM Build
+        working-directory: dashboard
+        run: |
+          npm run build

+ 4 - 0
dashboard/package.json

@@ -70,6 +70,10 @@
     "valtio": "^1.2.4",
     "zod": "^3.20.2"
   },
+  "engines": {
+    "node": ">=16 <17",
+    "npm": "9.7.2"
+  },
   "scripts": {
     "test": "echo \"Error: no test specified\" && exit 1",
     "start": "./node_modules/webpack-dev-server/bin/webpack-dev-server.js",