git.delta.rocks / unique-network / refs/commits / f59d814cf24d

difftreelog

tests: add unit tests in a parallel to integration tests with autosealed mode

Alexander Aksenov2022-08-18parent: #032326e.patch.diff
in: master

8 files changed

modified.docker/Dockerfile-chain-devdiffbeforeafterboth
--- a/.docker/Dockerfile-chain-dev
+++ b/.docker/Dockerfile-chain-dev
@@ -11,9 +11,6 @@
 RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none
 
 ARG RUST_TOOLCHAIN=
-ARG POLKADOT_BUILD_BRANCH=
-ARG BRANCH=
-ARG REPO_URL=
 ARG FEATURE=
 
 RUN rustup toolchain uninstall $(rustup toolchain list) && \
@@ -21,7 +18,9 @@
     rustup default $RUST_TOOLCHAIN && \
     rustup target add wasm32-unknown-unknown --toolchain $RUST_TOOLCHAIN
 
-RUN mkdir /dev_chain && git clone $REPO_URL -b $BRANCH /dev_chain
+RUN mkdir /dev_chain 
+COPY . /dev_chain
+
 WORKDIR /dev_chain
 
 RUN cargo build --release
added.docker/Dockerfile-chain-dev-unitdiffbeforeafterboth
after · .docker/Dockerfile-chain-dev-unit
1FROM ubuntu:20.0423ENV DEBIAN_FRONTEND=noninteractive4ENV TZ=Etc/UTC56RUN apt-get update && apt-get install -y git curl libssl-dev llvm pkg-config libclang-dev clang git make cmake78ENV CARGO_HOME="/cargo-home"9ENV PATH="/cargo-home/bin:$PATH"1011RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none1213ARG RUST_TOOLCHAIN=14ARG FEATURE=1516RUN rustup toolchain uninstall $(rustup toolchain list) && \17    rustup toolchain install $RUST_TOOLCHAIN && \18    rustup default $RUST_TOOLCHAIN && \19    rustup target add wasm32-unknown-unknown --toolchain $RUST_TOOLCHAIN2021RUN mkdir /dev_chain 22COPY . /dev_chain2324WORKDIR /dev_chain2526RUN cargo test --features=limit-testing2728CMD cargo test --features=limit-testing
modified.docker/docker-compose-dev.yamldiffbeforeafterboth
--- a/.docker/docker-compose-dev.yaml
+++ b/.docker/docker-compose-dev.yaml
@@ -7,13 +7,3 @@
       dockerfile: .docker/Dockerfile-chain-dev
     image: node-dev
     container_name: node-dev
-    expose:
-      - 9944
-      - 9933
-    ports:
-      - 127.0.0.1:9944:9944
-      - 127.0.0.1:9933:9933
-    logging:
-      options:
-        max-size: "1m"
-        max-file: "3"
added.docker/docker-compose.tmp-dev.j2diffbeforeafterboth
--- /dev/null
+++ b/.docker/docker-compose.tmp-dev.j2
@@ -0,0 +1,22 @@
+version: "3.5"
+
+services:
+  node-dev:
+    build:
+      args:
+        - "RUST_TOOLCHAIN={{ RUST_TOOLCHAIN }}"
+        - "FEATURE={{ FEATURE }}"
+      context: ../
+      dockerfile: .docker/Dockerfile-chain-dev
+    expose:
+      - 9944
+      - 9933
+    ports:
+      - 127.0.0.1:9944:9944
+      - 127.0.0.1:9933:9933
+    logging:
+      options:
+        max-size: "1m"
+        max-file: "3"
+    command: cargo run --release --features=$FEATURE -- --dev -linfo --unsafe-ws-external --rpc-cors=all --unsafe-rpc-external
+    
\ No newline at end of file
added.docker/docker-compose.tmp-unit.j2diffbeforeafterboth
--- /dev/null
+++ b/.docker/docker-compose.tmp-unit.j2
@@ -0,0 +1,16 @@
+version: "3.5"
+
+services:
+  node-dev:
+    build:
+      context: ../
+      dockerfile: .docker/Dockerfile-chain-dev-unit
+      args:
+        - "RUST_TOOLCHAIN={{ RUST_TOOLCHAIN }}"
+        - "FEATURE={{ FEATURE }}"
+    logging:
+      options:
+        max-size: "1m"
+        max-file: "3"
+
+    
\ No newline at end of file
deleted.docker/docker-compose.tmp.j2diffbeforeafterboth
--- a/.docker/docker-compose.tmp.j2
+++ /dev/null
@@ -1,13 +0,0 @@
-version: "3.5"
-
-services:
-  node-dev:
-    build:
-      args:
-        - "RUST_TOOLCHAIN={{ RUST_TOOLCHAIN }}"
-        - "BRANCH={{ BRANCH }}"
-        - "REPO_URL={{ REPO_URL }}"
-        - "FEATURE={{ FEATURE }}"
-        - "POLKADOT_BUILD_BRANCH={{ POLKADOT_BUILD_BRANCH }}"
-
-    command: cargo run --release --features=$FEATURE -- --dev -linfo --unsafe-ws-external --rpc-cors=all --unsafe-rpc-external
added.github/workflows/dev-build-tests.ymldiffbeforeafterboth
--- /dev/null
+++ b/.github/workflows/dev-build-tests.yml
@@ -0,0 +1,186 @@
+name: yarn test dev
+
+# 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.ref }}
+  cancel-in-progress: true
+
+# A workflow run is made up of one or more jobs that can run sequentially or in parallel
+jobs:
+  
+  dev_build_int_tests:
+    # 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"
+          - network: "Quartz"
+            features: "quartz-runtime"
+          - network: "Unique"
+            features: "unique-runtime"
+
+    steps:
+      - name: Skip if pull request is in Draft
+        # `if: github.event.pull_request.draft == true` should be kept here, at
+        # the step level, rather than at the job level. The latter is not
+        # recommended because when the PR is moved from "Draft" to "Ready to
+        # review" the workflow will immediately be passing (since it was skipped),
+        # even though it hasn't actually ran, since it takes a few seconds for
+        # the workflow to start. This is also disclosed in:
+        # https://github.community/t/dont-run-actions-on-draft-pull-requests/16817/17
+        # That scenario would open an opportunity for the check to be bypassed:
+        # 1. Get your PR approved
+        # 2. Move it to Draft
+        # 3. Push whatever commits you want
+        # 4. Move it to "Ready for review"; now the workflow is passing (it was
+        #    skipped) and "Check reviews" is also passing (it won't be updated
+        #    until the workflow is finished)
+        if: github.event.pull_request.draft == true
+        run: exit 1
+
+      - 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
+
+      - uses: actions/setup-node@v3
+        with:
+          node-version: 16
+
+      - name: Run tests
+        run: |
+          cd tests
+          yarn install
+          yarn add mochawesome
+          echo "Ready to start tests"
+          node scripts/readyness.js
+          NOW=$(date +%s) && yarn test --reporter mochawesome --reporter-options reportFilename=test-${NOW}
+        env:
+          RPC_URL: http://127.0.0.1:9933/
+
+      - name: Test Report
+        uses: phoenix-actions/test-reporting@v8
+        id: test-report
+        if: success() || failure()    # run this step even if previous step failed
+        with:
+          name: Tests ${{ matrix.network }}            # Name of the check run which will be created
+          path: tests/mochawesome-report/test-*.json    # Path to test results
+          reporter: mochawesome-json
+          fail-on-error: 'false'
+
+      - name: Read output variables
+        run: |
+          echo "url is ${{ steps.test-report.outputs.runHtmlUrl }}"
+
+      - 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
+
+
+  dev_build_unit_test:
+    # The type of runner that the job will run on
+    runs-on: [self-hosted-ci,medium]
+    timeout-minutes: 1380
+
+
+    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.
+
+
+    steps:
+      - name: Skip if pull request is in Draft
+        # `if: github.event.pull_request.draft == true` should be kept here, at
+        # the step level, rather than at the job level. The latter is not
+        # recommended because when the PR is moved from "Draft" to "Ready to
+        # review" the workflow will immediately be passing (since it was skipped),
+        # even though it hasn't actually ran, since it takes a few seconds for
+        # the workflow to start. This is also disclosed in:
+        # https://github.community/t/dont-run-actions-on-draft-pull-requests/16817/17
+        # That scenario would open an opportunity for the check to be bypassed:
+        # 1. Get your PR approved
+        # 2. Move it to Draft
+        # 3. Push whatever commits you want
+        # 4. Move it to "Ready for review"; now the workflow is passing (it was
+        #    skipped) and "Check reviews" is also passing (it won't be updated
+        #    until the workflow is finished)
+        if: github.event.pull_request.draft == true
+        run: exit 1
+
+      - 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-unit.j2
+          output_file: .docker/docker-compose.unit.yml
+          variables: |
+            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
+            FEATURE=${{ matrix.features }}
+    
+
+      - name: Show build configuration
+        run: cat .docker/docker-compose.unit.yml
+
+      - name: Build the stack
+        run: docker-compose -f ".docker/docker-compose-dev.yaml" -f ".docker/docker-compose.unit.yml" up -d --build
+
+
+      - name: Stop running containers
+        if: always()                   # run this step always
+        run: docker-compose -f ".docker/docker-compose-dev.yaml" -f ".docker/docker-compose.unit.yml" down
deleted.github/workflows/node_build_test.ymldiffbeforeafterboth
--- a/.github/workflows/node_build_test.yml
+++ /dev/null
@@ -1,126 +0,0 @@
-name: Yarn test dev
-
-# 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.ref }}
-  cancel-in-progress: true
-
-# A workflow run is made up of one or more jobs that can run sequentially or in parallel
-jobs:
-  dev_build_test:
-    # 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"
-          - network: "Quartz"
-            features: "quartz-runtime"
-          - network: "Unique"
-            features: "unique-runtime"
-
-    steps:
-      - name: Skip if pull request is in Draft
-        # `if: github.event.pull_request.draft == true` should be kept here, at
-        # the step level, rather than at the job level. The latter is not
-        # recommended because when the PR is moved from "Draft" to "Ready to
-        # review" the workflow will immediately be passing (since it was skipped),
-        # even though it hasn't actually ran, since it takes a few seconds for
-        # the workflow to start. This is also disclosed in:
-        # https://github.community/t/dont-run-actions-on-draft-pull-requests/16817/17
-        # That scenario would open an opportunity for the check to be bypassed:
-        # 1. Get your PR approved
-        # 2. Move it to Draft
-        # 3. Push whatever commits you want
-        # 4. Move it to "Ready for review"; now the workflow is passing (it was
-        #    skipped) and "Check reviews" is also passing (it won't be updated
-        #    until the workflow is finished)
-        if: github.event.pull_request.draft == true
-        run: exit 1
-
-      - 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.j2
-          output_file: .docker/docker-compose.${{ matrix.network }}.yml
-          variables: |
-            REPO_URL=${{ github.server_url }}/${{ github.repository }}.git
-            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}
-            POLKADOT_BUILD_BRANCH=${{ env.POLKADOT_BUILD_BRANCH }}
-            FEATURE=${{ matrix.features }}
-            BRANCH=${{ github.head_ref }}
-
-      - 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
-
-      - uses: actions/setup-node@v3
-        with:
-          node-version: 16
-
-      - name: Run tests
-        run: |
-          cd tests
-          yarn install
-          yarn add mochawesome
-          echo "Ready to start tests"
-          node scripts/readyness.js
-          NOW=$(date +%s) && yarn test --reporter mochawesome --reporter-options reportFilename=test-${NOW}
-        env:
-          RPC_URL: http://127.0.0.1:9933/
-
-      - name: Test Report
-        uses: phoenix-actions/test-reporting@v8
-        id: test-report
-        if: success() || failure()    # run this step even if previous step failed
-        with:
-          name: Tests ${{ matrix.network }}            # Name of the check run which will be created
-          path: tests/mochawesome-report/test-*.json    # Path to test results
-          reporter: mochawesome-json
-          fail-on-error: 'false'
-
-      - name: Read output variables
-        run: |
-          echo "url is ${{ steps.test-report.outputs.runHtmlUrl }}"
-
-      - 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