/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
.github/workflows/test.yml
481 строка
18 KB
Alexander Akait
perf(css): recycle nested block contents during the walk (#21628)
10 авг 2026, 01:32
Не верифицирован
10 авг 2026, 01:32
ce12f4e
Код
Авторство
О чём код?
name: Github Actions on: push: branches: [main] pull_request: branches: [main] concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true permissions: contents: read jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: fetch-depth: 0 - name: Use Node.js uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: node-version: lts/* cache: yarn - run: yarn --frozen-lockfile - name: Cache prettier result uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: ./node_modules/.cache/prettier/.prettier-cache key: lint-prettier-${{ runner.os }}-node-${{ hashFiles('**/yarn.lock', '**/.prettierrc.js') }} restore-keys: lint-prettier- - name: Cache eslint result uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: .eslintcache key: lint-eslint-${{ runner.os }}-node-${{ hashFiles('**/yarn.lock', '**/eslint.config.mjs') }} restore-keys: lint-eslint- - name: Cache cspell result uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: .cspellcache key: lint-cspell-${{ runner.os }}-node-${{ hashFiles('**/yarn.lock', '**/cspell.json') }} restore-keys: lint-cspell- - run: yarn lint - name: Validate types using old typescript version run: | yarn upgrade typescript@5.0 @types/node@20 yarn --frozen-lockfile yarn validate:types - name: Validate changeset format if: github.event_name == 'pull_request' run: | yarn validate:changeset types-coverage: if: github.repository == 'webpack/webpack' && github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest permissions: contents: write pull-requests: write steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Use Node.js uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: node-version: lts/* cache: yarn - run: yarn --frozen-lockfile - run: yarn link --frozen-lockfile || true - run: yarn link webpack --frozen-lockfile - name: Collect types coverage run: yarn types:cover:report - uses: jwalton/gh-find-current-pr@f3d61b485d2801773f7a07b2aaa3306bd8f8e653 # v1.3.5 id: findPr - uses: Nef10/lcov-reporter-action@797ec1c1e78e3a9a7890c1a104d58b9e05fcef76 # v0.3.0 with: pr-number: ${{ steps.findPr.outputs.number }} lcov-file: ./coverage/lcov.info title: Types Coverage delete-old-comments: true validate-legacy-node: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Use Node.js 10.x uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: node-version: 10.x cache: yarn # Remove `devDependencies` from `package.json` to avoid `yarn install` compatibility error - run: node -e "const content = require('./package.json');delete content.devDependencies;require('fs').writeFileSync('package.json', JSON.stringify(content, null, 2));" # `--ignore-engines`: some transitive deps (e.g. node-releases) declare # `engines.node >= 18` but run fine on old Node; matches the other legacy jobs - run: yarn install --production --frozen-lockfile --ignore-engines basic: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Use Node.js uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: node-version: lts/* cache: yarn - run: yarn --frozen-lockfile - run: yarn link --frozen-lockfile || true - run: yarn link webpack --frozen-lockfile - run: yarn test:basic --ci unit: runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Use Node.js uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: node-version: lts/* cache: yarn - run: yarn --frozen-lockfile - run: yarn link --frozen-lockfile || true - run: yarn link webpack --frozen-lockfile - name: Cache jest result uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: .jest-cache key: jest-unit-${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/jest.config.js') }}-${{ github.sha }} restore-keys: | jest-unit-${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/jest.config.js') }}- jest-unit-${{ runner.os }}- - run: yarn cover:unit --ci --cacheDirectory .jest-cache - name: Codecov uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 with: flags: unit env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} test262: needs: basic strategy: fail-fast: false matrix: shard: [1/2, 2/2] runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: submodules: true - name: Use Node.js uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: # Pinned; revert to "latest" once https://github.com/nodejs/node/issues/63715 is resolved node-version: "26.2.0" cache: yarn - run: yarn --frozen-lockfile - run: yarn link --frozen-lockfile || true - run: yarn link webpack --frozen-lockfile - name: Cache jest result uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: .jest-cache key: jest-test262-${{ matrix.shard }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/jest.config.js') }}-${{ github.sha }} restore-keys: | jest-test262-${{ matrix.shard }}-${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/jest.config.js') }}- jest-test262-${{ matrix.shard }}-${{ runner.os }}- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: repository: tc39/test262 path: test/js/test262 ref: f2d59ea6e4b2f6f87de9f0d18a41d73782b6a9bc - run: yarn cover:test262 --ci --cacheDirectory .jest-cache env: SHARD: ${{ matrix.shard }} - name: Codecov uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 with: flags: test262 env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} html5lib: needs: basic runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: submodules: true - name: Use Node.js uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: node-version: lts/* cache: yarn - run: yarn --frozen-lockfile - run: yarn link --frozen-lockfile || true - run: yarn link webpack --frozen-lockfile - name: Cache jest result uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: .jest-cache key: jest-html5lib-${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/jest.config.js') }}-${{ github.sha }} restore-keys: | jest-html5lib-${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/jest.config.js') }}- jest-html5lib-${{ runner.os }}- - run: yarn cover:html5lib --ci --cacheDirectory .jest-cache - name: Codecov uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 with: flags: html5lib env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} css-parsing: needs: basic runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: submodules: true - name: Use Node.js uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: node-version: lts/* cache: yarn - run: yarn --frozen-lockfile - run: yarn link --frozen-lockfile || true - run: yarn link webpack --frozen-lockfile - name: Cache jest result uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: .jest-cache key: jest-css-parsing-${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/jest.config.js') }}-${{ github.sha }} restore-keys: | jest-css-parsing-${{ runner.os }}-${{ hashFiles('**/yarn.lock', '**/jest.config.js') }}- jest-css-parsing-${{ runner.os }}- - run: yarn cover:css-parsing --ci --cacheDirectory .jest-cache - name: Codecov uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 with: flags: css-parsing env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} # Run webpack's test suite under Deno and Bun (spec validation suites excluded). runtimes: needs: basic strategy: fail-fast: false matrix: runtime: [deno, bun] runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Use Node.js uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: node-version: lts/* cache: yarn - name: Use Deno if: matrix.runtime == 'deno' uses: denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed # v2.0.5 with: deno-version: v2.x - name: Use Bun if: matrix.runtime == 'bun' uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0 with: bun-version: latest - run: yarn --frozen-lockfile - run: yarn link --frozen-lockfile || true - run: yarn link webpack --frozen-lockfile # Bun runs with worker_threads (see test:base:bun): in-band's single heap # OOMs the runner on the full suite and Bun's child_process workers hang, but # threads work once jest-worker loads the Bun preload per thread. Apply that # patch here (Bun only) rather than via a repo-wide postinstall. The # jest-runner patch tolerates Bun's transient memoryUsage failures. The # jest-worker patch also has a Bun worker end itself rather than be # terminated from the parent, which segfaults Bun on an idle-memory restart # — and exit once it has, since ending only drops its message listener and # a worker still holding a handle would never be replaced. That buys Bun a # restart it would not otherwise survive, but not a run full of them, so the # limit has to sit above what the suite actually uses (see test:base:bun). - if: matrix.runtime == 'bun' run: | git apply test/patches/jest-worker+30.4.1.patch git apply test/patches/jest-runner+30.4.2.patch # Deno and Bun both run with jest's parallel workers. The HotTestCases # suites are dropped for Deno only (see test:deno): under Deno's event-loop # timing webpack's async cache/compilation tails outlive a suite's teardown # and require a module after the Jest environment is gone. Bun runs them with # only a few per-case test.filter.js skips. - run: yarn test:${{ matrix.runtime }} --ci integration: needs: basic strategy: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] node-version: [10.x, 22.x, 24.x, 26.x] part: [a, b] include: # Test with main branches of webpack dependencies - os: ubuntu-latest node-version: lts/* part: a use_main_branches: 1 - os: ubuntu-latest node-version: lts/* part: b use_main_branches: 1 # Test on old Node.js versions - os: ubuntu-latest node-version: 20.x part: a - os: ubuntu-latest node-version: 18.x part: a - os: ubuntu-latest node-version: 16.x part: a - os: ubuntu-latest node-version: 14.x part: a - os: ubuntu-latest node-version: 12.x part: a runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 id: calculate_architecture with: result-encoding: string script: | if ('${{ matrix.os }}' === 'macos-latest' && '${{ matrix['node-version'] }}' === '10.x') { return "x64" } else { return '' } - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 with: node-version: ${{ matrix.node-version }} architecture: ${{ steps.calculate_architecture.outputs.result }} cache: yarn # Install old `jest` version and deps for legacy node versions - run: | yarn upgrade jest@^27.5.0 jest-circus@^27.5.0 jest-cli@^27.5.0 jest-diff@^27.5.0 jest-environment-node@^27.5.0 jest-snapshot@^27.5.0 jest-junit@^13.0.0 @types/jest@^27.4.0 pretty-format@^27.0.2 husky@^8.0.3 lint-staged@^13.2.1 cspell@^6.31.1 open-cli@^7.2.0 coffee-loader@^1.0.0 babel-loader@^8.1.0 style-loader@^2.0.0 css-loader@^5.0.1 less-loader@^8.1.1 less@4.5.1 mini-css-extract-plugin@^1.6.1 nyc@^15.1.0 memfs@4.14.0 --ignore-engines yarn --frozen-lockfile --ignore-engines if: matrix.node-version == '10.x' || matrix.node-version == '12.x' || matrix.node-version == '14.x' - run: | yarn upgrade jest@^27.5.0 jest-circus@^27.5.0 jest-cli@^27.5.0 jest-diff@^27.5.0 jest-environment-node@^27.5.0 jest-snapshot@^27.5.0 jest-junit@^13.0.0 @types/jest@^27.4.0 pretty-format@^27.0.2 husky@^8.0.3 lint-staged@^13.2.1 nyc@^15.1.0 coffee-loader@1.0.0 babel-loader@^8.1.0 style-loader@^2.0.0 css-loader@^5.0.1 less-loader@^8.1.1 mini-css-extract-plugin@^1.6.1 --ignore-engines yarn --frozen-lockfile if: matrix.node-version == '16.x' - run: | yarn upgrade cspell@^8.8.4 lint-staged@^15.2.5 --ignore-engines yarn --frozen-lockfile if: matrix.node-version == '18.x' - run: | yarn upgrade cspell@^9 --ignore-engines yarn --frozen-lockfile if: matrix.node-version == '20.x' - run: | yarn upgrade pkg-pr-new@0.0.66 yarn --frozen-lockfile if: matrix.node-version == '22.x' # Install main version of our deps - run: yarn upgrade enhanced-resolve@webpack/enhanced-resolve#main loader-runner@webpack/loader-runner#main webpack-sources@webpack/webpack-sources#main watchpack@webpack/watchpack#main tapable@webpack/tapable#main if: matrix.use_main_branches == '1' # Install dependencies for LTS node versions - run: yarn --frozen-lockfile if: matrix.node-version != '10.x' && matrix.node-version != '12.x' && matrix.node-version != '14.x' && matrix.node-version != '16.x' && matrix.node-version != '18.x' && matrix.node-version != '20.x' && matrix.node-version != '22.x' - run: yarn link --frozen-lockfile || true - run: yarn link webpack --frozen-lockfile - name: Cache jest result uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: .jest-cache key: jest-integration-${{ runner.os }}-node-${{ matrix.node-version }}-${{ matrix.part }}-${{ hashFiles('**/yarn.lock', '**/jest.config.js') }}-${{ github.sha }} restore-keys: | jest-integration-${{ runner.os }}-node-${{ matrix.node-version }}-${{ matrix.part }}-${{ hashFiles('**/yarn.lock', '**/jest.config.js') }}- jest-integration-${{ runner.os }}-node-${{ matrix.node-version }}-${{ matrix.part }}- - run: yarn cover:integration:${{ matrix.part }} --ci --cacheDirectory .jest-cache || yarn cover:integration:${{ matrix.part }} --ci --cacheDirectory .jest-cache -f env: MAIN_BRANCHES: ${{ matrix.use_main_branches }} if: matrix.node-version != '10.x' && matrix.node-version != '12.x' && matrix.node-version != '14.x' && matrix.node-version != '16.x' && matrix.node-version != '18.x' && matrix.node-version != '20.x' # Don't run code coverage analysis on older versions of NodeJS, this will speed up our CI - run: yarn test:integration:${{ matrix.part }} --ci --cacheDirectory .jest-cache || yarn test:integration:${{ matrix.part }} --ci --cacheDirectory .jest-cache -f if: matrix.node-version == '10.x' || matrix.node-version == '12.x' || matrix.node-version == '14.x' || matrix.node-version == '16.x' || matrix.node-version == '18.x' || matrix.node-version == '20.x' - run: yarn report:cover:merge if: matrix.node-version != '10.x' && matrix.node-version != '12.x' && matrix.node-version != '14.x' && matrix.node-version != '16.x' && matrix.node-version != '18.x' && matrix.node-version != '20.x' - name: Codecov uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 with: files: ./coverage/coverage-nyc.json,./coverage/coverage-final.json directory: ./coverage/ disable_search: true flags: integration env: CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} if: matrix.node-version != '10.x' && matrix.node-version != '12.x' && matrix.node-version != '14.x' && matrix.node-version != '16.x' && matrix.node-version != '18.x' && matrix.node-version != '20.x'