Skip to content

Commit

Permalink
chore: use semantic-release, update testing
Browse files Browse the repository at this point in the history
* update polendina w/ webpack 5 and better esm support
* make package.json more consistent with js-multiformats
* replace test & release workflow for semantic-release & consistency
  • Loading branch information
rvagg committed Dec 9, 2021
1 parent 4893003 commit e1f6252
Show file tree
Hide file tree
Showing 4 changed files with 188 additions and 93 deletions.
66 changes: 0 additions & 66 deletions .github/workflows/mikeals-workflow.yml

This file was deleted.

63 changes: 63 additions & 0 deletions .github/workflows/test-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Test & Maybe Release
on: [push, pull_request]
jobs:
test:
strategy:
fail-fast: false
matrix:
node: [14.x, 16.x]
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/[email protected]
- name: Use Node.js ${{ matrix.node }}
uses: actions/[email protected]
with:
node-version: ${{ matrix.node }}
- name: Install Dependencies
run: |
npm install --no-progress
- name: Run tests
run: |
npm config set script-shell bash
npm run test:ci
- name: Typecheck
uses: gozala/[email protected]
release:
name: Release
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/[email protected]
with:
node-version: 14
- name: Install dependencies
run: |
npm install --no-progress --no-package-lock --no-save
- name: Build
run: |
npm run build
- name: Install plugins
run: |
npm install \
@semantic-release/commit-analyzer \
conventional-changelog-conventionalcommits \
@semantic-release/release-notes-generator \
@semantic-release/npm \
@semantic-release/github \
@semantic-release/git \
@semantic-release/changelog \
--no-progress --no-package-lock --no-save
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release

145 changes: 120 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,47 +11,57 @@
"build:js": "ipjs build --tests --main && npm run build:copy",
"build:copy": "cp -a tsconfig.json index.js dist/ && mkdir -p dist/test && cp test/*.js dist/test/",
"build:types": "npm run build:copy && cd dist && tsc --build",
"publish": "ipjs publish",
"test:cjs": "npm run build:js && mocha dist/cjs/node-test/test-*.js && npm run test:cjs:browser",
"test:node": "hundreds mocha test/test-*.js",
"test:cjs:browser": "polendina --page --worker --serviceworker --cleanup dist/cjs/node-test/test-*.js",
"test:esm": "npm run build:js && mocha dist/esm/node-test/test-*.js && npm run test:esm:browser",
"test:node": "c8 --check-coverage --branches 100 --functions 100 --lines 100 mocha test/test-*.js",
"test:cjs:browser": "polendina --page --worker --serviceworker --cleanup dist/cjs/browser-test/test-*.js",
"test:esm:browser": "polendina --page --worker --serviceworker --cleanup dist/esm/browser-test/test-*.js",
"test:ts": "npm run build:types && npm run test --prefix test/ts-use",
"test": "npm run lint && npm run test:node && npm run test:cjs && npm run test:ts",
"test": "npm run lint && npm run test:node && npm run test:esm && npm run test:ts",
"test:ci": "npm run lint && npm run test:node && npm run test:esm && npm run test:cjs && npm run test:ts",
"coverage": "c8 --reporter=html mocha test/test-*.js && npm_config_yes=true npx st -d coverage -p 8080"
},
"exports": {
"import": "./index.js"
},
"license": "(Apache-2.0 AND MIT)",
"repository": {
"type": "git",
"url": "git+https://github.com/ipld/js-dag-cbor.git"
},
"keywords": [
"IPFS",
"IPLD"
"ipfs",
"ipld",
"multiformats"
],
"bugs": {
"url": "https://github.com/ipld/js-dag-cbor/issues"
"author": "Rod <[email protected]> (http://r.va.gg/)",
"license": "(Apache-2.0 AND MIT)",
"exports": {
"import": "./index.js"
},
"homepage": "https://github.com/ipld/js-dag-cbor",
"dependencies": {
"cborg": "^1.2.1",
"multiformats": "^9.0.0"
},
"devDependencies": {
"buffer": "^6.0.3",
"c8": "^7.10.0",
"chai": "^4.3.4",
"hundreds": "^0.0.9",
"ipjs": "^5.0.0",
"ipld-garbage": "^4.0.1",
"mocha": "^9.0.0",
"polendina": "^1.1.0",
"standard": "^16.0.3",
"typescript": "^4.2.4"
"ipjs": "^5.2.0",
"ipld-garbage": "^4.0.10",
"mocha": "^9.1.3",
"polendina": "~2.0.0",
"standard": "^16.0.4",
"typescript": "~4.5.2"
},
"standard": {
"ignore": [
"dist"
]
},
"directories": {
"test": "test"
},
"repository": {
"type": "git",
"url": "git+https://github.com/ipld/js-dag-cbor.git"
},
"bugs": {
"url": "https://github.com/ipld/js-dag-cbor/issues"
},
"homepage": "https://github.com/ipld/js-dag-cbor#readme",
"typesVersions": {
"*": {
"*": [
Expand All @@ -62,5 +72,90 @@
]
}
},
"author": "Mikeal Rogers <[email protected]> (https://www.mikealrogers.com/)"
"release": {
"branches": [
"master"
],
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{
"breaking": true,
"release": "major"
},
{
"revert": true,
"release": "patch"
},
{
"type": "feat",
"release": "minor"
},
{
"type": "fix",
"release": "patch"
},
{
"type": "chore",
"release": "patch"
},
{
"type": "docs",
"release": "patch"
},
{
"type": "test",
"release": "patch"
},
{
"scope": "no-release",
"release": false
}
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"presetConfig": {
"types": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "chore",
"section": "Trivial Changes"
},
{
"type": "docs",
"section": "Trivial Changes"
},
{
"type": "test",
"section": "Tests"
}
]
}
}
],
"@semantic-release/changelog",
[
"@semantic-release/npm",
{
"pkgRoot": "dist"
}
],
"@semantic-release/github",
"@semantic-release/git"
]
}
}
7 changes: 5 additions & 2 deletions test/test-basics.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/* eslint-env mocha */
'use strict'

import { Buffer } from 'buffer'
import { garbage } from 'ipld-garbage'
import chai from 'chai'
import * as dagcbor from '../index.js'
Expand Down Expand Up @@ -159,7 +160,9 @@ describe('dag-cbor', () => {
assert.throws(() => {
// two top-level CBOR objects, the original and a single uint=0, valid if using
// CBOR in streaming mode, not valid here
decode(Buffer.concat([Buffer.from(serializedObj), Buffer.alloc(1)]))
const big = new Uint8Array(serializedObj.length + 1)
big.set(serializedObj, 0)
decode(big)
}, /too many terminals/)
})

Expand Down

0 comments on commit e1f6252

Please sign in to comment.