Split endpoint & types checks (#5611)

* Split endpoint & types checks

* Updates
This commit is contained in:
Jaco 2021-06-16 09:48:35 +03:00 committed by GitHub
parent 6ce2c0559b
commit 336e6df518
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 66 additions and 15 deletions

10
.github/chain-endpoints.md vendored Normal file
View File

@ -0,0 +1,10 @@
---
title: Unavailable chain endpoints
labels: ['ci', '@apps-config']
---
cc @polkadot-js/notifications
Some configured endpoints are not available.
Check the nightly cron output (or via `yarn ci:chainEndpoints` locally) and disable the chains (either with `isDisabled` or `isUnreachable`) until the issue is resolved. The output as found from the test includes:

25
.github/workflows/chain-endpoints.yml vendored Normal file
View File

@ -0,0 +1,25 @@
name: Chain endpoints
on:
schedule:
- cron: '45 0/12 * * *'
jobs:
types:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: check
env:
CI_LOG: 123
run: |
yarn install --immutable | grep -v 'YN0013'
yarn ci:chainEndpoints
- name: issue
if: ${{ failure() }}
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT_BOT }}
with:
filename: .github/chain-endpoints.md
update_existing: true

View File

@ -1,7 +1,7 @@
name: Chain
name: Chain types
on:
schedule:
- cron: '30 0 * * *'
- cron: '30 0/12 * * *'
jobs:
types:

View File

@ -49,7 +49,8 @@
"packElectron:linux": "yarn build:release:electron && electron-builder build --linux",
"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:chainEndpoints": "polkadot-dev-run-test --silent packages/apps-config/src/ci/chainEndpoints",
"ci:chainTypes": "polkadot-dev-run-test --silent packages/apps-config/src/ci/chainTypes",
"clean": "polkadot-dev-clean-build",
"clean:electronBuild": "cd packages/apps-electron && polkadot-dev-clean-build",
"clean:electronRelease": "cd packages/apps-electron && rm -rf release",

View File

@ -0,0 +1,11 @@
// Copyright 2017-2021 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { checkEndpoints } from './util';
describe('--SLOW--: check configured chain endpoints', (): void => {
checkEndpoints('./.github/chain-endpoints.md', [
'No DNS entry for',
'Timeout connecting to'
]);
});

View File

@ -0,0 +1,10 @@
// Copyright 2017-2021 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0
import { checkEndpoints } from './util';
describe('--SLOW--: check configured chain types', (): void => {
checkEndpoints('./.github/chain-types.md', [
'Cannot construct unknown type'
]);
});

View File

@ -7,8 +7,8 @@ import { ApiPromise, WsProvider } from '@polkadot/api';
import { assert, isError, isString } from '@polkadot/util';
import { fetch } from '@polkadot/x-fetch';
import { typesBundle, typesChain } from './api';
import { createWsEndpoints } from './endpoints';
import { typesBundle, typesChain } from '../api';
import { createWsEndpoints } from '../endpoints';
interface Endpoint {
name: string;
@ -20,15 +20,9 @@ interface DnsResponse {
Question: { name: string }[];
}
const FAILURES: string[] = [
'Cannot construct unknown type',
'No DNS entry for',
'Timeout connecting to'
];
const TICK = '`';
describe('--SLOW--: check configured chain connections', (): void => {
export function checkEndpoints (issueFile: string, failures: string[]): void {
createWsEndpoints((k: string, v?: string) => v || k)
.filter(({ isDisabled, isUnreachable, value }) =>
!isDisabled &&
@ -80,8 +74,8 @@ describe('--SLOW--: check configured chain connections', (): void => {
api.isReadyOrError
]);
} catch (error) {
if (isError(error) && FAILURES.some((f) => (error as Error).message.includes(f))) {
process.env.CI_LOG && fs.appendFileSync('./.github/chain-types.md', `\n${TICK}${name} @ ${ws} ${error.message}${TICK}\n`);
if (isError(error) && failures.some((f) => (error as Error).message.includes(f))) {
process.env.CI_LOG && fs.appendFileSync(issueFile, `\n${TICK}${name} @ ${ws} ${error.message}${TICK}\n`);
throw error;
}
@ -104,4 +98,4 @@ describe('--SLOW--: check configured chain connections', (): void => {
}
})
);
});
}