GeezerVison is showing github.com — Implement simultaneous PR checks for Node.js v20, v24. · github/codeql-action@a4ab3ec
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: .github/workflows/pr-checks.yml +9-3Lines changed: 9 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
20 | 20 | fail-fast: false |
21 | 21 | matrix: |
22 | 22 | os: [ubuntu-latest, macos-latest, windows-latest] |
| 23 | + node-version: [20, 24] |
23 | 24 | permissions: |
24 | 25 | contents: read |
25 | 26 | security-events: write # needed to upload ESLint results |
|
36 | 37 | - name: Set up Node.js |
37 | 38 | uses: actions/setup-node@v5 |
38 | 39 | with: |
39 | | - node-version: 24 |
| 40 | + node-version: ${{ matrix.node-version }} |
40 | 41 | cache: 'npm' |
41 | 42 |
|
42 | 43 | - name: Set up Python |
|
51 | 52 | npm config set script-shell bash |
52 | 53 | npm ci |
53 | 54 |
|
54 | | - - name: Verify compiled JS up to date |
| 55 | + - name: Verify compiled JS up to date (Node.js 20) |
| 56 | + if: matrix.node-version == 20 |
| 57 | + run: .github/workflows/script/check-js-20.sh |
| 58 | + |
| 59 | + - name: Verify compiled JS up to date (Node.js 24) |
| 60 | + if: matrix.node-version == 24 |
55 | 61 | run: .github/workflows/script/check-js.sh |
56 | 62 |
|
57 | 63 | - name: Verify PR checks up to date |
|
70 | 76 |
|
71 | 77 | - name: Upload sarif |
72 | 78 | uses: github/codeql-action/upload-sarif@v3 |
73 | | - if: matrix.os == 'ubuntu-latest' |
| 79 | + if: matrix.os == 'ubuntu-latest' && matrix.node-version == 24 |
74 | 80 | with: |
75 | 81 | sarif_file: eslint.sarif |
76 | 82 | category: eslint |
|
Collapse file
Copy file name to clipboard +34Lines changed: 34 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
| 1 | +#!/bin/bash |
| 2 | +set -eu |
| 3 | + |
| 4 | +# Change @types/node to v20 temporarily to check that the generated JS files are correct. |
| 5 | +contents=$(jq '.devDependencies."@types/node" = "^20.0.0"' package.json) |
| 6 | +echo "${contents}" > package.json |
| 7 | + |
| 8 | +npm install |
| 9 | + |
| 10 | +if [ ! -z "$(git status --porcelain)" ]; then |
| 11 | + |
| 12 | + git config --global user.name "github-actions[bot]" |
| 13 | + # The period in `git add --all .` ensures that we stage deleted files too. |
| 14 | + git add --all . |
| 15 | + git commit -m "Use @types/node v20" |
| 16 | +fi |
| 17 | + |
| 18 | +# Wipe the lib directory in case there are extra unnecessary files in there |
| 19 | +rm -rf lib |
| 20 | + |
| 21 | +# Generate the JavaScript files |
| 22 | +npm run-script build |
| 23 | + |
| 24 | +# Check that repo is still clean. |
| 25 | +# The downgrade of @types/node means that we expect certain changes to the generated JS files. |
| 26 | +# Therefore, we should ignore these changes to @types/node and check for outstanding changes. |
| 27 | +if [[ $(git diff | grep --perl-regexp '^-(?!--)' | grep --count --invert-match --perl-regexp '"@types/node": "\^24') -gt 0 || \ |
| 28 | + $(git diff | grep --perl-regexp '^\+(?!\+\+)' | grep --count --invert-match --perl-regexp '"@types/node": "\^20') -gt 0 ]] |
| 29 | +then |
| 30 | + >&2 echo "Failed: JavaScript files are not up to date. Run 'rm -rf lib && npm run-script build' to update" |
| 31 | + git diff |
| 32 | + exit 1 |
| 33 | +fi |
| 34 | +echo "Success: JavaScript files are up to date" |