diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17e2f92..e1bb1fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,21 +1,54 @@ name: CI + on: [push, pull_request] + jobs: - test: - name: ${{ matrix.node-version }} ${{ matrix.os }} - runs-on: ${{ matrix.os }} + legacy: + runs-on: ubuntu-latest + strategy: - fail-fast: false matrix: - os: [ubuntu-latest] - node-version: [6, 8, 10, 11, 12, 13, 14, 15] + node-version: [6.x, 8.x, 10.x, 12.x, 13.x] + steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} + - uses: actions/checkout@v3 + with: + persist-credentials: false + + - name: Use Node.js uses: actions/setup-node@v1 with: node-version: ${{ matrix.node-version }} + + - name: Install + run: | + npm install --production && npm install tape + + - name: Run tests + run: | + npm run legacy + + test: + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [14.x, 15.x, 16.x, 18.x, 20.x] + + steps: + - uses: actions/checkout@v3 + with: + persist-credentials: false + + - name: Use Node.js + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: Install - run: npm i - - name: Tests - run: npm test + run: | + npm install + + - name: Run tests + run: | + npm run test diff --git a/benchmark.js b/benchmark.js index a3f4e72..e876ff9 100644 --- a/benchmark.js +++ b/benchmark.js @@ -76,7 +76,13 @@ suite.add('hyperid - fixed length, url safe', function () { suite.on('cycle', cycle) -suite.run() +suite.on('complete', function () { + console.log('\n') + console.log(`Fastest is ${this.filter('fastest').map('name')}`) + console.log(`Slowest is ${this.filter('slowest').map('name')}`) +}) + +suite.run({ async: true }) function cycle (e) { console.log(e.target.toString()) diff --git a/package.json b/package.json index 996df9c..d2f482b 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ ], "scripts": { "typescript": "tsc --project ./test/tsconfig.json", - "test": "standard && tape test/test.js test/uniqueness.js test/buffer.js | tap-dot && npm run typescript" + "test": "standard && tape test/test.js test/uniqueness.js test/buffer.js | tap-dot && npm run typescript", + "legacy": "tape test/test.js" }, "repository": { "type": "git", @@ -30,24 +31,24 @@ }, "homepage": "https://github.com/mcollina/hyperid#readme", "devDependencies": { - "@napi-rs/uuid": "^0.1.0", + "@napi-rs/uuid": "^0.2.0", "benchmark": "^2.1.4", - "bloomfilter": "0.0.18", + "bloomfilter": "^0.0.18", "hashids": "^2.2.8", - "nanoid": "^3.1.20", - "nid": "^1.1.0", + "nanoid": "^3.0.0", + "nid": "^2.0.1", "pre-commit": "^1.2.2", - "shortid": "^2.2.15", - "standard": "^16.0.3", + "proxyquire": "^2.1.3", + "shortid": "^2.2.16", + "standard": "^17.1.0", "tap-dot": "^2.0.0", "tape": "^5.0.0", - "typescript": "^4.3.4", - "proxyquire": "^2.1.3" + "typescript": "^5.4.5" }, "dependencies": { + "buffer": "^5.2.1", "uuid": "^8.3.2", - "uuid-parse": "^1.1.0", - "buffer": "^5.2.1" + "uuid-parse": "^1.1.0" }, "browser": { "./uuid-node.js": "./uuid-browser.js"