Skip to content

Commit

Permalink
chore: update branch name
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain committed Nov 30, 2023
1 parent bb58351 commit 7d0cfd7
Show file tree
Hide file tree
Showing 6 changed files with 301 additions and 61 deletions.
195 changes: 187 additions & 8 deletions .github/workflows/js-test-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: test & maybe release
on:
push:
branches:
- master
- main
pull_request:
workflow_dispatch:

Expand All @@ -16,10 +16,189 @@ concurrency:
cancel-in-progress: true

jobs:
js-test-and-release:
uses: pl-strflt/uci/.github/workflows/js-test-and-release.yml@v0.0
secrets:
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
UCI_GITHUB_TOKEN: ${{ secrets.UCI_GITHUB_TOKEN }}
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
- uses: ipfs/aegir/actions/cache-node-modules@master
- run: npm run --if-present lint
- run: npm run --if-present dep-check
- run: npm run --if-present doc-check

test-node:
needs: check
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
node: [lts/*]
fail-fast: true
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- uses: ipfs/aegir/actions/cache-node-modules@master
- run: npm run --if-present test:node
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
flags: node
files: .coverage/*,packages/*/.coverage/*

test-chrome:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
- uses: ipfs/aegir/actions/cache-node-modules@master
- run: npm run --if-present test:chrome
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
flags: chrome
files: .coverage/*,packages/*/.coverage/*

test-chrome-webworker:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
- uses: ipfs/aegir/actions/cache-node-modules@master
- run: npm run --if-present test:chrome-webworker
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
flags: chrome-webworker
files: .coverage/*,packages/*/.coverage/*

test-firefox:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
- uses: ipfs/aegir/actions/cache-node-modules@master
- run: npm run --if-present test:firefox
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
flags: firefox
files: .coverage/*,packages/*/.coverage/*

test-firefox-webworker:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
- uses: ipfs/aegir/actions/cache-node-modules@master
- run: npm run --if-present test:firefox-webworker
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
flags: firefox-webworker
files: .coverage/*,packages/*/.coverage/*

test-webkit:
needs: check
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
node: [lts/*]
fail-fast: true
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
- uses: ipfs/aegir/actions/cache-node-modules@master
- run: npm run --if-present test:webkit
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
flags: webkit
files: .coverage/*,packages/*/.coverage/*

test-webkit-webworker:
needs: check
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
node: [lts/*]
fail-fast: true
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
- uses: ipfs/aegir/actions/cache-node-modules@master
- run: npm run --if-present test:webkit-webworker
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
flags: webkit-webworker
files: .coverage/*,packages/*/.coverage/*

test-electron-main:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
- uses: ipfs/aegir/actions/cache-node-modules@master
- run: npx xvfb-maybe npm run --if-present test:electron-main
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
flags: electron-main
files: .coverage/*,packages/*/.coverage/*

test-electron-renderer:
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
- uses: ipfs/aegir/actions/cache-node-modules@master
- run: npx xvfb-maybe npm run --if-present test:electron-renderer
- uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4
with:
flags: electron-renderer
files: .coverage/*,packages/*/.coverage/*

release:
needs: [test-node, test-chrome, test-chrome-webworker, test-firefox, test-firefox-webworker, test-webkit, test-webkit-webworker, test-electron-main, test-electron-renderer]
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
id-token: write
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: lts/*
- uses: ipfs/aegir/actions/cache-node-modules@master
- uses: ipfs/aegir/actions/docker-login@master
with:
docker-token: ${{ secrets.DOCKER_TOKEN }}
docker-username: ${{ secrets.DOCKER_USERNAME }}
- run: npm run --if-present release
env:
GITHUB_TOKEN: ${{ secrets.UCI_GITHUB_TOKEN || github.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
12 changes: 12 additions & 0 deletions .github/workflows/semantic-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Semantic PR

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
main:
uses: pl-strflt/.github/.github/workflows/reusable-semantic-pull-request.yml@v0.3
13 changes: 13 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Close and mark stale issue

on:
schedule:
- cron: '0 0 * * *'

permissions:
issues: write
pull-requests: write

jobs:
stale:
uses: pl-strflt/.github/.github/workflows/reusable-stale-issue.yml@v0.3
78 changes: 29 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,10 @@
# @multiformats/multiaddr <!-- omit in toc -->

[![multiformats.io](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://multiformats.io)
[![codecov](https://img.shields.io/codecov/c/github/multiformats/js-multiaddr.svg?style=flat-square)](https://codecov.io/gh/multiformats/js-multiaddr)
[![CI](https://img.shields.io/github/actions/workflow/status/multiformats/js-multiaddr/js-test-and-release.yml?branch=master\&style=flat-square)](https://github.com/multiformats/js-multiaddr/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)
[![CI](https://img.shields.io/github/actions/workflow/status/multiformats/js-multiaddr/js-test-and-release.yml?branch=main\&style=flat-square)](https://github.com/multiformats/js-multiaddr/actions/workflows/js-test-and-release.yml?query=branch%3Amain)

> multiaddr implementation (binary + string representation of network addresses)
## Table of contents <!-- omit in toc -->

- [Install](#install)
- [Browser `<script>` tag](#browser-script-tag)
- [Background](#background)
- [What is multiaddr?](#what-is-multiaddr)
- [Usage](#usage)
- [Resolvers](#resolvers)
- [API Docs](#api-docs)
- [License](#license)
- [Contribution](#contribution)

## Install

```console
$ npm i @multiformats/multiaddr
```

### Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `MultiformatsMultiaddr` in the global namespace.

```html
<script src="https://unpkg.com/@multiformats/multiaddr/dist/index.min.js"></script>
```

## Background

### What is multiaddr?
# About

A standard way to represent addresses that

Expand All @@ -44,7 +14,7 @@ A standard way to represent addresses that
- have a nice string representation
- encapsulate well

## Usage
## Example

```js
import { multiaddr } from '@multiformats/multiaddr'
Expand All @@ -61,22 +31,18 @@ addr.toString()
// '/ip4/127.0.0.1/udp/1234'

addr.protos()
/*
[
{code: 4, name: 'ip4', size: 32},
{code: 273, name: 'udp', size: 16}
]
*/
// [
// {code: 4, name: 'ip4', size: 32},
// {code: 273, name: 'udp', size: 16}
// ]

// gives you an object that is friendly with what Node.js core modules expect for addresses
addr.nodeAddress()
/*
{
family: 4,
port: 1234,
address: "127.0.0.1"
}
*/
// {
// family: 4,
// port: 1234,
// address: "127.0.0.1"
// }

addr.encapsulate('/sctp/5678')
// Multiaddr(/ip4/127.0.0.1/udp/1234/sctp/5678)
Expand All @@ -102,17 +68,31 @@ The available resolvers are:

A resolver receives a `Multiaddr` as a parameter and returns a `Promise<Array<string>>`.

## API Docs
# Install

```console
$ npm i @multiformats/multiaddr
```

## Browser `<script>` tag

Loading this module through a script tag will make it's exports available as `MultiformatsMultiaddr` in the global namespace.

```html
<script src="https://unpkg.com/@multiformats/multiaddr/dist/index.min.js"></script>
```

# API Docs

- <https://multiformats.github.io/js-multiaddr>

## License
# License

Licensed under either of

- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

## Contribution
# Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
"bugs": {
"url": "https://github.com/multiformats/js-multiaddr/issues"
},
"publishConfig": {
"access": "public",
"provenance": true
},
"keywords": [
"binary",
"multiaddr",
Expand Down Expand Up @@ -63,7 +67,7 @@
},
"release": {
"branches": [
"master"
"main"
],
"plugins": [
[
Expand Down Expand Up @@ -171,7 +175,7 @@
"uint8arrays": "^4.0.2"
},
"devDependencies": {
"@types/sinon": "^10.0.14",
"@types/sinon": "^17.0.2",
"aegir": "^41.0.11",
"sinon": "^17.0.0"
},
Expand Down
Loading

0 comments on commit 7d0cfd7

Please sign in to comment.