git.delta.rocks / unique-network / refs/commits / 2469ee725ca5

difftreelog

correct and enable tests/scripts/readyness.js

Konstantin Astakhov2022-09-06parent: #c37bc7e.patch.diff
in: master

3 files changed

deleted.github/workflows/autogen-js-types.ymldiffbeforeafterboth
--- a/.github/workflows/autogen-js-types.yml
+++ /dev/null
@@ -1,140 +0,0 @@
-name: yarn autogetn JS types
-
-# Controls when the action will run.
-on:
- # Triggers the workflow on push or pull request events but only for the master branch
-  pull_request:
-    branches:
-      - develop
-    types:
-      - opened
-      - reopened
-      - synchronize   #commit(s) pushed to the pull request
-      - ready_for_review
-
-  # Allows you to run this workflow manually from the Actions tab
-  workflow_dispatch:
-
-#Define Workflow variables
-env:
-  REPO_URL: ${{ github.server_url }}/${{ github.repository }}
-
-concurrency: 
-  group: ${{ github.workflow }}-${{ github.head_ref }}
-  cancel-in-progress: true
-
-# A workflow run is made up of one or more jobs that can run sequentially or in parallel
-jobs:
-  
-  autogen_js_types:
-    # The type of runner that the job will run on
-    runs-on: [self-hosted-ci,medium]
-    timeout-minutes: 1380
-
-    name: ${{ matrix.network }}
-
-    continue-on-error: true         #Do not stop testing of matrix runs failed.  As it decided during PR review - it required 50/50& Let's check it with false.
-
-    strategy:
-      matrix:
-        include:
-          - network: "opal"
-            features: "opal-runtime"
-            branch: "opal-testnet"
-          - network: "quartz"
-            features: "quartz-runtime"
-            branch: "quartz-mainnet"
-          - network: "unique"
-            features: "unique-runtime"
-            branch: "master"
-
-    steps:
-      - name: Clean Workspace
-        uses: AutoModality/action-clean@v1.1.0
-
-      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
-      - uses: actions/checkout@v3
-        with:
-          ref: ${{ github.head_ref }}  #Checking out head commit
-
-      - name: Read .env file
-        uses: xom9ikk/dotenv@v1.0.2
-
-      - name: Generate ENV related extend file for docker-compose
-        uses: cuchi/jinja2-action@v1.2.0
-        with:
-          template: .docker/docker-compose.tmp-dev.j2
-          output_file: .docker/docker-compose.${{ matrix.network }}.yml
-          variables: |
-            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
-            FEATURE=${{ matrix.features }}
-    
-
-      - name: Show build configuration
-        run: cat .docker/docker-compose.${{ matrix.network }}.yml
-
-      - name: Build the stack
-        run: docker-compose -f ".docker/docker-compose-dev.yaml" -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build --remove-orphans
- 
-      - name: Wait untill node-dev started.
-        run: sleep 600s
-
-      - uses: actions/setup-node@v3
-        with:
-          node-version: 16
-
-      - name: Generate 
-        working-directory: tests
-        run: |
-          yarn install
-          yarn polkadot-types
-
-      - name: Checkout repo UniqueNetwork/unique-types-js
-        uses: actions/checkout@v3
-        with:
-          repository: 'UniqueNetwork/unique-types-js'
-#          ssh-key: ${{ secrets.GH_PAT }}
-          path: 'tests/unique-types-js'
-#          ref: 'QA-65_maxandreev'
- 
-      - name: Copy files
-        working-directory: tests
-        run: |
-          rsync -ar --exclude .gitignore src/interfaces/ unique-types-js
-          for file in unique-types-js/augment-* unique-types-js/**/types.ts unique-types-js/registry.ts; do
-              sed -i '1s;^;//@ts-nocheck\n;' $file
-          done
-
-      - name: Enumerate files after generation
-        working-directory: tests/unique-types-js
-        run: |
-          ls -la
-
-      - name: Enumerate files after generation
-        working-directory: tests/
-        run: |
-          ls -la
-
-      - name: Upload JS types to repo
-        working-directory: tests/unique-types-js
-        run: |
-          git config user.name github-actions
-          git config user.email github-actions@github.com
-          git add .
-          git commit -m "chore: regenerate types"
-   
-      - name: Pushes to another repository
-        id: push_directory
-        uses: cpina/github-action-push-to-another-repository@main
-        env:
-          SSH_DEPLOY_KEY: ${{ secrets.GH_MAK }}
-        with:
-          source-directory: tests/unique-types-js
-          destination-repository-name: 'lzadjsf/unique-types-js'
-          commit-message: 'chore: regenerate types'
-          target-branch: ${{ matrix.branch }}
-
-
-      - name: Stop running containers
-        if: always()                   # run this step always
-        run: docker-compose -f ".docker/docker-compose-dev.yaml" -f ".docker/docker-compose.${{ matrix.network }}.yml" down
modified.github/workflows/dev-build-tests.ymldiffbeforeafterboth
before · .github/workflows/dev-build-tests.yml
1name: yarn test dev23# Controls when the action will run.4on:5 # Triggers the workflow on push or pull request events but only for the master branch6  pull_request:7    branches:8      - develop9    types:10      - opened11      - reopened12      - synchronize   #commit(s) pushed to the pull request13      - ready_for_review1415  # Allows you to run this workflow manually from the Actions tab16  workflow_dispatch:1718#Define Workflow variables19env:20  REPO_URL: ${{ github.server_url }}/${{ github.repository }}2122concurrency: 23  group: ${{ github.workflow }}-${{ github.head_ref }}24  cancel-in-progress: true2526# A workflow run is made up of one or more jobs that can run sequentially or in parallel27jobs:28  29  dev_build_int_tests:30    # The type of runner that the job will run on31    runs-on: [self-hosted-ci,medium]32    timeout-minutes: 13803334    name: ${{ matrix.network }}3536    continue-on-error: true         #Do not stop testing of matrix runs failed.  As it decided during PR review - it required 50/50& Let's check it with false.3738    strategy:39      matrix:40        include:41          - network: "opal"42            features: "opal-runtime"43          - network: "quartz"44            features: "quartz-runtime"45          - network: "unique"46            features: "unique-runtime"4748    steps:49      - name: Skip if pull request is in Draft50        # `if: github.event.pull_request.draft == true` should be kept here, at51        # the step level, rather than at the job level. The latter is not52        # recommended because when the PR is moved from "Draft" to "Ready to53        # review" the workflow will immediately be passing (since it was skipped),54        # even though it hasn't actually ran, since it takes a few seconds for55        # the workflow to start. This is also disclosed in:56        # https://github.community/t/dont-run-actions-on-draft-pull-requests/16817/1757        # That scenario would open an opportunity for the check to be bypassed:58        # 1. Get your PR approved59        # 2. Move it to Draft60        # 3. Push whatever commits you want61        # 4. Move it to "Ready for review"; now the workflow is passing (it was62        #    skipped) and "Check reviews" is also passing (it won't be updated63        #    until the workflow is finished)64        if: github.event.pull_request.draft == true65        run: exit 16667      - name: Clean Workspace68        uses: AutoModality/action-clean@v1.1.06970      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it71      - uses: actions/checkout@v372        with:73          ref: ${{ github.head_ref }}  #Checking out head commit7475      - name: Read .env file76        uses: xom9ikk/dotenv@v1.0.27778      - name: Generate ENV related extend file for docker-compose79        uses: cuchi/jinja2-action@v1.2.080        with:81          template: .docker/docker-compose.tmp-dev.j282          output_file: .docker/docker-compose.${{ matrix.network }}.yml83          variables: |84            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}85            FEATURE=${{ matrix.features }}86    8788      - name: Show build configuration89        run: cat .docker/docker-compose.${{ matrix.network }}.yml9091      - name: Build the stack92        run: docker-compose -f ".docker/docker-compose-dev.yaml" -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build --remove-orphans9394      - uses: actions/setup-node@v395        with:96          node-version: 169798      - name: Run tests99        run: |100          cd tests101          yarn install102          yarn add mochawesome103          echo "Ready to start tests"104          node scripts/readyness.js105          NOW=$(date +%s) && yarn test --reporter mochawesome --reporter-options reportFilename=test-${NOW}106        env:107          RPC_URL: http://127.0.0.1:9933/108109      - name: Test Report110        uses: phoenix-actions/test-reporting@v8111        id: test-report112        if: success() || failure()    # run this step even if previous step failed113        with:114          name: int test results - ${{ matrix.network }}            # Name of the check run which will be created115          path: tests/mochawesome-report/test-*.json    # Path to test results116          reporter: mochawesome-json117          fail-on-error: 'false'118119      - name: Read output variables120        run: |121          echo "url is ${{ steps.test-report.outputs.runHtmlUrl }}"122123      - name: Stop running containers124        if: always()                   # run this step always125        run: docker-compose -f ".docker/docker-compose-dev.yaml" -f ".docker/docker-compose.${{ matrix.network }}.yml" down
after · .github/workflows/dev-build-tests.yml
1name: yarn test dev23# Controls when the action will run.4on:5 # Triggers the workflow on push or pull request events but only for the master branch6  pull_request:7    branches:8      - develop9    types:10      - opened11      - reopened12      - synchronize   #commit(s) pushed to the pull request13      - ready_for_review1415  # Allows you to run this workflow manually from the Actions tab16  workflow_dispatch:1718#Define Workflow variables19env:20  REPO_URL: ${{ github.server_url }}/${{ github.repository }}2122concurrency: 23  group: ${{ github.workflow }}-${{ github.head_ref }}24  cancel-in-progress: true2526# A workflow run is made up of one or more jobs that can run sequentially or in parallel27jobs:28  29  dev_build_int_tests:30    # The type of runner that the job will run on31    runs-on: [self-hosted-ci,medium]32    timeout-minutes: 13803334    name: ${{ matrix.network }}3536    continue-on-error: true         #Do not stop testing of matrix runs failed.  As it decided during PR review - it required 50/50& Let's check it with false.3738    strategy:39      matrix:40        include:41          - network: "opal"42            features: "opal-runtime"43          - network: "quartz"44            features: "quartz-runtime"45          - network: "unique"46            features: "unique-runtime"4748    steps:49      - name: Skip if pull request is in Draft50        # `if: github.event.pull_request.draft == true` should be kept here, at51        # the step level, rather than at the job level. The latter is not52        # recommended because when the PR is moved from "Draft" to "Ready to53        # review" the workflow will immediately be passing (since it was skipped),54        # even though it hasn't actually ran, since it takes a few seconds for55        # the workflow to start. This is also disclosed in:56        # https://github.community/t/dont-run-actions-on-draft-pull-requests/16817/1757        # That scenario would open an opportunity for the check to be bypassed:58        # 1. Get your PR approved59        # 2. Move it to Draft60        # 3. Push whatever commits you want61        # 4. Move it to "Ready for review"; now the workflow is passing (it was62        #    skipped) and "Check reviews" is also passing (it won't be updated63        #    until the workflow is finished)64        if: github.event.pull_request.draft == true65        run: exit 16667      - name: Clean Workspace68        uses: AutoModality/action-clean@v1.1.06970      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it71      - uses: actions/checkout@v372        with:73          ref: ${{ github.head_ref }}  #Checking out head commit7475      - name: Read .env file76        uses: xom9ikk/dotenv@v1.0.27778      - name: Generate ENV related extend file for docker-compose79        uses: cuchi/jinja2-action@v1.2.080        with:81          template: .docker/docker-compose.tmp-dev.j282          output_file: .docker/docker-compose.${{ matrix.network }}.yml83          variables: |84            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}85            FEATURE=${{ matrix.features }}86    8788      - name: Show build configuration89        run: cat .docker/docker-compose.${{ matrix.network }}.yml9091      - name: Build the stack92        run: docker-compose -f ".docker/docker-compose-dev.yaml" -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build --remove-orphans9394      - uses: actions/setup-node@v395        with:96          node-version: 169798      - name: Run tests99        working-directory: tests100        run: |101          yarn install102          yarn add mochawesome103          yarn polkadot-types104          105          echo "Ready to start tests"106          node scripts/readyness.js107          NOW=$(date +%s) && yarn test --reporter mochawesome --reporter-options reportFilename=test-${NOW}108        env:109          RPC_URL: http://127.0.0.1:9933/110111      - name: Test Report112        uses: phoenix-actions/test-reporting@v8113        id: test-report114        if: success() || failure()    # run this step even if previous step failed115        with:116          name: int test results - ${{ matrix.network }}            # Name of the check run which will be created117          path: tests/mochawesome-report/test-*.json    # Path to test results118          reporter: mochawesome-json119          fail-on-error: 'false'120121      - name: Read output variables122        run: |123          echo "url is ${{ steps.test-report.outputs.runHtmlUrl }}"124125      - name: Stop running containers126        if: always()                   # run this step always127        run: docker-compose -f ".docker/docker-compose-dev.yaml" -f ".docker/docker-compose.${{ matrix.network }}.yml" down
modifiedtests/scripts/readyness.jsdiffbeforeafterboth
--- a/tests/scripts/readyness.js
+++ b/tests/scripts/readyness.js
@@ -6,9 +6,9 @@
   await api.isReadyOrError;
 
   const head = (await api.rpc.chain.getHeader()).number.toNumber();
+  await api.disconnect();
   if(head < 1) throw Error('No block #1');
 
-  await api.disconnect();
 }
 
 const sleep = time => {