diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af090a9be..56faf5ebe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,25 +5,55 @@ on: pull_request: branches: [master] jobs: + build: + runs-on: ubuntu-latest + name: Build on Node.js 22 + steps: + - name: Setup Node.js 22 + uses: actions/setup-node@v4 + with: + node-version: 22 + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install dependencies + run: npm install + - name: Build + run: npm run build + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: build-artifacts + path: | + index.js + lib/ + es/ + validator.js + validator.min.js + retention-days: 1 test: runs-on: ubuntu-latest + needs: build strategy: matrix: - node-version: [22, 20, 18, 16, 14, 12, 10, 8, 6] + node-version: [22, 20, 18, 16, 14, 12, 10, 8] name: Run tests on Node.js ${{ matrix.node-version }} steps: - - name: Setup Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - name: Checkout repository - uses: actions/checkout@v4 - - name: Install dependencies - run: npm install --legacy-peer-deps - - name: Run tests - run: npm test - - if: matrix.node-version == 22 - name: Send coverage info to Codecov - uses: codecov/codecov-action@v5 - with: - token: ${{ secrets.CODECOV_TOKEN }} + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + - name: Checkout repository + uses: actions/checkout@v4 + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: build-artifacts + - name: Install dependencies + run: npm install + - name: Run tests + run: npm run test:ci + - if: matrix.node-version == 22 + name: Send coverage info to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/build-browser.js b/build-browser.js index c863bd399..ba901da75 100644 --- a/build-browser.js +++ b/build-browser.js @@ -6,7 +6,7 @@ import babelPresetEnv from "@babel/preset-env"; import pkg from "./package.json"; rollup({ - entry: "src/index.js", + input: "src/index.js", plugins: [ babel({ presets: [[babelPresetEnv, { modules: false }]], @@ -16,9 +16,9 @@ rollup({ }) .then((bundle) => bundle.write({ - dest: "validator.js", + file: "validator.js", format: "umd", - moduleName: pkg.name, + name: pkg.name, banner: `/*!\n${String(fs.readFileSync("./LICENSE")) .trim() .split("\n") diff --git a/package.json b/package.json index 7e84ef71d..bd88d553c 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "npm-run-all": "^4.1.5", "nyc": "^14.1.0", "rimraf": "^3.0.0", - "rollup": "^0.47.0", + "rollup": "^2.0.0", "rollup-plugin-babel": "^4.0.1", "timezone-mock": "^1.3.6", "uglify-js": "^3.0.19" @@ -67,7 +67,8 @@ "build:node": "babel src -d .", "build": "run-p build:*", "pretest": "npm run build && npm run lint", - "test": "nyc --reporter=cobertura --reporter=text-summary mocha --require @babel/register --reporter dot --recursive" + "test": "npm run test:ci", + "test:ci": "nyc --reporter=cobertura --reporter=text-summary mocha --require @babel/register --reporter dot --recursive" }, "engines": { "node": ">= 0.10"