diff --git a/.github/chain-endpoints.md b/.github/chain-endpoints.md new file mode 100644 index 0000000000..81a9d1a1bd --- /dev/null +++ b/.github/chain-endpoints.md @@ -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: diff --git a/.github/workflows/chain-endpoints.yml b/.github/workflows/chain-endpoints.yml new file mode 100644 index 0000000000..5e1157c33f --- /dev/null +++ b/.github/workflows/chain-endpoints.yml @@ -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 diff --git a/.github/workflows/chain-types.yml b/.github/workflows/chain-types.yml index 6d7e692272..bf3d706a75 100644 --- a/.github/workflows/chain-types.yml +++ b/.github/workflows/chain-types.yml @@ -1,7 +1,7 @@ -name: Chain +name: Chain types on: schedule: - - cron: '30 0 * * *' + - cron: '30 0/12 * * *' jobs: types: diff --git a/package.json b/package.json index 1401960061..b18c01eaba 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/apps-config/src/ci/chainEndpoints.spec.ts b/packages/apps-config/src/ci/chainEndpoints.spec.ts new file mode 100644 index 0000000000..2a2baf9f7b --- /dev/null +++ b/packages/apps-config/src/ci/chainEndpoints.spec.ts @@ -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' + ]); +}); diff --git a/packages/apps-config/src/ci/chainTypes.spec.ts b/packages/apps-config/src/ci/chainTypes.spec.ts new file mode 100644 index 0000000000..94ddc05b3f --- /dev/null +++ b/packages/apps-config/src/ci/chainTypes.spec.ts @@ -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' + ]); +}); diff --git a/packages/apps-config/src/ciChainTypes.spec.ts b/packages/apps-config/src/ci/util.ts similarity index 83% rename from packages/apps-config/src/ciChainTypes.spec.ts rename to packages/apps-config/src/ci/util.ts index e465bb9a32..7993b91e48 100644 --- a/packages/apps-config/src/ciChainTypes.spec.ts +++ b/packages/apps-config/src/ci/util.ts @@ -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 => { } }) ); -}); +}