diff --git a/.github/workflows/node.js.yml b/.github/workflows/build.yml similarity index 69% rename from .github/workflows/node.js.yml rename to .github/workflows/build.yml index 63f342b3..3964256e 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/build.yml @@ -1,7 +1,8 @@ -name: Formater and linter +name: Build on: - [push] + push: + workflow_call: jobs: build: @@ -26,4 +27,10 @@ jobs: - name: Build package run: npm run build + - name: Upload build artifacts + uses: actions/upload-artifact@v2 + with: + name: build-artifacts + path: ./dist + diff --git a/.github/workflows/ci-unit-tests.yml b/.github/workflows/massaStation-e2e-tests.yml similarity index 86% rename from .github/workflows/ci-unit-tests.yml rename to .github/workflows/massaStation-e2e-tests.yml index d6d1f1b3..441f5411 100644 --- a/.github/workflows/ci-unit-tests.yml +++ b/.github/workflows/massaStation-e2e-tests.yml @@ -1,8 +1,16 @@ -name: CI unit tests -on: [push] +name: MassaStation e2e tests + +on: + push: + workflow_call: + jobs: - tests-e2e: + build: + uses: ./.github/workflows/build.yml + + massaStation-tests-e2e: runs-on: ubuntu-latest + needs: build steps: - uses: actions/checkout@v3 @@ -17,8 +25,11 @@ jobs: npm ci sudo apt install xvfb libnss3-tools libwebkit2gtk-4.0-dev - - name: Build bundle - run: npm run build + - name: Download build artifacts + uses: actions/download-artifact@v2 + with: + name: build-artifacts + path: ./dist - name: Download MassaStation run: | diff --git a/.github/workflows/npm-publish-dev.yml b/.github/workflows/npm-publish-dev.yml index e4c0e54a..2a2db7ee 100644 --- a/.github/workflows/npm-publish-dev.yml +++ b/.github/workflows/npm-publish-dev.yml @@ -5,9 +5,12 @@ on: branches: [ main ] jobs: + test: + uses: ./.github/workflows/massaStation-e2e-tests.yml publish-npm-dev: runs-on: ubuntu-latest + needs: test steps: - name: Checkout code diff --git a/.github/workflows/npm-publish-next.yml b/.github/workflows/npm-publish-next.yml index 504bee42..721d116a 100644 --- a/.github/workflows/npm-publish-next.yml +++ b/.github/workflows/npm-publish-next.yml @@ -5,9 +5,12 @@ on: branches: [next] jobs: - publish-npm-dev: + test: + uses: ./.github/workflows/massaStation-e2e-tests.yml + publish-npm-next: runs-on: ubuntu-latest + needs: test steps: - name: Checkout code diff --git a/src/bearbyWallet/BearbyAccount.ts b/src/bearbyWallet/BearbyAccount.ts index c8e69522..b0f5f4d6 100644 --- a/src/bearbyWallet/BearbyAccount.ts +++ b/src/bearbyWallet/BearbyAccount.ts @@ -50,7 +50,7 @@ export class BearbyAccount implements Provider { const res = await web3.massa.getAddresses(this.address); if (res.error) { - throw new Error(res.error?.message || 'Bearby unknown error'); + throw new Error(res.error?.message || 'Bearby getAddresses error'); } // TODO: fix typings in bearby.js to avoid this cast @@ -235,7 +235,7 @@ export class BearbyAccount implements Provider { const res = await web3.massa.getOperations(opId); if (res.error) { - throw new Error(res.error?.message || 'Bearby unknown error'); + throw new Error(res.error?.message || 'Bearby getOperations error'); } const op = res.result[0] as any; if (op.op_exec_status === null) { diff --git a/src/bearbyWallet/utils/network.ts b/src/bearbyWallet/utils/network.ts index 8e7f5266..f1746c1a 100644 --- a/src/bearbyWallet/utils/network.ts +++ b/src/bearbyWallet/utils/network.ts @@ -4,9 +4,13 @@ import { Network } from '@massalabs/massa-web3'; export const networkInfos = async (): Promise => { const { net } = await web3.wallet.network; // TODO: fix bearby.js typings - const { result } = (await web3.massa.getNodesStatus()) as any; + const res = await web3.massa.getNodesStatus() as any; + if (res.error) { + throw new Error(res.error?.message || 'Bearby getNodesStatus error'); + } + return { name: net, - chainId: result.chain_id, + chainId: res.result.chain_id, }; };