diff --git a/.github/workflows/browser.yml b/.github/workflows/browser.yml index 66a6a12b..752fd34a 100644 --- a/.github/workflows/browser.yml +++ b/.github/workflows/browser.yml @@ -16,7 +16,7 @@ jobs: with: fetch-depth: 10 - name: Use Node.js 20.x - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 20.x - run: npm ci diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7064059e..628c79a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,38 +2,40 @@ name: CI on: [push, pull_request] +env: + HUSKY: 0 + jobs: - ci: + lint: runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: 20.x + - run: npm ci + - run: npm run lint + test: + runs-on: ubuntu-latest + needs: lint strategy: + fail-fast: false matrix: node-version: [16.x, 18.x, 20.x] - steps: - uses: actions/checkout@v4 - with: - fetch-depth: 10 - - name: Use Node.js 20.x to build - uses: actions/setup-node@v3 - with: - node-version: 20.x - - run: npm install - - run: npm run build - - run: rm -rf node_modules - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} - - run: npm install + cache: npm + - run: npm ci - run: npm run test - env: - CI: true - - run: npm run lint - if: matrix.node-version == '20.x' - run: npm run docs:diff - if: matrix.node-version == '20.x' + if: matrix.node-version == 20 - run: npm run test:node - if: matrix.node-version >= '20.x' + if: matrix.node-version >= 20 - run: npm run test:pack - if: matrix.node-version >= '20.x' + if: matrix.node-version >= 20 diff --git a/package.json b/package.json index 344b6065..b038c60f 100644 --- a/package.json +++ b/package.json @@ -92,11 +92,11 @@ "examples:node:commonjs:test": "cd examples/node-commonjs && npm install && npm test", "examples:node:esmodules:test": "cd examples/node-esmodules && npm install && npm test", "examples:node:jest:test": "cd examples/node-jest && npm install && npm test", - "prepare": "cd $( git rev-parse --show-toplevel ) && husky install", + "prepare": "husky install", "lint": "npm run eslint:check && npm run prettier:check", "eslint:check": "eslint src/ test/ examples/ *.js", "eslint:fix": "eslint --fix src/ test/ examples/ *.js", - "pretest": "[ -n $CI ] || npm run build", + "pretest": "npm run build", "test": "BABEL_ENV=commonjsNode node --throw-deprecation node_modules/.bin/jest test/unit/", "test:matching": "BABEL_ENV=commonjsNode node --throw-deprecation node_modules/.bin/jest test/unit/ -t", "pretest:browser": "optional-dev-dependency && npm run build && npm-run-all --parallel examples:browser:**", @@ -110,7 +110,7 @@ "prettier:fix": "prettier --write .", "bundlewatch": "npm run pretest:browser && bundlewatch --config bundlewatch.config.json", "md": "runmd --watch --output=README.md README_js.md", - "docs": "( node --version | grep -q 'v20' ) && ( npm run build && npx runmd --output=README.md README_js.md )", + "docs": "npm run build && npx runmd --output=README.md README_js.md", "docs:diff": "npm run docs && git diff --quiet README.md", "build": "./scripts/build.sh", "prepack": "npm run build",