-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a gh action to check formatting of e2e test scripts (#119)
* add a gh action to check formatting of e2e test scripts * fix node * disable build * fix build * working? * use npm * fixes * prettier * fix npm run build --------- Co-authored-by: Sergej <[email protected]>
- Loading branch information
Showing
17 changed files
with
590 additions
and
501 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,2 @@ | ||
build/ | ||
node_modules/ |
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,28 @@ | ||
{ | ||
"env": { | ||
"node": true, | ||
"es2021": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 12, | ||
"sourceType": "script" | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
"indent": ["error", 2], | ||
"linebreak-style": ["error", "unix"], | ||
"quotes": ["error", "single"], | ||
"semi": ["error", "always"], | ||
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }], | ||
"@typescript-eslint/explicit-module-boundary-types": "off", | ||
"@typescript-eslint/no-explicit-any": "off", | ||
"no-undef": "off" | ||
} | ||
} |
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,30 @@ | ||
name: Lint e2e_tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
lint: | ||
runs-on: ubuntu-22.04 | ||
defaults: | ||
run: | ||
shell: bash | ||
working-directory: ./e2e_tests | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
- run: npm i | ||
- run: npm run format | ||
- run: npm run lint | ||
- run: npm run build |
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,2 @@ | ||
build/ | ||
node_modules/ |
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 @@ | ||
{ | ||
"singleQuote": true, | ||
"tabWidth": 2, | ||
"semi": true, | ||
"useTabs": false, | ||
"trailingComma": "es5", | ||
"arrowParens": "always" | ||
} |
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 |
---|---|---|
@@ -1,39 +1,39 @@ | ||
import { ApiPromise, WsProvider, Keyring } from "@polkadot/api"; | ||
import { submitExtrinsic, setupRelayAsset, RELAY_ASSET_ID } from "../common"; | ||
import { ApiPromise, Keyring, WsProvider } from '@polkadot/api'; | ||
import { RELAY_ASSET_ID, setupRelayAsset, submitExtrinsic } from '../common'; | ||
|
||
async function run(nodeName: string, networkInfo: any, _jsArgs: any) { | ||
const { wsUri: regionXUri } = networkInfo.nodesByName[nodeName]; | ||
const { wsUri: rococoUri } = networkInfo.nodesByName["rococo-validator01"]; | ||
|
||
const rococoApi = await ApiPromise.create({ provider: new WsProvider(rococoUri) }); | ||
const regionXApi = await ApiPromise.create({ | ||
provider: new WsProvider(regionXUri), | ||
signedExtensions: { | ||
ChargeAssetTxPayment: { | ||
extrinsic: { | ||
tip: "Compact<Balance>", | ||
assetId: "Option<AssetId>", | ||
}, | ||
payload: {}, | ||
}, | ||
}, | ||
}); | ||
|
||
// account to submit tx | ||
const keyring = new Keyring({ type: "sr25519" }); | ||
const alice = keyring.addFromUri("//Alice"); | ||
|
||
const setXcmVersion = rococoApi.tx.xcmPallet.forceDefaultXcmVersion([3]); | ||
await submitExtrinsic(alice, rococoApi.tx.sudo.sudo(setXcmVersion), {}); | ||
|
||
await setupRelayAsset(regionXApi, alice, 10n**12n); | ||
|
||
const receiverKeypair = new Keyring(); | ||
receiverKeypair.addFromAddress(alice.address); | ||
|
||
// Try to pay for fees with relay chain asset. | ||
const remarkCall = regionXApi.tx.system.remark("0x44"); | ||
await submitExtrinsic(alice, remarkCall, { assetId: RELAY_ASSET_ID }); | ||
const { wsUri: regionXUri } = networkInfo.nodesByName[nodeName]; | ||
const { wsUri: rococoUri } = networkInfo.nodesByName['rococo-validator01']; | ||
|
||
const rococoApi = await ApiPromise.create({ provider: new WsProvider(rococoUri) }); | ||
const regionXApi = await ApiPromise.create({ | ||
provider: new WsProvider(regionXUri), | ||
signedExtensions: { | ||
ChargeAssetTxPayment: { | ||
extrinsic: { | ||
tip: 'Compact<Balance>', | ||
assetId: 'Option<AssetId>', | ||
}, | ||
payload: {}, | ||
}, | ||
}, | ||
}); | ||
|
||
// account to submit tx | ||
const keyring = new Keyring({ type: 'sr25519' }); | ||
const alice = keyring.addFromUri('//Alice'); | ||
|
||
const setXcmVersion = rococoApi.tx.xcmPallet.forceDefaultXcmVersion([3]); | ||
await submitExtrinsic(alice, rococoApi.tx.sudo.sudo(setXcmVersion), {}); | ||
|
||
await setupRelayAsset(regionXApi, alice, 10n ** 12n); | ||
|
||
const receiverKeypair = new Keyring(); | ||
receiverKeypair.addFromAddress(alice.address); | ||
|
||
// Try to pay for fees with relay chain asset. | ||
const remarkCall = regionXApi.tx.system.remark('0x44'); | ||
await submitExtrinsic(alice, remarkCall, { assetId: RELAY_ASSET_ID }); | ||
} | ||
|
||
export { run }; |
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 |
---|---|---|
@@ -1,18 +1,18 @@ | ||
import { ApiPromise, Keyring, WsProvider } from "@polkadot/api"; | ||
import { submitExtrinsic } from "../common"; | ||
import { ApiPromise, Keyring, WsProvider } from '@polkadot/api'; | ||
import { submitExtrinsic } from '../common'; | ||
|
||
async function run(nodeName: string, networkInfo: any, _jsArgs: any) { | ||
const { wsUri } = networkInfo.nodesByName[nodeName]; | ||
const api = await ApiPromise.create({ provider: new WsProvider(wsUri) }); | ||
const { wsUri } = networkInfo.nodesByName[nodeName]; | ||
const api = await ApiPromise.create({ provider: new WsProvider(wsUri) }); | ||
|
||
// account to submit tx | ||
const keyring = new Keyring({ type: "sr25519" }); | ||
const alice = keyring.addFromUri("//Alice"); | ||
const bob = keyring.addFromUri("//Bob"); | ||
// account to submit tx | ||
const keyring = new Keyring({ type: 'sr25519' }); | ||
const alice = keyring.addFromUri('//Alice'); | ||
const bob = keyring.addFromUri('//Bob'); | ||
|
||
const call = api.tx.balances.transferKeepAlive(bob.address, 10n ** 6n); | ||
const sudo = api.tx.sudo.sudo(call); | ||
await submitExtrinsic(alice, sudo, {}); | ||
const call = api.tx.balances.transferKeepAlive(bob.address, 10n ** 6n); | ||
const sudo = api.tx.sudo.sudo(call); | ||
await submitExtrinsic(alice, sudo, {}); | ||
} | ||
|
||
export { run }; |
Oops, something went wrong.