Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 46 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
6 changes: 3 additions & 3 deletions build-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }]],
Expand All @@ -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")
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down