Build: Bump the github-actions group with 4 updates
[jquery.git] / .github / workflows / node.js.yml
blob28651d62b52ea5ef2ef70f94c1e1382989dfe6ee
1 name: Node
3 on:
4   pull_request:
5   push:
6     branches-ignore: "dependabot/**"
8 permissions:
9   contents: read # to fetch code (actions/checkout)
11 jobs:
12   build-and-test:
13     runs-on: ubuntu-latest
14     name: ${{ matrix.NPM_SCRIPT }} - ${{ matrix.NAME }} (${{ matrix.NODE_VERSION }})
15     strategy:
16       fail-fast: false
17       matrix:
18         NAME: ["Node"]
19         NODE_VERSION: [18.x, 20.x, 22.x, 23.x]
20         NPM_SCRIPT: ["test:browserless"]
21         include:
22           - NAME: "Node"
23             NODE_VERSION: "20.x"
24             NPM_SCRIPT: "lint"
25           - NAME: "Chrome/Firefox"
26             NODE_VERSION: "20.x"
27             NPM_SCRIPT: "test:browser"
28           - NAME: "Chrome"
29             NODE_VERSION: "20.x"
30             NPM_SCRIPT: "test:slim"
31           - NAME: "Chrome"
32             NODE_VERSION: "20.x"
33             NPM_SCRIPT: "test:no-deprecated"
34           - NAME: "Chrome"
35             NODE_VERSION: "20.x"
36             NPM_SCRIPT: "test:selector-native"
37           - NAME: "Chrome"
38             NODE_VERSION: "20.x"
39             NPM_SCRIPT: "test:esm"
40           - NAME: "Firefox ESR (new)"
41             NODE_VERSION: "20.x"
42             NPM_SCRIPT: "test:firefox"
43           - NAME: "Firefox ESR (old)"
44             NODE_VERSION: "20.x"
45             NPM_SCRIPT: "test:firefox"
46     steps:
47       - name: Checkout
48         uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
50       - name: Use Node.js ${{ matrix.NODE_VERSION }}
51         uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
52         with:
53           node-version: ${{ matrix.NODE_VERSION }}
55       - name: Cache
56         uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
57         with:
58           path: ~/.npm
59           key: ${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
60           restore-keys: |
61             ${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-npm-lock-
63       - name: Set download URL for Firefox ESR (old)
64         run: |
65           echo "FIREFOX_SOURCE_URL=https://download.mozilla.org/?product=firefox-esr-latest-ssl&lang=en-US&os=linux64" >> "$GITHUB_ENV"
66         if: contains(matrix.NAME, 'Firefox ESR (old)')
68       - name: Set download URL for Firefox ESR (new)
69         run: |
70           echo "FIREFOX_SOURCE_URL=https://download.mozilla.org/?product=firefox-esr-next-latest-ssl&lang=en-US&os=linux64" >> "$GITHUB_ENV"
71         if: contains(matrix.NAME, 'Firefox ESR (new)')
73       - name: Install Firefox ESR
74         run: |
75           wget --no-verbose $FIREFOX_SOURCE_URL -O - | tar -jx -C ${HOME}
76           echo "PATH=${HOME}/firefox:$PATH" >> "$GITHUB_ENV"
77           echo "FIREFOX_BIN=${HOME}/firefox/firefox" >> "$GITHUB_ENV"
78         if: contains(matrix.NAME, 'Firefox ESR')
80       - name: Install dependencies
81         run: npm install
83       - name: Build All for Linting
84         run: npm run build:all
85         if: contains(matrix.NPM_SCRIPT, 'lint')
87       - name: Run tests
88         run: npm run ${{ matrix.NPM_SCRIPT }}
90   ie:
91     runs-on: windows-latest
92     env:
93       NODE_VERSION: 20.x
94     name: test:ie - IE
95     steps:
96       - name: Checkout
97         uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
99       - name: Use Node.js ${{ env.NODE_VERSION }}
100         uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
101         with:
102           node-version: ${{ env.NODE_VERSION }}
104       - name: Cache
105         uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
106         with:
107           path: ~/.npm
108           key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
109           restore-keys: |
110             ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
112       - name: Install dependencies
113         run: npm install
115       - name: Run tests in Edge in IE mode
116         run: npm run test:ie
118   safari:
119     runs-on: macos-latest
120     env:
121       NODE_VERSION: 20.x
122     name: test:safari - Safari
123     steps:
124       - name: Checkout
125         uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
127       - name: Use Node.js ${{ env.NODE_VERSION }}
128         uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
129         with:
130           node-version: ${{ env.NODE_VERSION }}
132       - name: Cache
133         uses: actions/cache@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
134         with:
135           path: ~/.npm
136           key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
137           restore-keys: |
138             ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
140       - name: Install dependencies
141         run: npm install
143       - name: Run tests
144         run: npm run test:safari