Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wf continue-on-error: true #9088

Merged
merged 4 commits into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pr-any.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ on: [pull_request]

jobs:
pr:
continue-on-error: true
strategy:
matrix:
step: ['lint', 'test', 'build:code', 'build:i18n', 'build:electron']
name: ${{ matrix.step }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@babel/runtime": "^7.21.0",
"@crustio/crust-pin": "^1.0.0",
"@pinata/sdk": "^1.2.1",
"@polkadot/dev": "^0.69.6",
"@polkadot/dev": "^0.69.23",
"@types/chart.js": "^2.9.37",
"@types/file-saver": "^2.0.5",
"@types/jest": "^29.4.0",
Expand Down
52 changes: 33 additions & 19 deletions packages/apps-config/src/api/typesBundle.spec.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,24 @@
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0

import fs from 'fs';
import fs from 'node:fs';

import { objectSpread } from '@polkadot/util';

import chain from './chain';
import spec from './spec';

it('generates the typesBundle', (): void => {
// Technically this shouldn't be a test - it was that way since historically we
// didn't use something like ts-node. Now however we can actually replace this
// with a non-script test version and use the @polkadot/dev/node/ts loader

describe('typesBundle', (): void => {
const specEntries = Object.entries(spec);
const chainEntries = Object.entries(chain);
const typesBundle: { chain: Record<string, unknown>, spec: Record<string, unknown> } = { chain: {}, spec: {} };

specEntries.forEach(([k, v]): void => {
const value = objectSpread<{ derives: unknown }>({}, v);

delete value.derives;

typesBundle.spec[k] = value;
});
// Chain names override anything that spec name might define, if they conflict.
chainEntries.forEach(([k, v]): void => {
const value = objectSpread<{ derives: unknown }>({}, v);

delete value.derives;

typesBundle.chain[k] = value;
});

fs.writeFileSync('packages/apps-config/src/api/typesBundle.ts', `// Copyright 2017-2023 @polkadot/apps-config authors & contributors
afterAll((): void => {
fs.writeFileSync('packages/apps-config/src/api/typesBundle.ts', `// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0

// Do not edit, auto-generated by @polkadot/apps-config
Expand All @@ -42,4 +31,29 @@ import type { OverrideBundleType } from '@polkadot/types/types';

export const typesBundle = ${JSON.stringify(typesBundle, null, 2)} as unknown as OverrideBundleType;
`);
});

describe('specs', (): void => {
for (const [k, v] of specEntries) {
it(`adds ${k}`, (): void => {
const value = objectSpread<{ derives: unknown }>({}, v);

delete value.derives;

typesBundle.spec[k] = value;
});
}
});

describe('chains', (): void => {
for (const [k, v] of chainEntries) {
it(`adds ${k}`, (): void => {
const value = objectSpread<{ derives: unknown }>({}, v);

delete value.derives;

typesBundle.chain[k] = value;
});
}
});
});
50 changes: 27 additions & 23 deletions packages/apps-config/src/endpoints/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// Copyright 2017-2023 @polkadot/apps-config authors & contributors
// SPDX-License-Identifier: Apache-2.0

import { assert, isNumber, isString } from '@polkadot/util';
import assert from 'node:assert/strict';

import { isNumber, isString } from '@polkadot/util';

import { createWsEndpoints } from '.';

Expand Down Expand Up @@ -88,9 +90,11 @@ describe('urls are not duplicated', (): void => {
return map;
}, {} as Record<string, string[]>);

it.each(Object.entries(map))('%s', (url, paths): void => {
assert(paths.length === 1, `${url} appears multiple times - ${paths.map((p) => `\n\t"${p}"`).join('')}`);
});
for (const [url, paths] of Object.entries<string[]>(map)) {
it(url, (): void => {
assert(paths.length === 1, `${url} appears multiple times - ${paths.map((p) => `\n\t"${p}"`).join('')}`);
});
}
});

describe('endpopints naming', (): void => {
Expand All @@ -111,27 +115,27 @@ describe('endpopints naming', (): void => {
[`${e.name}:: ${e.provider}`]: e
}), {});

describe.each(Object.keys(endpoints))('%s', (key): void => {
const { name, provider } = endpoints[key];

it(`[${key}] has no emojis`, (): void => {
assert(!emoji.test(name), `${name} should not contain any emojis`);
assert(!emoji.test(provider), `${name}:: ${provider} should not contain any emojis`);
});
for (const [key, { name, provider }] of Object.entries<Endpoint>(endpoints)) {
describe(key, (): void => {
it(`[${key}] has no emojis`, (): void => {
assert(!emoji.test(name), `${name} should not contain any emojis`);
assert(!emoji.test(provider), `${name}:: ${provider} should not contain any emojis`);
});

it(`[${key}] not all uppercase`, (): void => {
assert(!provider.includes(' ') || (provider.toLocaleUpperCase() !== provider), `${name}:: ${provider} should not be all uppercase`);
});
it(`[${key}] not all uppercase`, (): void => {
assert(!provider.includes(' ') || (provider.toLocaleUpperCase() !== provider), `${name}:: ${provider} should not be all uppercase`);
});

it(`[${key}] does not contain "Parachain`, (): void => {
assert(!name.includes('Parachain'), `${name} should not contain "Parachain" (redundant)`);
});
it(`[${key}] does not contain "Parachain`, (): void => {
assert(!name.includes('Parachain'), `${name} should not contain "Parachain" (redundant)`);
});

it(`[${key}] does not contain a relay name`, (): void => {
assert(!name.includes(' ') || !name.includes('Kusama'), `${name} should not contain "Kusama" (redundant)`);
assert(!name.includes(' ') || !name.includes('Polkadot'), `${name} should not contain "Polkadot" (redundant)`);
assert(!name.includes(' ') || !name.includes('Rococo'), `${name} should not contain "Rococo" (redundant)`);
assert(!name.includes(' ') || !name.includes('Westend'), `${name} should not contain "Westend" (redundant)`);
it(`[${key}] does not contain a relay name`, (): void => {
assert(!name.includes(' ') || !name.includes('Kusama'), `${name} should not contain "Kusama" (redundant)`);
assert(!name.includes(' ') || !name.includes('Polkadot'), `${name} should not contain "Polkadot" (redundant)`);
assert(!name.includes(' ') || !name.includes('Rococo'), `${name} should not contain "Rococo" (redundant)`);
assert(!name.includes(' ') || !name.includes('Westend'), `${name} should not contain "Westend" (redundant)`);
});
});
});
}
});
2 changes: 1 addition & 1 deletion packages/apps-electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"@babel/core": "^7.21.0",
"@babel/polyfill": "^7.12.1",
"@polkadot/dev": "^0.69.6",
"@polkadot/dev": "^0.69.23",
"@polkadot/react-components": "^0.124.2-100-x",
"electron-log": "^5.0.0-beta.16",
"electron-updater": "^5.3.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/apps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@babel/runtime": "^7.21.0",
"@polkadot/apps-config": "^0.124.2-100-x",
"@polkadot/apps-routing": "^0.124.2-100-x",
"@polkadot/dev": "^0.69.6",
"@polkadot/dev": "^0.69.23",
"@polkadot/react-api": "^0.124.2-100-x",
"@polkadot/react-components": "^0.124.2-100-x",
"@polkadot/react-hooks": "^0.124.2-100-x",
Expand Down
Loading