mirror of https://github.com/webpack/webpack.git
164 lines
5.4 KiB
YAML
164 lines
5.4 KiB
YAML
name: Test
|
|
|
|
# cspell:word eslintcache
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- dev-1
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- dev-1
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: lts/*
|
|
cache: "yarn"
|
|
- run: yarn --frozen-lockfile
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: .eslintcache
|
|
key: lint-${{ env.GITHUB_SHA }}
|
|
restore-keys: lint-
|
|
- run: yarn lint
|
|
basic:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v4
|
|
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
|
|
- uses: codecov/codecov-action@v4
|
|
with:
|
|
flags: basic
|
|
functionalities: gcov
|
|
validate-legacy-node:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v4
|
|
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));"
|
|
- run: yarn install --production --frozen-lockfile
|
|
unit:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- name: Use Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: lts/*
|
|
cache: "yarn"
|
|
- run: yarn --frozen-lockfile
|
|
- run: yarn link --frozen-lockfile || true
|
|
- run: yarn link webpack --frozen-lockfile
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: .jest-cache
|
|
key: jest-unit-${{ env.GITHUB_SHA }}
|
|
restore-keys: jest-unit-
|
|
- run: yarn cover:unit --ci --cacheDirectory .jest-cache
|
|
- uses: codecov/codecov-action@v4
|
|
with:
|
|
flags: unit
|
|
functionalities: gcov
|
|
integration:
|
|
needs: basic
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
node-version: [10.x, 20.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 the latest version of Node.js
|
|
- os: ubuntu-latest
|
|
node-version: 21.x
|
|
part: a
|
|
- os: ubuntu-latest
|
|
node-version: 21.x
|
|
part: b
|
|
# Test on the old LTS version of Node.js
|
|
- os: ubuntu-latest
|
|
node-version: 18.x
|
|
part: a
|
|
- os: ubuntu-latest
|
|
node-version: 18.x
|
|
part: b
|
|
# Test on old Node.js versions
|
|
- 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@v4
|
|
- name: Use Node.js ${{ matrix.node-version }}
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: ${{ matrix.node-version }}
|
|
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-junit@^13.0.0 @types/jest@^27.4.0 pretty-format@^27.0.2 husky@^8.0.3 lint-staged@^13.2.1 --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 eslint-plugin-jsdoc@^47.0.0 husky@^8.0.3 lint-staged@^13.2.1
|
|
yarn --frozen-lockfile
|
|
if: matrix.node-version == '16.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#master
|
|
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'
|
|
- run: yarn link --frozen-lockfile || true
|
|
- run: yarn link webpack --frozen-lockfile
|
|
- uses: actions/cache@v4
|
|
with:
|
|
path: .jest-cache
|
|
key: jest-integration-${{ env.GITHUB_SHA }}
|
|
restore-keys: jest-integration-
|
|
- run: yarn cover:integration:${{ matrix.part }} --ci --cacheDirectory .jest-cache || yarn cover:integration:${{ matrix.part }} --ci --cacheDirectory .jest-cache -f
|
|
- run: yarn cover:merge
|
|
- uses: codecov/codecov-action@v4
|
|
with:
|
|
flags: integration
|
|
functionalities: gcov
|