difftreelog
tests: add unit tests in a parallel to integration tests with autosealed mode
in: master
8 files changed
.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
.docker/Dockerfile-chain-dev-unitdiffbeforeafterboth--- /dev/null
+++ b/.docker/Dockerfile-chain-dev-unit
@@ -0,0 +1,28 @@
+FROM ubuntu:20.04
+
+ENV DEBIAN_FRONTEND=noninteractive
+ENV TZ=Etc/UTC
+
+RUN apt-get update && apt-get install -y git curl libssl-dev llvm pkg-config libclang-dev clang git make cmake
+
+ENV CARGO_HOME="/cargo-home"
+ENV PATH="/cargo-home/bin:$PATH"
+
+RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none
+
+ARG RUST_TOOLCHAIN=
+ARG FEATURE=
+
+RUN rustup toolchain uninstall $(rustup toolchain list) && \
+ rustup toolchain install $RUST_TOOLCHAIN && \
+ rustup default $RUST_TOOLCHAIN && \
+ rustup target add wasm32-unknown-unknown --toolchain $RUST_TOOLCHAIN
+
+RUN mkdir /dev_chain
+COPY . /dev_chain
+
+WORKDIR /dev_chain
+
+RUN cargo test --features=limit-testing
+
+CMD cargo test --features=limit-testing
\ No newline at end of file
.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"
.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
.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
.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
.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
.github/workflows/node_build_test.ymldiffbeforeafterboth1name: 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.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 dev_build_test:29 # The type of runner that the job will run on30 runs-on: [self-hosted-ci,medium]31 timeout-minutes: 13803233 name: ${{ matrix.network }}3435 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.3637 strategy:38 matrix:39 include:40 - network: "Opal"41 features: "opal-runtime"42 - network: "Quartz"43 features: "quartz-runtime"44 - network: "Unique"45 features: "unique-runtime"4647 steps:48 - name: Skip if pull request is in Draft49 # `if: github.event.pull_request.draft == true` should be kept here, at50 # the step level, rather than at the job level. The latter is not51 # recommended because when the PR is moved from "Draft" to "Ready to52 # review" the workflow will immediately be passing (since it was skipped),53 # even though it hasn't actually ran, since it takes a few seconds for54 # the workflow to start. This is also disclosed in:55 # https://github.community/t/dont-run-actions-on-draft-pull-requests/16817/1756 # That scenario would open an opportunity for the check to be bypassed:57 # 1. Get your PR approved58 # 2. Move it to Draft59 # 3. Push whatever commits you want60 # 4. Move it to "Ready for review"; now the workflow is passing (it was61 # skipped) and "Check reviews" is also passing (it won't be updated62 # until the workflow is finished)63 if: github.event.pull_request.draft == true64 run: exit 16566 - name: Clean Workspace67 uses: AutoModality/action-clean@v1.1.06869 # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it70 - uses: actions/checkout@v371 with:72 ref: ${{ github.head_ref }} #Checking out head commit7374 - name: Read .env file75 uses: xom9ikk/dotenv@v1.0.27677 - name: Generate ENV related extend file for docker-compose78 uses: cuchi/jinja2-action@v1.2.079 with:80 template: .docker/docker-compose.tmp.j281 output_file: .docker/docker-compose.${{ matrix.network }}.yml82 variables: |83 REPO_URL=${{ github.server_url }}/${{ github.repository }}.git84 RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}85 POLKADOT_BUILD_BRANCH=${{ env.POLKADOT_BUILD_BRANCH }}86 FEATURE=${{ matrix.features }}87 BRANCH=${{ github.head_ref }}8889 - name: Show build configuration90 run: cat .docker/docker-compose.${{ matrix.network }}.yml9192 - name: Build the stack93 run: docker-compose -f ".docker/docker-compose-dev.yaml" -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build9495 - uses: actions/setup-node@v396 with:97 node-version: 169899 - name: Run tests100 run: |101 cd tests102 yarn install103 yarn add mochawesome104 echo "Ready to start tests"105 node scripts/readyness.js106 NOW=$(date +%s) && yarn test --reporter mochawesome --reporter-options reportFilename=test-${NOW}107 env:108 RPC_URL: http://127.0.0.1:9933/109110 - name: Test Report111 uses: phoenix-actions/test-reporting@v8112 id: test-report113 if: success() || failure() # run this step even if previous step failed114 with:115 name: Tests ${{ matrix.network }} # Name of the check run which will be created116 path: tests/mochawesome-report/test-*.json # Path to test results117 reporter: mochawesome-json118 fail-on-error: 'false'119120 - name: Read output variables121 run: |122 echo "url is ${{ steps.test-report.outputs.runHtmlUrl }}"123124 - name: Stop running containers125 if: always() # run this step always126 run: docker-compose -f ".docker/docker-compose-dev.yaml" -f ".docker/docker-compose.${{ matrix.network }}.yml" down