84 lines
2.5 KiB
YAML
84 lines
2.5 KiB
YAML
name: Dev
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- next
|
|
- v*
|
|
- patch-release
|
|
- "!renovate/**"
|
|
pull_request:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
test:
|
|
timeout-minutes: 15
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os:
|
|
- "ubuntu-latest"
|
|
- "macos-latest"
|
|
- "windows-latest"
|
|
node:
|
|
# Latest version
|
|
- "26"
|
|
# Minimal version for development
|
|
- "22"
|
|
include:
|
|
- os: "ubuntu-latest"
|
|
# Pick a version that is fast (normally highest LTS version)
|
|
# Doesn't work on Node.js v26 https://github.com/bcoe/c8/issues/592
|
|
node: "24"
|
|
ENABLE_CODE_COVERAGE: true
|
|
FULL_TEST: true
|
|
# Versions between "Latest version" and "Minimal version for development"
|
|
# that not tested on linux
|
|
# - os: "ubuntu-latest"
|
|
# node: "22"
|
|
env:
|
|
ENABLE_CODE_COVERAGE: ${{ matrix.ENABLE_CODE_COVERAGE }}
|
|
FULL_TEST: ${{ matrix.FULL_TEST }}
|
|
name: ${{ matrix.FULL_TEST && '[Full Test] ' || '' }} Node.js ${{ matrix.node }} on ${{ startsWith(matrix.os, 'macos') && 'MacOS' || startsWith(matrix.os, 'windows') && 'Windows' || 'Linux' }}
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
with:
|
|
node-version: ${{ matrix.node }}
|
|
cache: "yarn"
|
|
|
|
- name: Install Dependencies
|
|
run: yarn install --immutable
|
|
|
|
- name: Run Tests
|
|
if: ${{ !matrix.ENABLE_CODE_COVERAGE }}
|
|
run: yarn test
|
|
|
|
- name: Run Tests (coverage)
|
|
if: ${{ matrix.ENABLE_CODE_COVERAGE }}
|
|
run: yarn c8 yarn test
|
|
|
|
- name: Upload Coverage
|
|
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
|
|
if: ${{ matrix.ENABLE_CODE_COVERAGE && github.repository == 'prettier/prettier' }}
|
|
with:
|
|
fail_ci_if_error: true
|
|
disable_search: true
|
|
files: coverage/lcov.info
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
- name: "`--debug-benchmark` flag"
|
|
if: ${{ matrix.os != 'windows-latest' }}
|
|
run: node bin/prettier.cjs --debug-benchmark package.json 2>&1 >/dev/null | grep "Latency avg" || exit 1
|