summaryrefslogtreecommitdiff
path: root/.github/workflows/tools.yml
blob: ee596784db20f36ebdf43698dbcd345c40ca0a4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
name: Tools and deps update
on:
  schedule:
    # Run once a week at 00:05 AM UTC on Sunday.
    - cron: 5 0 * * 0

  workflow_dispatch:
    inputs:
      id:
        description: The ID of the job to run
        required: true
        default: all
        type: choice
        options:
          - all
          - acorn
          - acorn-walk
          - ada
          - base64
          - brotli
          - c-ares
          - cjs-module-lexer
          - corepack
          - doc
          - eslint
          - googletest
          - icu
          - libuv
          - lint-md-dependencies
          - llhttp
          - nghttp2
          - nghttp3
          - ngtcp2
          - postject
          - root-certificates
          - simdutf
          - undici
          - uvwasi

env:
  PYTHON_VERSION: '3.11'

permissions:
  contents: read

jobs:
  tools-deps-update:
    if: github.repository == 'nodejs/node'
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false  # Prevent other jobs from aborting if one fails
      matrix:
        include:
          - id: eslint
            subsystem: tools
            label: tools
            run: |
              ./tools/dep_updaters/update-eslint.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: corepack
            subsystem: deps
            label: dependencies
            run: |
              make corepack-update
              echo "NEW_VERSION=$(node deps/corepack/dist/corepack.js --version)" >> $GITHUB_ENV
          - id: lint-md-dependencies
            subsystem: tools
            label: tools
            run: |
              cd tools/lint-md
              npm ci
              NEW_VERSION=$(npm outdated --parseable | cut -d: -f4 | xargs)
              if [ "$NEW_VERSION" != "" ]; then
                echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
                rm -rf package-lock.json node_modules
                # Include $NEW_VERSION to explicitly update the package.json
                # entry for the dependency and also so that semver-major updates
                # are not skipped.
                npm install --ignore-scripts $NEW_VERSION
                npm install --ignore-scripts
                cd ../..
                make lint-md-rollup
              fi
          - id: doc
            subsystem: tools
            label: tools
            run: |
              cd tools/doc
              npm ci
              NEW_VERSION=$(npm outdated --parseable | cut -d: -f4 | xargs)
              if [ "$NEW_VERSION" != "" ]; then
                echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV
                rm -rf package-lock.json node_modules
                # Include $NEW_VERSION to explicitly update the package.json
                # entry for the dependency and also so that semver-major updates
                # are not skipped.
                npm install --ignore-scripts $NEW_VERSION
                npm install --ignore-scripts
              fi
          - id: undici
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-undici.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: postject
            subsystem: deps,test
            label: test
            run: |
              ./tools/dep_updaters/update-postject.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: base64
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-base64.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: acorn
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-acorn.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: acorn-walk
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-acorn-walk.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: libuv
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-libuv.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: simdutf
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-simdutf.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: ada
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-ada.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: nghttp2
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-nghttp2.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: llhttp
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-llhttp.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: c-ares
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-c-ares.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: brotli
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-brotli.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: minimatch
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-minimatch.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: root-certificates
            subsystem: crypto
            label: crypto, notable-change
            run: |
              node ./tools/dep_updaters/update-root-certs.mjs -v -f "$GITHUB_ENV"
          - id: cjs-module-lexer
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-cjs-module-lexer.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: ngtcp2
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-ngtcp2.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: nghttp3
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-nghttp3.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: uvwasi
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-uvwasi.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: zlib
            subsystem: deps
            label: dependencies
            run: |
              ./tools/dep_updaters/update-zlib.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: googletest
            subsystem: deps
            label: dependencies, test
            run: |
              ./tools/dep_updaters/update-googletest.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
          - id: icu
            subsystem: deps
            label: dependencies, test
            run: |
              ./tools/dep_updaters/update-icu.sh > temp-output
              cat temp-output
              tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true
              rm temp-output
    steps:
      - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab  # v3.5.2
        if: github.event_name == 'schedule' || inputs.id == 'all' || inputs.id == matrix.id
        with:
          persist-credentials: false
      - name: Set up Python ${{ env.PYTHON_VERSION }}
        if: matrix.id == 'icu' && (github.event_name == 'schedule' || inputs.id == 'all' || inputs.id == matrix.id)
        uses: actions/setup-python@57ded4d7d5e986d7296eab16560982c6dd7c923b  # v4.6.0
        with:
          python-version: ${{ env.PYTHON_VERSION }}
      - run: ${{ matrix.run }}
        if: github.event_name == 'schedule' || inputs.id == 'all' || inputs.id == matrix.id
        env:
          GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
      - name: Generate commit message if not set
        if: env.COMMIT_MSG == '' && (github.event_name == 'schedule' || inputs.id == 'all' || inputs.id == matrix.id)
        run: |
          echo "COMMIT_MSG=${{ matrix.subsystem }}: update ${{ matrix.id }} to ${{ env.NEW_VERSION }}" >> "$GITHUB_ENV"
      - uses: gr2m/create-or-update-pull-request-action@77596e3166f328b24613f7082ab30bf2d93079d5
        if: github.event_name == 'schedule' || inputs.id == 'all' || inputs.id == matrix.id
        # Creates a PR or update the Action's existing PR, or
        # no-op if the base branch is already up-to-date.
        env:
          GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
        with:
          author: Node.js GitHub Bot <github-bot@iojs.org>
          body: This is an automated update of ${{ matrix.id }} to ${{ env.NEW_VERSION }}.
          branch: actions/tools-update-${{ matrix.id }}  # Custom branch *just* for this Action.
          commit-message: ${{ env.COMMIT_MSG }}
          labels: ${{ matrix.label }}
          title: '${{ matrix.subsystem }}: update ${{ matrix.id }} to ${{ env.NEW_VERSION }}'
          update-pull-request-title-and-body: true