webpack/azure-pipelines.yml

314 lines
11 KiB
YAML

variables:
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn
jobs:
- job: basic
pool:
vmImage: ubuntu-latest
steps:
- task: UseNode@1
inputs:
version: "22.x"
displayName: "Install Node.js"
- script: |
node -v
yarn -v
displayName: "Print versions"
- task: Cache@2
inputs:
key: 'yarn | "$(Agent.OS)" | yarn.lock'
restoreKeys: |
yarn | "$(Agent.OS)"
yarn
path: $(YARN_CACHE_FOLDER)
displayName: "Cache Yarn packages"
- script: |
yarn --frozen-lockfile
yarn link --frozen-lockfile || true
yarn link webpack --frozen-lockfile
displayName: "Install dependencies"
- script: |
export JEST_JUNIT_OUTPUT_NAME=basic-junit.xml
yarn test:basic --ci --reporters=default --reporters=jest-junit
export JEST_JUNIT_OUTPUT_NAME=unit-junit.xml
yarn test:unit --ci --reporters=default --reporters=jest-junit
env:
CI: "true"
displayName: "Run basic tests"
- task: PublishTestResults@2
inputs:
testRunTitle: "basic"
testResultsFiles: "**/basic-junit.xml"
condition: succeededOrFailed()
displayName: "Publish basic test results"
- script: |
node -e "const fs = require('fs');let data = fs.readFileSync('unit-junit.xml', 'utf-8');fs.writeFileSync('unit-junit.xml', data.replace(/\0/g, 'NULL_CHARACTER'))"
displayName: "Fix junit output"
- task: PublishTestResults@2
inputs:
testRunTitle: "unit"
testResultsFiles: "**/unit-junit.xml"
condition: succeededOrFailed()
displayName: "Publish unit test results"
- job: lint
pool:
vmImage: ubuntu-latest
steps:
- task: UseNode@1
inputs:
version: "18.x"
displayName: "Install Node.js"
- script: |
node -v
yarn -v
displayName: "Print versions"
- task: Cache@2
inputs:
key: 'yarn | "$(Agent.OS)" | yarn.lock'
restoreKeys: |
yarn | "$(Agent.OS)"
yarn
path: $(YARN_CACHE_FOLDER)
displayName: "Cache Yarn packages"
- script: |
yarn --frozen-lockfile
yarn link --frozen-lockfile || true
yarn link webpack --frozen-lockfile
displayName: "Install dependencies"
- script: |
yarn lint
env:
CI: "true"
displayName: "Run linting"
- job: Windows
dependsOn:
- basic
- lint
pool:
vmImage: windows-latest
strategy:
maxParallel: 6
matrix:
node-10-a:
node_version: 10.x
part: a
node-10-b:
node_version: 10.x
part: b
node-18-a:
node_version: 18.x
part: a
node-18-b:
node_version: 18.x
part: b
node-20-a:
node_version: 20.x
part: a
node-20-b:
node_version: 20.x
part: b
steps:
- task: UseNode@1
inputs:
version: $(node_version)
displayName: "Install Node.js $(node_version)"
- script: |
node -v
yarn -v
displayName: "Print versions"
- task: Cache@2
inputs:
key: 'yarn | "$(Agent.OS)" | yarn.lock'
restoreKeys: |
yarn | "$(Agent.OS)"
yarn
path: $(YARN_CACHE_FOLDER)
displayName: "Cache Yarn packages"
# Install old `jest` version and ignore platform problem for legacy node versions
- script: |
node -e "const fs = require('fs');fs.createReadStream('yarn.lock').pipe(fs.createWriteStream('.yarn.lock'));"
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 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 mini-css-extract-plugin@^1.6.1 nyc@17.0.0 --ignore-engines
yarn --frozen-lockfile --ignore-engines
displayName: "Install dependencies (old node.js version)"
condition: eq(variables['node_version'], '10.x')
- script: yarn --frozen-lockfile
displayName: "Install dependencies"
condition: not(eq(variables['node_version'], '10.x'))
- script: yarn link --frozen-lockfile || true
displayName: "Link webpack"
continueOnError: true
- script: yarn link webpack --frozen-lockfile
displayName: "Link webpack into node_modules"
- script: |
yarn cover:integration:$(part) --ci --maxWorkers=2 --reporters=default --reporters=jest-junit || yarn cover:integration:$(part) --ci --maxWorkers=2 --reporters=default --reporters=jest-junit -f
yarn cover:merge
env:
CI: "true"
displayName: "Run tests with coverage"
- task: PublishTestResults@2
inputs:
testRunTitle: "Windows with Node.js $(node_version)"
testResultsFiles: "**/junit.xml"
condition: succeededOrFailed()
displayName: "Publish test results"
- script: node -e "const fs = require('fs');fs.createReadStream('.yarn.lock').pipe(fs.createWriteStream('yarn.lock'));"
displayName: "Restore original yarn.lock"
condition: eq(variables['node_version'], '10.x')
- job: Linux
dependsOn:
- basic
- lint
pool:
vmImage: ubuntu-latest
strategy:
maxParallel: 6
matrix:
node-10-a:
node_version: 10.x
part: a
node-10-b:
node_version: 10.x
part: b
node-18-a:
node_version: 18.x
part: a
node-18-b:
node_version: 18.x
part: b
node-20-a:
node_version: 20.x
part: a
node-20-b:
node_version: 20.x
part: b
steps:
- task: UseNode@1
inputs:
version: $(node_version)
displayName: "Install Node.js $(node_version)"
- script: |
node -v
yarn -v
displayName: "Print versions"
- task: Cache@2
inputs:
key: 'yarn | "$(Agent.OS)" | yarn.lock'
restoreKeys: |
yarn | "$(Agent.OS)"
yarn
path: $(YARN_CACHE_FOLDER)
displayName: "Cache Yarn packages"
# Doesn't work due to modified yarn.lock
condition: not(eq(variables['node_version'], '10.x'))
# Install old `jest` version and ignore platform problem for legacy node versions
- script: |
node -e "const fs = require('fs');fs.createReadStream('yarn.lock').pipe(fs.createWriteStream('.yarn.lock'));"
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 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 mini-css-extract-plugin@^1.6.1 nyc@17.0.0 --ignore-engines
yarn --frozen-lockfile --ignore-engines
displayName: "Install dependencies (old node.js version)"
condition: eq(variables['node_version'], '10.x')
- script: |
yarn --frozen-lockfile
displayName: "Install dependencies"
condition: not(eq(variables['node_version'], '10.x'))
- script: yarn link --frozen-lockfile || true
displayName: "Link webpack"
continueOnError: true
- script: yarn link webpack --frozen-lockfile
displayName: "Link webpack into node_modules"
- script: |
yarn cover:integration:$(part) --ci --maxWorkers=2 --reporters=default --reporters=jest-junit || yarn cover:integration:$(part) --ci --maxWorkers=2 --reporters=default --reporters=jest-junit -f
yarn cover:merge
env:
CI: "true"
displayName: "Run tests with coverage"
- task: PublishTestResults@2
inputs:
testRunTitle: "Linux with Node.js $(node_version)"
testResultsFiles: "**/junit.xml"
condition: succeededOrFailed()
displayName: "Publish test results"
- script: node -e "const fs = require('fs');fs.createReadStream('.yarn.lock').pipe(fs.createWriteStream('yarn.lock'));"
displayName: "Restore original yarn.lock"
condition: eq(variables['node_version'], '10.x')
- job: macOS
dependsOn:
- basic
- lint
pool:
vmImage: macOS-latest
strategy:
maxParallel: 6
matrix:
node-10-a:
node_version: 10.x
part: a
node-10-b:
node_version: 10.x
part: b
node-18-a:
node_version: 18.x
part: a
node-18-b:
node_version: 18.x
part: b
node-20-a:
node_version: 20.x
part: a
node-20-b:
node_version: 20.x
part: b
steps:
- task: UseNode@1
inputs:
version: $(node_version)
displayName: "Install Node.js $(node_version)"
- script: |
node -v
yarn -v
displayName: "Print versions"
- task: Cache@2
inputs:
key: 'yarn | "$(Agent.OS)" | yarn.lock'
restoreKeys: |
yarn | "$(Agent.OS)"
yarn
path: $(YARN_CACHE_FOLDER)
displayName: "Cache Yarn packages"
# Doesn't work due to modified yarn.lock
condition: not(eq(variables['node_version'], '10.x'))
- script: |
node -e "const fs = require('fs');fs.createReadStream('yarn.lock').pipe(fs.createWriteStream('.yarn.lock'));"
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 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 mini-css-extract-plugin@^1.6.1 nyc@17.0.0 --ignore-engines
yarn --frozen-lockfile --ignore-engines
displayName: "Install dependencies (old node.js version)"
condition: eq(variables['node_version'], '10.x')
- script: |
yarn --frozen-lockfile
displayName: "Install dependencies"
condition: not(eq(variables['node_version'], '10.x'))
- script: yarn link --frozen-lockfile || true
displayName: "Link webpack"
continueOnError: true
- script: yarn link webpack --frozen-lockfile
displayName: "Link webpack into node_modules"
- script: |
yarn cover:integration:$(part) --ci --reporters=default --reporters=jest-junit || yarn cover:integration:$(part) --ci --reporters=default --reporters=jest-junit -f
yarn cover:merge
env:
CI: "true"
displayName: "Run tests with coverage"
- task: PublishTestResults@2
inputs:
testRunTitle: "macOS with Node.js $(node_version)"
testResultsFiles: "**/junit.xml"
condition: succeededOrFailed()
displayName: "Publish test results"
- script: node -e "const fs = require('fs');fs.createReadStream('.yarn.lock').pipe(fs.createWriteStream('yarn.lock'));"
displayName: "Restore original yarn.lock"
condition: eq(variables['node_version'], '10.x')