Add url lint (#5482)
This commit is contained in:
parent
f69c7d7266
commit
1f93973643
4
.github/workflows/chain-types.yml
vendored
4
.github/workflows/chain-types.yml
vendored
@ -1,10 +1,10 @@
|
||||
name: Chain type check
|
||||
name: Chain
|
||||
on:
|
||||
schedule:
|
||||
- cron: '30 0 * * *'
|
||||
|
||||
jobs:
|
||||
chains:
|
||||
types:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
11
.github/workflows/lint-chain-urls.yml
vendored
Normal file
11
.github/workflows/lint-chain-urls.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
name: Chain
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
urls:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
run: |
|
||||
yarn install --immutable | grep -v 'YN0013'
|
||||
yarn ci:chainUrls
|
||||
@ -51,6 +51,7 @@
|
||||
"packElectron": "yarn build:release:electron && yarn clean:electronRelease && electron-builder build -mwl",
|
||||
"docs": "echo \"skipping docs\"",
|
||||
"ci:chainTypes": "polkadot-dev-run-test --silent packages/apps-config/src/ciChainTypes",
|
||||
"ci:chainUrls": "polkadot-dev-run-test --silent packages/apps-config/src/ciChainUrls",
|
||||
"clean": "polkadot-dev-clean-build",
|
||||
"clean:electronBuild": "cd packages/apps-electron && polkadot-dev-clean-build",
|
||||
"clean:electronRelease": "cd packages/apps-electron && rm -rf release",
|
||||
|
||||
26
packages/apps-config/src/ciChainUrls.spec.ts
Normal file
26
packages/apps-config/src/ciChainUrls.spec.ts
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright 2017-2021 @polkadot/apps-config authors & contributors
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import { assert, isString } from '@polkadot/util';
|
||||
|
||||
import { createWsEndpoints } from './endpoints';
|
||||
|
||||
interface Endpoint {
|
||||
name: string;
|
||||
ws: string;
|
||||
}
|
||||
|
||||
const endpoints = createWsEndpoints((k: string, v?: string) => v || k, true)
|
||||
.filter(({ value }) =>
|
||||
value && isString(value) && !value.includes('127.0.0.1')
|
||||
)
|
||||
.map((o): Partial<Endpoint> => ({ name: o.text as string, ws: o.value as string }))
|
||||
.filter((v): v is Endpoint => !!v.ws);
|
||||
|
||||
describe('check configured chain urls', (): void => {
|
||||
endpoints.forEach(({ name, ws }) =>
|
||||
it(`${name} @ ${ws}`, (): void => {
|
||||
assert(ws.startsWith('wss://'), `Expected ${ws} endpoint to start with wss:// `);
|
||||
})
|
||||
);
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user