-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: dnsLinkLabel decode encode (#34)
* fix: dnsLinkLabel decode encode * chore: update github workflows * chore: ensure test runs during CI
- Loading branch information
Showing
10 changed files
with
260 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: npm | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
time: "10:00" | ||
open-pull-requests-limit: 20 | ||
commit-message: | ||
prefix: "deps" | ||
prefix-development: "deps(dev)" | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
commit-message: | ||
prefix: ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
## Title | ||
|
||
<!--- | ||
The title of the PR will be the commit message of the merge commit, so please make sure it is descriptive enough. | ||
We utilize the Conventional Commits specification for our commit messages. See <https://www.conventionalcommits.org/en/v1.0.0/#specification> for more information. | ||
The commit tag types can be of one of the following: feat, fix, deps, refactor, chore, docs. See <https://github.com/ipfs/helia/blob/main/.github/workflows/main.yml#L184-L192> | ||
The title must also be fewer than 72 characters long or it will fail the Semantic PR check. See <https://github.com/ipfs/helia/blob/main/.github/workflows/semantic-pull-request.yml> | ||
---> | ||
|
||
## Description | ||
|
||
<!-- | ||
Please write a summary of your changes and why you made them. | ||
Please include any relevant issues in here, for example: | ||
Related https://github.com/ipfs/helia/issues/ABCD. | ||
Fixes https://github.com/ipfs/helia/issues/XYZ. | ||
--> | ||
|
||
## Notes & open questions | ||
|
||
<!-- | ||
Any notes, remarks or open questions you have to make about the PR which don't need to go into the final commit message. | ||
--> | ||
|
||
## Change checklist | ||
|
||
- [ ] I have performed a self-review of my own code | ||
- [ ] I have made corresponding changes to the documentation if necessary (this includes comments as well) | ||
- [ ] I have added tests that prove my fix is effective or that my feature works |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: Automerge | ||
on: [ pull_request ] | ||
|
||
jobs: | ||
automerge: | ||
uses: protocol/.github/.github/workflows/automerge.yml@master | ||
with: | ||
job: 'automerge' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
- uses: ipfs/aegir/actions/cache-node-modules@master | ||
|
||
check: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
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: build | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [windows-latest, ubuntu-latest, macos-latest] | ||
node: [lts/*] | ||
fail-fast: true | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node }} | ||
- uses: ipfs/aegir/actions/cache-node-modules@master | ||
- run: npm run --if-present test:node | ||
- uses: codecov/codecov-action@4fe8c5f003fae66aa5ebb77cfd3e7bfbbda0b6b0 # v3.1.5 | ||
with: | ||
flags: node | ||
files: .coverage/*,packages/*/.coverage/* | ||
|
||
test-chrome: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
- uses: ipfs/aegir/actions/cache-node-modules@master | ||
- run: npm run --if-present test:chrome | ||
- uses: codecov/codecov-action@4fe8c5f003fae66aa5ebb77cfd3e7bfbbda0b6b0 # v3.1.5 | ||
with: | ||
flags: chrome | ||
files: .coverage/*,packages/*/.coverage/* | ||
|
||
test-chrome-webworker: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
- uses: ipfs/aegir/actions/cache-node-modules@master | ||
- run: npm run --if-present test:chrome-webworker | ||
- uses: codecov/codecov-action@4fe8c5f003fae66aa5ebb77cfd3e7bfbbda0b6b0 # v3.1.5 | ||
with: | ||
flags: chrome-webworker | ||
files: .coverage/*,packages/*/.coverage/* | ||
|
||
test-firefox: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
- uses: ipfs/aegir/actions/cache-node-modules@master | ||
- run: npm run --if-present test:firefox | ||
- uses: codecov/codecov-action@4fe8c5f003fae66aa5ebb77cfd3e7bfbbda0b6b0 # v3.1.5 | ||
with: | ||
flags: firefox | ||
files: .coverage/*,packages/*/.coverage/* | ||
|
||
test-firefox-webworker: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
- uses: ipfs/aegir/actions/cache-node-modules@master | ||
- run: npm run --if-present test:firefox-webworker | ||
- uses: codecov/codecov-action@4fe8c5f003fae66aa5ebb77cfd3e7bfbbda0b6b0 # v3.1.5 | ||
with: | ||
flags: firefox-webworker | ||
files: .coverage/*,packages/*/.coverage/* | ||
|
||
test-webkit: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: lts/* | ||
- uses: ipfs/aegir/actions/cache-node-modules@master | ||
- run: npm run --if-present test:webkit | ||
- uses: codecov/codecov-action@4fe8c5f003fae66aa5ebb77cfd3e7bfbbda0b6b0 # v3.1.5 | ||
with: | ||
flags: webkit | ||
files: .coverage/*,packages/*/.coverage/* | ||
|
||
test-electron-main: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
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@4fe8c5f003fae66aa5ebb77cfd3e7bfbbda0b6b0 # v3.1.5 | ||
with: | ||
flags: electron-main | ||
files: .coverage/*,packages/*/.coverage/* | ||
|
||
test-electron-renderer: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
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@4fe8c5f003fae66aa5ebb77cfd3e7bfbbda0b6b0 # v3.1.5 | ||
with: | ||
flags: electron-renderer | ||
files: .coverage/*,packages/*/.coverage/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/* eslint-env mocha */ | ||
import { expect } from 'aegir/chai' | ||
import { dnsLinkLabelDecoder, dnsLinkLabelEncoder } from '../src/lib/dns-link-labels.ts' | ||
|
||
describe('dns-link-labels', () => { | ||
it('should support specs-ipfs-tech', () => { | ||
const actualDomainName = 'specs.ipfs.tech' | ||
const encodedLabel = dnsLinkLabelEncoder(actualDomainName) | ||
expect(encodedLabel).to.equal('specs-ipfs-tech') | ||
const result = dnsLinkLabelDecoder(encodedLabel) | ||
expect(result).to.equal(actualDomainName) | ||
}) | ||
|
||
it('should support en.wikipedia-on-ipfs.org', () => { | ||
const actualDomainName = 'en.wikipedia-on-ipfs.org' | ||
const encodedLabel = dnsLinkLabelEncoder(actualDomainName) | ||
expect(encodedLabel).to.equal('en-wikipedia--on--ipfs-org') | ||
const result = dnsLinkLabelDecoder(encodedLabel) | ||
expect(result).to.equal(actualDomainName) | ||
}) | ||
}) |