Build: Bump the github-actions group with 2 updates
[jquery.git] / .github / workflows / node.js.yml
blob22b683a2125a786b55541635c0278d7f128e4920
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]
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"
41             NODE_VERSION: "20.x"
42             NPM_SCRIPT: "test:firefox"
43     steps:
44       - name: Checkout
45         uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
47       - name: Use Node.js ${{ matrix.NODE_VERSION }}
48         uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
49         with:
50           node-version: ${{ matrix.NODE_VERSION }}
52       - name: Cache
53         uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
54         with:
55           path: ~/.npm
56           key: ${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
57           restore-keys: |
58             ${{ runner.os }}-node-${{ matrix.NODE_VERSION }}-npm-lock-
60       - name: Install firefox ESR
61         run: |
62           export FIREFOX_SOURCE_URL='https://download.mozilla.org/?product=firefox-esr-latest-ssl&lang=en-US&os=linux64'
63           wget --no-verbose $FIREFOX_SOURCE_URL -O - | tar -jx -C ${HOME}
64         if: contains(matrix.NAME, 'Firefox ESR')
66       - name: Install dependencies
67         run: npm install
69       - name: Build All for Linting
70         run: npm run build:all
71         if: contains(matrix.NPM_SCRIPT, 'lint')
73       - name: Run tests
74         run: |
75           export PATH=${HOME}/firefox:$PATH
76           export FIREFOX_BIN=${HOME}/firefox/firefox
77           npm run ${{ matrix.NPM_SCRIPT }}
79   safari:
80     runs-on: macos-latest
81     env:
82       NODE_VERSION: 20.x
83     name: test:safari - Safari
84     steps:
85       - name: Checkout
86         uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
88       - name: Use Node.js ${{ env.NODE_VERSION }}
89         uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
90         with:
91           node-version: ${{ env.NODE_VERSION }}
93       - name: Cache
94         uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
95         with:
96           path: ~/.npm
97           key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }}
98           restore-keys: |
99             ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-
101       - name: Install dependencies
102         run: npm install
104       - name: Run tests
105         run: npm run test:safari