From e4516e49058db011748320eb5e7ed4732fd22dfd Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Mon, 12 Sep 2022 11:33:11 +0000 Subject: [PATCH] Merge pull request #573 from UniqueNetwork/CI-37-core-ci-step-3-v2 Ci 37 core ci step 3 v2 --- --- /dev/null +++ b/.github/workflows/canary.yml @@ -0,0 +1,12 @@ +on: + workflow_call: + +jobs: + + market-e2e-test: + name: market e2e tests + uses: ./.github/workflows/market-test_v2.yml + secrets: inherit + + + --- /dev/null +++ b/.github/workflows/ci-develop.yml @@ -0,0 +1,34 @@ +name: develop + +on: + pull_request: + branches: [ 'develop' ] + types: [ opened, reopened, synchronize, ready_for_review ] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref }} + cancel-in-progress: true + +jobs: + + yarn-test-dev: + uses: ./.github/workflows/dev-build-tests_v2.yml + + unit-test: + uses: ./.github/workflows/unit-test_v2.yml + + canary: + if: ${{ contains( github.event.pull_request.labels.*.name, 'canary') }} + uses: ./.github/workflows/canary.yml + secrets: inherit # pass all secrets + + xcm: + if: ${{ contains( github.event.pull_request.labels.*.name, 'xcm') }} + uses: ./.github/workflows/xcm.yml + secrets: inherit # pass all secrets + + codestyle: + uses: ./.github/workflows/codestyle_v2.yml + + yarn_eslint: + uses: ./.github/workflows/test_codestyle_v2.yml --- /dev/null +++ b/.github/workflows/ci-master.yml @@ -0,0 +1,35 @@ +name: master + +on: + pull_request: + branches: [ 'master' ] + types: [ opened, reopened, synchronize, ready_for_review ] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref }} + cancel-in-progress: true + +jobs: + + unit-test: + uses: ./.github/workflows/unit-test_v2.yml + + node-only-update: + uses: ./.github/workflows/node-only-update_v2.yml + + forkless: + if: ${{ contains( github.event.pull_request.labels.*.name, 'forkless') }} + uses: ./.github/workflows/forkless.yml + + canary: + if: ${{ contains( github.event.pull_request.labels.*.name, 'canary') }} + uses: ./.github/workflows/canary.yml + secrets: inherit # pass all secrets + + xcm: + if: ${{ contains( github.event.pull_request.labels.*.name, 'xcm') }} + uses: ./.github/workflows/xcm.yml + secrets: inherit # pass all secrets + + codestyle: + uses: ./.github/workflows/codestyle_v2.yml \ No newline at end of file --- /dev/null +++ b/.github/workflows/codestyle_v2.yml @@ -0,0 +1,43 @@ +name: cargo fmt + +on: + workflow_call: + +jobs: + rustfmt: + runs-on: self-hosted-ci + + steps: + - uses: actions/checkout@v3 + - name: Install latest nightly + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + default: true + target: wasm32-unknown-unknown + components: rustfmt, clippy + - name: Run cargo fmt + run: cargo fmt -- --check # In that mode it returns only exit code. + - name: Cargo fmt state + if: success() + run: echo "Nothing to do. Command 'cargo fmt -- --check' returned exit code 0." + + + clippy: + if: ${{ false }} + runs-on: self-hosted-ci + + steps: + + - uses: actions/checkout@v3 + - name: Install substrate dependencies + run: sudo apt-get install libssl-dev pkg-config libclang-dev clang + - name: Install latest nightly + uses: actions-rs/toolchain@v1 + with: + toolchain: nightly + default: true + target: wasm32-unknown-unknown + components: rustfmt, clippy + - name: Run cargo check + run: cargo clippy -- -Dwarnings --- a/.github/workflows/dev-build-tests.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.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: - - 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 --remove-orphans - - - uses: actions/setup-node@v3 - with: - node-version: 16 - - - name: Run tests - working-directory: tests - run: | - yarn install - yarn add mochawesome - echo "Ready to start tests" - node scripts/readyness.js - yarn polkadot-types - 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: int test results - ${{ 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/null +++ b/.github/workflows/dev-build-tests_v2.yml @@ -0,0 +1,97 @@ +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 + workflow_call: + + +#Define Workflow variables +env: + REPO_URL: ${{ github.server_url }}/${{ github.repository }} + + +# 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: 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 + + - uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Run tests + working-directory: tests + run: | + yarn install + yarn add mochawesome + echo "Ready to start tests" + node scripts/readyness.js + yarn polkadot-types + 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: int test results - ${{ 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/null +++ b/.github/workflows/execution-matrix.yml @@ -0,0 +1,42 @@ +name: Reusable workflow + +on: + workflow_call: + # Map the workflow outputs to job outputs + outputs: + matrix: + description: "The first output string" + value: ${{ jobs.create-matrix.outputs.matrix_output }} + +jobs: + + create-marix: + + name: Prepare execution matrix + + runs-on: self-hosted-ci + outputs: + matrix_output: ${{ steps.create_matrix.outputs.matrix }} + + 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: Create Execution matrix + uses: CertainLach/create-matrix-action@v3 + id: create_matrix + with: + matrix: | + network {opal}, runtime {opal}, features {opal-runtime}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}}, replica_from_address {${{ env.OPAL_REPLICA_FROM }}} + network {quartz}, runtime {quartz}, features {quartz-runtime}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}}, replica_from_address {${{ env.QUARTZ_REPLICA_FROM }}} + network {unique}, runtime {unique}, features {unique-runtime}, mainnet_branch {${{ env.UNIQUE_MAINNET_TAG }}}, replica_from_address {${{ env.UNIQUE_REPLICA_FROM }}} + --- a/.github/workflows/forkless-update-data.yml +++ /dev/null @@ -1,204 +0,0 @@ -name: upgrade replica - -# 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: - - master - 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: - - prepare-execution-marix: - - name: Prepare execution matrix - - runs-on: self-hosted-ci - outputs: - matrix: ${{ steps.create_matrix.outputs.matrix }} - - 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: Create Execution matrix - uses: CertainLach/create-matrix-action@v3 - id: create_matrix - with: - matrix: | - network {opal}, runtime {opal}, features {opal-runtime}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}}, replica_from_address {${{ env.OPAL_REPLICA_FROM }}} - network {quartz}, runtime {quartz}, features {quartz-runtime}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}}, replica_from_address {${{ env.QUARTZ_REPLICA_FROM }}} - network {unique}, runtime {unique}, features {unique-runtime}, mainnet_branch {${{ env.UNIQUE_MAINNET_TAG }}}, replica_from_address {${{ env.UNIQUE_REPLICA_FROM }}} - - - - forkless-update-data: - needs: prepare-execution-marix - # The type of runner that the job will run on - runs-on: [self-hosted-ci,large] - 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: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}} - - - 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-forkless-data.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 }} - POLKADOT_MAINNET_BRANCH=${{ env.POLKADOT_MAINNET_BRANCH }} - MAINNET_TAG=${{ matrix.mainnet_tag }} - MAINNET_BRANCH=${{ matrix.mainnet_branch }} - FEATURE=${{ matrix.features }} - RUNTIME=${{ matrix.runtime }} - BRANCH=${{ github.head_ref }} - REPLICA_FROM=${{ matrix.replica_from_address }} - - - name: Show build configuration - run: cat .docker/docker-compose.${{ matrix.network }}.yml - - - name: Generate launch-config-forkless-data.json - uses: cuchi/jinja2-action@v1.2.0 - with: - template: .docker/forkless-config/launch-config-forkless-data.j2 - output_file: .docker/launch-config-forkless-data.json - variables: | - FEATURE=${{ matrix.features }} - RUNTIME=${{ matrix.runtime }} - - - name: Show launch-config-forkless configuration - run: cat .docker/launch-config-forkless-data.json - - - - name: Build the stack - run: docker-compose -f ".docker/docker-compose-forkless.yml" -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build --force-recreate --timeout 300 - - - name: Check if docker logs consist logs related to Runtime Upgrade testing. - if: success() - run: | - counter=160 - function check_container_status { - docker inspect -f {{.State.Running}} node-parachain - } - function do_docker_logs { - docker logs --details node-parachain 2>&1 - } - function is_started { - if [ "$(check_container_status)" == "true" ]; then - echo "Container: node-parachain RUNNING"; - echo "Check Docker logs" - DOCKER_LOGS=$(do_docker_logs) - if [[ ${DOCKER_LOGS} = *"🛸 PARACHAINS' RUNTIME UPGRADE TESTING COMPLETE 🛸"* ]];then - echo "🛸 PARACHAINS' RUNTIME UPGRADE TESTING COMPLETE 🛸" - return 0 - elif [[ ${DOCKER_LOGS} = *"🚧 PARACHAINS' RUNTIME UPGRADE TESTING FAILED 🚧"* ]];then - echo "🚧 PARACHAINS' RUNTIME UPGRADE TESTING FAILED 🚧" - return 1 - else - echo "Message not found in logs output, repeating..." - return 1 - fi - else - echo "Container node-parachain not RUNNING" - echo "Halting all future checks" - exit 1 - fi - exit 0 - } - while ! is_started; do - echo "Waiting for special message in log files " - sleep 30s - counter=$(( $counter - 1 )) - echo "Counter: $counter" - if [ "$counter" -gt "0" ]; then - continue - else - break - fi - done - echo "Halting script" - exit 0 - shell: bash - - - name: Collect Docker Logs - if: success() || failure() - uses: jwalton/gh-docker-logs@v2.2.0 - with: - dest: './forkless-parachain-upgrade-data-logs.${{ matrix.features }}' - images: 'node-parachain' - - - name: Show Docker logs - if: success() || failure() - run: cat './forkless-parachain-upgrade-data-logs.${{ matrix.features }}/node-parachain.log' - - - name: Stop running containers - if: always() # run this step always - run: docker-compose -f ".docker/docker-compose-forkless.yml" -f ".docker/docker-compose.${{ matrix.network }}.yml" down --- /dev/null +++ b/.github/workflows/forkless-update-data_v2.yml @@ -0,0 +1,165 @@ +# Controls when the action will run. +on: + workflow_call: + + +#Define Workflow variables +env: + REPO_URL: ${{ github.server_url }}/${{ github.repository }} + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + + execution-marix: + + name: execution matrix + + runs-on: self-hosted-ci + outputs: + matrix: ${{ steps.create_matrix.outputs.matrix }} + + 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: Create Execution matrix + uses: CertainLach/create-matrix-action@v3 + id: create_matrix + with: + matrix: | + network {opal}, runtime {opal}, features {opal-runtime}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}}, replica_from_address {${{ env.OPAL_REPLICA_FROM }}} + network {quartz}, runtime {quartz}, features {quartz-runtime}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}}, replica_from_address {${{ env.QUARTZ_REPLICA_FROM }}} + network {unique}, runtime {unique}, features {unique-runtime}, mainnet_branch {${{ env.UNIQUE_MAINNET_TAG }}}, replica_from_address {${{ env.UNIQUE_REPLICA_FROM }}} + + forkless-update-data: + needs: execution-marix + # The type of runner that the job will run on + runs-on: [self-hosted-ci,large] + timeout-minutes: 1380 + + name: ${{ matrix.network }} + strategy: + matrix: + include: ${{fromJson(needs.execution-marix.outputs.matrix)}} + + 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: 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-forkless-data.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 }} + POLKADOT_MAINNET_BRANCH=${{ env.POLKADOT_MAINNET_BRANCH }} + MAINNET_TAG=${{ matrix.mainnet_tag }} + MAINNET_BRANCH=${{ matrix.mainnet_branch }} + FEATURE=${{ matrix.features }} + RUNTIME=${{ matrix.runtime }} + BRANCH=${{ github.head_ref }} + REPLICA_FROM=${{ matrix.replica_from_address }} + + - name: Show build configuration + run: cat .docker/docker-compose.${{ matrix.network }}.yml + + - name: Generate launch-config-forkless-data.json + uses: cuchi/jinja2-action@v1.2.0 + with: + template: .docker/forkless-config/launch-config-forkless-data.j2 + output_file: .docker/launch-config-forkless-data.json + variables: | + FEATURE=${{ matrix.features }} + RUNTIME=${{ matrix.runtime }} + + - name: Show launch-config-forkless configuration + run: cat .docker/launch-config-forkless-data.json + + + - name: Build the stack + run: docker-compose -f ".docker/docker-compose-forkless.yml" -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build --force-recreate --timeout 300 + + - name: Check if docker logs consist logs related to Runtime Upgrade testing. + if: success() + run: | + counter=160 + function check_container_status { + docker inspect -f {{.State.Running}} node-parachain + } + function do_docker_logs { + docker logs --details node-parachain 2>&1 + } + function is_started { + if [ "$(check_container_status)" == "true" ]; then + echo "Container: node-parachain RUNNING"; + echo "Check Docker logs" + DOCKER_LOGS=$(do_docker_logs) + if [[ ${DOCKER_LOGS} = *"🛸 PARACHAINS' RUNTIME UPGRADE TESTING COMPLETE 🛸"* ]];then + echo "🛸 PARACHAINS' RUNTIME UPGRADE TESTING COMPLETE 🛸" + return 0 + elif [[ ${DOCKER_LOGS} = *"🚧 PARACHAINS' RUNTIME UPGRADE TESTING FAILED 🚧"* ]];then + echo "🚧 PARACHAINS' RUNTIME UPGRADE TESTING FAILED 🚧" + return 1 + else + echo "Message not found in logs output, repeating..." + return 1 + fi + else + echo "Container node-parachain not RUNNING" + echo "Halting all future checks" + exit 1 + fi + exit 0 + } + while ! is_started; do + echo "Waiting for special message in log files " + sleep 30s + counter=$(( $counter - 1 )) + echo "Counter: $counter" + if [ "$counter" -gt "0" ]; then + continue + else + break + fi + done + echo "Halting script" + exit 0 + shell: bash + + - name: Collect Docker Logs + if: success() || failure() + uses: jwalton/gh-docker-logs@v2.2.0 + with: + dest: './forkless-parachain-upgrade-data-logs.${{ matrix.features }}' + images: 'node-parachain' + + - name: Show Docker logs + if: success() || failure() + run: cat './forkless-parachain-upgrade-data-logs.${{ matrix.features }}/node-parachain.log' + + - name: Stop running containers + if: always() # run this step always + run: docker-compose -f ".docker/docker-compose-forkless.yml" -f ".docker/docker-compose.${{ matrix.network }}.yml" down --volumes --- a/.github/workflows/forkless-update-nodata.yml +++ /dev/null @@ -1,204 +0,0 @@ -name: upgrade nodata - -# 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: - - master - 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: - - prepare-execution-marix: - - name: Prepare execution matrix - - runs-on: self-hosted-ci - outputs: - matrix: ${{ steps.create_matrix.outputs.matrix }} - - 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: Create Execution matrix - uses: fabiocaccamo/create-matrix-action@v2 - id: create_matrix - with: - matrix: | - network {opal}, runtime {opal}, features {opal-runtime}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}} - network {quartz}, runtime {quartz}, features {quartz-runtime}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}} - network {unique}, runtime {unique}, features {unique-runtime}, mainnet_branch {${{ env.UNIQUE_MAINNET_TAG }}} - - - - forkless-update-nodata: - needs: prepare-execution-marix - # The type of runner that the job will run on - runs-on: [self-hosted-ci,large] - - - - 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: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}} - - - 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-forkless-nodata.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 }} - POLKADOT_MAINNET_BRANCH=${{ env.POLKADOT_MAINNET_BRANCH }} - MAINNET_TAG=${{ matrix.mainnet_tag }} - MAINNET_BRANCH=${{ matrix.mainnet_branch }} - FEATURE=${{ matrix.features }} - RUNTIME=${{ matrix.runtime }} - BRANCH=${{ github.head_ref }} - - - name: Show build configuration - run: cat .docker/docker-compose.${{ matrix.network }}.yml - - - name: Generate launch-config-forkless-nodata.json - uses: cuchi/jinja2-action@v1.2.0 - with: - template: .docker/forkless-config/launch-config-forkless-nodata.j2 - output_file: .docker/launch-config-forkless-nodata.json - variables: | - FEATURE=${{ matrix.features }} - RUNTIME=${{ matrix.runtime }} - - - name: Show launch-config-forkless configuration - run: cat .docker/launch-config-forkless-nodata.json - - - - name: Build the stack - run: docker-compose -f ".docker/docker-compose-forkless.yml" -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build --force-recreate --timeout 300 - - - name: Check if docker logs consist logs related to Runtime Upgrade testing. - if: success() - run: | - counter=160 - function check_container_status { - docker inspect -f {{.State.Running}} node-parachain - } - function do_docker_logs { - docker logs --details node-parachain 2>&1 - } - function is_started { - if [ "$(check_container_status)" == "true" ]; then - echo "Container: node-parachain RUNNING"; - echo "Check Docker logs" - DOCKER_LOGS=$(do_docker_logs) - if [[ ${DOCKER_LOGS} = *"🛸 PARACHAINS' RUNTIME UPGRADE TESTING COMPLETE 🛸"* ]];then - echo "🛸 PARACHAINS' RUNTIME UPGRADE TESTING COMPLETE 🛸" - return 0 - elif [[ ${DOCKER_LOGS} = *"🚧 PARACHAINS' RUNTIME UPGRADE TESTING FAILED 🚧"* ]];then - echo "🚧 PARACHAINS' RUNTIME UPGRADE TESTING FAILED 🚧" - return 1 - else - echo "Message not found in logs output, repeating..." - return 1 - fi - else - echo "Container node-parachain not RUNNING" - echo "Halting all future checks" - exit 1 - fi - exit 0 - } - while ! is_started; do - echo "Waiting for special message in log files " - sleep 30s - counter=$(( $counter - 1 )) - echo "Counter: $counter" - if [ "$counter" -gt "0" ]; then - continue - else - break - fi - done - echo "Halting script" - exit 0 - shell: bash - - - name: Collect Docker Logs - if: success() || failure() - uses: jwalton/gh-docker-logs@v2.2.0 - with: - dest: './forkless-parachain-upgrade-nodata-logs.${{ matrix.features }}' - images: 'node-parachain' - - - name: Show docker logs - if: success() || failure() - run: cat './forkless-parachain-upgrade-nodata-logs.${{ matrix.features }}/node-parachain.log' - - - name: Stop running containers - if: always() # run this step always - run: docker-compose -f ".docker/docker-compose-forkless.yml" -f ".docker/docker-compose.${{ matrix.network }}.yml" down --- /dev/null +++ b/.github/workflows/forkless-update-nodata_v2.yml @@ -0,0 +1,167 @@ + + +# Controls when the action will run. +on: + workflow_call: + + +#Define Workflow variables +env: + REPO_URL: ${{ github.server_url }}/${{ github.repository }} + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + execution-marix: + + name: Prepare execution matrix + + runs-on: self-hosted-ci + outputs: + matrix: ${{ steps.create_matrix.outputs.matrix }} + + 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: Create Execution matrix + uses: fabiocaccamo/create-matrix-action@v2 + id: create_matrix + with: + matrix: | + network {opal}, runtime {opal}, features {opal-runtime}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}} + network {quartz}, runtime {quartz}, features {quartz-runtime}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}} + network {unique}, runtime {unique}, features {unique-runtime}, mainnet_branch {${{ env.UNIQUE_MAINNET_TAG }}} + + + forkless-update-nodata: + needs: execution-marix + # The type of runner that the job will run on + runs-on: [self-hosted-ci,large] + + 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: ${{fromJson(needs.execution-marix.outputs.matrix)}} + + 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-forkless-nodata.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 }} + POLKADOT_MAINNET_BRANCH=${{ env.POLKADOT_MAINNET_BRANCH }} + MAINNET_TAG=${{ matrix.mainnet_tag }} + MAINNET_BRANCH=${{ matrix.mainnet_branch }} + FEATURE=${{ matrix.features }} + RUNTIME=${{ matrix.runtime }} + BRANCH=${{ github.head_ref }} + + - name: Show build configuration + run: cat .docker/docker-compose.${{ matrix.network }}.yml + + - name: Generate launch-config-forkless-nodata.json + uses: cuchi/jinja2-action@v1.2.0 + with: + template: .docker/forkless-config/launch-config-forkless-nodata.j2 + output_file: .docker/launch-config-forkless-nodata.json + variables: | + FEATURE=${{ matrix.features }} + RUNTIME=${{ matrix.runtime }} + + - name: Show launch-config-forkless configuration + run: cat .docker/launch-config-forkless-nodata.json + + + - name: Build the stack + run: docker-compose -f ".docker/docker-compose-forkless.yml" -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build --force-recreate --timeout 300 + + - name: Check if docker logs consist logs related to Runtime Upgrade testing. + if: success() + run: | + counter=160 + function check_container_status { + docker inspect -f {{.State.Running}} node-parachain + } + function do_docker_logs { + docker logs --details node-parachain 2>&1 + } + function is_started { + if [ "$(check_container_status)" == "true" ]; then + echo "Container: node-parachain RUNNING"; + echo "Check Docker logs" + DOCKER_LOGS=$(do_docker_logs) + if [[ ${DOCKER_LOGS} = *"🛸 PARACHAINS' RUNTIME UPGRADE TESTING COMPLETE 🛸"* ]];then + echo "🛸 PARACHAINS' RUNTIME UPGRADE TESTING COMPLETE 🛸" + return 0 + elif [[ ${DOCKER_LOGS} = *"🚧 PARACHAINS' RUNTIME UPGRADE TESTING FAILED 🚧"* ]];then + echo "🚧 PARACHAINS' RUNTIME UPGRADE TESTING FAILED 🚧" + return 1 + else + echo "Message not found in logs output, repeating..." + return 1 + fi + else + echo "Container node-parachain not RUNNING" + echo "Halting all future checks" + exit 1 + fi + exit 0 + } + while ! is_started; do + echo "Waiting for special message in log files " + sleep 30s + counter=$(( $counter - 1 )) + echo "Counter: $counter" + if [ "$counter" -gt "0" ]; then + continue + else + break + fi + done + echo "Halting script" + exit 0 + shell: bash + + - name: Collect Docker Logs + if: success() || failure() + uses: jwalton/gh-docker-logs@v2.2.0 + with: + dest: './forkless-parachain-upgrade-nodata-logs.${{ matrix.features }}' + images: 'node-parachain' + + - name: Show docker logs + if: success() || failure() + run: cat './forkless-parachain-upgrade-nodata-logs.${{ matrix.features }}/node-parachain.log' + + - name: Stop running containers + if: always() # run this step always + run: docker-compose -f ".docker/docker-compose-forkless.yml" -f ".docker/docker-compose.${{ matrix.network }}.yml" down --- /dev/null +++ b/.github/workflows/forkless.yml @@ -0,0 +1,18 @@ +name: Nesting Forkless + +on: + workflow_call: + +jobs: + + forkless-update-data: + name: with data + uses: ./.github/workflows/forkless-update-data_v2.yml + + forkless-update-no-data: + name: no data + uses: ./.github/workflows/forkless-update-nodata_v2.yml + + try-runtime: + name: try-runtime + uses: ./.github/workflows/try-runtime_v2.yml --- /dev/null +++ b/.github/workflows/generate-execution-matrix.yml @@ -0,0 +1,45 @@ +name: Prepare execution matrix + +on: + workflow_call: + # Map the workflow outputs to job outputs + outputs: + matrix_values: + description: "Matix output" + matrix: ${{ jobs.prepare-execution-matrix.outputs.matrix }} + + +#concurrency: +# group: ${{ github.workflow }}-${{ github.head_ref }} +# cancel-in-progress: true + + +jobs: + prepare-execution-matrix: + name: Generate output + runs-on: self-hosted-ci + # Map the job outputs to step outputs + outputs: + matrix: ${{ steps.create_matrix.outputs.matrix }} + + 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: Create Execution matrix + uses: CertainLach/create-matrix-action@v3 + id: create_matrix + with: + matrix: | + network {opal}, runtime {opal}, features {opal-runtime}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}}, replica_from_address {${{ env.OPAL_REPLICA_FROM }}} + network {quartz}, runtime {quartz}, features {quartz-runtime}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}}, replica_from_address {${{ env.QUARTZ_REPLICA_FROM }}} + network {unique}, runtime {unique}, features {unique-runtime}, mainnet_branch {${{ env.UNIQUE_MAINNET_TAG }}}, replica_from_address {${{ env.UNIQUE_REPLICA_FROM }}} --- /dev/null +++ b/.github/workflows/market-test.yml @@ -0,0 +1,227 @@ +name: market api tests + +# 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: + - master + 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: + + +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: + + market_test: + # The type of runner that the job will run on + runs-on: [self-hosted-ci,large] + timeout-minutes: 1380 + + strategy: + matrix: + include: + - network: "opal" + features: "opal-runtime" + - network: "quartz" + features: "quartz-runtime" + - network: "unique" + features: "unique-runtime" + + name: draft job + + 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 + - name: Checkout master repo + uses: actions/checkout@master + with: + ref: ${{ github.head_ref }} #Checking out head commit + + - name: Checkout Market e2e tests + uses: actions/checkout@v3 + with: + repository: 'UniqueNetwork/market-e2e-tests' + ssh-key: '${{ secrets.GH_PAT }}' + path: 'qa-tests' + ref: 'QA-65_maxandreev' + + - name: Read .env file + uses: xom9ikk/dotenv@v1.0.2 + + - name: Copy qa-tests/.env.example to qa-tests/.env + working-directory: qa-tests + run: cp .env.docker .env + + - name: Show content of qa-test/.env + working-directory: qa-tests + run: cat .env + + - name: Read qa -test .env file + uses: xom9ikk/dotenv@v1.0.2 + with: + path: qa-tests/ + + - name: Generate ENV related extend file for docker-compose + uses: cuchi/jinja2-action@v1.2.0 + with: + template: qa-tests/.docker/docker-compose.tmp-market.j2 + output_file: qa-tests/.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 + working-directory: qa-tests + run: cat .docker/docker-compose.${{ matrix.network }}.yml + + - name: Start node-parachain + working-directory: qa-tests + run: docker-compose -f ".docker/docker-compose.market.yml" -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build --remove-orphans --force-recreate node-parachain + + - name: Start nonce-app + working-directory: qa-tests + run: docker-compose -f ".docker/docker-compose.market.yml" up -d --build --remove-orphans --force-recreate nonce-app + + - uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Setup TypeScript + working-directory: qa-tests + run: | + npm install + npm install -g ts-node + + - name: Copy qa-tests/.env.example to qa-tests/.env + working-directory: qa-tests + run: | + rm -rf .env + cp .env.example .env + + + - name: Show content of qa-test/.env + working-directory: qa-tests + run: cat .env + + + - name: Read qa -test .env file + uses: xom9ikk/dotenv@v1.0.2 + with: + path: qa-tests/ + + - name: Generate accounts + working-directory: qa-tests + run: ts-node ./src/scripts/create-market-accounts.ts + + - name: Deploy contracts + run: | + cd qa-tests + ts-node ./src/scripts/deploy-contract.ts + + - name: Import test data + working-directory: qa-tests + run: ts-node ./src/scripts/create-test-collections.ts + + - name: Show content of qa-test .env + working-directory: qa-tests + run: cat .env + + - name: Copy qa-tests/.env.example to qa-tests/.env + working-directory: qa-tests + run: | + rm -rf .env.docker + cp .env .env.docker + sed -i '/UNIQUE_WS_ENDPOINT/c UNIQUE_WS_ENDPOINT=ws://node-parachain:9944' .env.docker + + - name: Read qa -test .env file + uses: xom9ikk/dotenv@v1.0.2 + with: + path: qa-tests/ + + - name: local-market:start + run: docker-compose -f "qa-tests/.docker/docker-compose.market.yml" -f "qa-tests/.docker/docker-compose.${{ matrix.network }}.yml" up -d --build + + - name: Wait for market readyness + working-directory: qa-tests + run: src/scripts/wait-market-ready.sh + shell: bash + + - name: Install dependecies + working-directory: qa-tests + run: | + npm ci + npm install -D @playwright/test + npx playwright install-deps + npx playwright install + + - name: + working-directory: qa-tests + run: | + npx playwright test --workers=8 --quiet .*.api.test.ts --reporter=github --config playwright.config.ts + + - name: Show env variables + if: success() || failure() + run: printenv + + - name: look up for report + if: success() || failure() + run: | + ls -la + ls -la qa-tests/ + + + - name: Stop running containers + if: always() # run this step always + run: docker-compose -f "qa-tests/.docker/docker-compose.market.yml" -f "qa-tests/.docker/docker-compose.${{ matrix.network }}.yml" down --volumes + + - name: Remove builder cache + if: always() # run this step always + run: | + docker builder prune -f + docker system prune -f + + - name: Clean Workspace + if: always() + uses: AutoModality/action-clean@v1.1.0 + + + + --- /dev/null +++ b/.github/workflows/market-test_v2.yml @@ -0,0 +1,192 @@ +name: market api tests + +# Controls when the action will run. +on: + workflow_call: + + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + + market_test: + # The type of runner that the job will run on + runs-on: [self-hosted-ci,large] + 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: Clean Workspace + uses: AutoModality/action-clean@v1.1.0 + + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout master repo + uses: actions/checkout@master + with: + ref: ${{ github.head_ref }} #Checking out head commit + + - name: Checkout Market e2e tests + uses: actions/checkout@v3 + with: + repository: 'UniqueNetwork/market-e2e-tests' + ssh-key: ${{ secrets.GH_PAT }} + path: 'qa-tests' + ref: 'ci_test_v2' + + - name: Read .env file + uses: xom9ikk/dotenv@v1.0.2 + + - name: Copy qa-tests/.env.example to qa-tests/.env + working-directory: qa-tests + run: cp .env.docker .env + + - name: Generate ENV related extend file for docker-compose + uses: cuchi/jinja2-action@v1.2.0 + with: + template: qa-tests/.docker/docker-compose.tmp-market.j2 + output_file: qa-tests/.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 + working-directory: qa-tests + run: cat .docker/docker-compose.${{ matrix.network }}.yml + + - name: Start node-parachain + working-directory: qa-tests + run: docker-compose -f ".docker/docker-compose.market.yml" -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build --remove-orphans --force-recreate node-parachain + + - uses: actions/setup-node@v3 + with: + node-version: 16.17 + + - name: Setup TypeScript + working-directory: qa-tests + run: | + npm install -g ts-node + npm install + + - name: Copy qa-tests/.env.docker to qa-tests/.env + working-directory: qa-tests + run: | + rm -rf .env + cp .env.docker .env + + - name: Wait for chain up and running + working-directory: tests + run: | + yarn install + node scripts/readyness.js + echo "Ready to start tests" + + - name: Show content of .env file and Generate accounts + working-directory: qa-tests + run: | + cat .env + ts-node ./src/scripts/create-market-accounts.ts + + - name: Copy qa-tests/.env to qa-tests/.env.docker + working-directory: qa-tests + run: | + rm -rf .env.docker + cp .env .env.docker + + - name: Get chain logs + if: always() # run this step always + run: | + docker exec node-parachain cat /polkadot-launch/9944.log + docker exec node-parachain cat /polkadot-launch/9945.log + docker exec node-parachain cat /polkadot-launch/alice.log + docker exec node-parachain cat /polkadot-launch/eve.log + docker exec node-parachain cat /polkadot-launch/dave.log + docker exec node-parachain cat /polkadot-launch/charlie.log + + - name: Deploy contracts + run: | + cd qa-tests + ts-node ./src/scripts/deploy-contract.ts + + - name: Timeout for debug + if: failure() + run: sleep 300s + + - name: Import test data + working-directory: qa-tests + run: ts-node ./src/scripts/create-test-collections.ts + + - name: Show content of qa-test .env + working-directory: qa-tests + run: cat .env + + - name: Read qa -test .env file Before market start + uses: xom9ikk/dotenv@v1.0.2 + with: + path: qa-tests/ + + + - name: local-market:start + run: docker-compose -f "qa-tests/.docker/docker-compose.market.yml" -f "qa-tests/.docker/docker-compose.${{ matrix.network }}.yml" up -d --build + + - name: Wait for market readyness + working-directory: qa-tests + run: src/scripts/wait-market-ready.sh + shell: bash + + - name: Install dependecies + working-directory: qa-tests + run: | + npm ci + npm install -D @playwright/test + npx playwright install-deps + npx playwright install + + - name: Show content of qa-test .env + working-directory: qa-tests + run: cat .env + + - name: Test API interface + working-directory: qa-tests + run: | + npx playwright test --workers=8 --quiet .*.api.test.ts --reporter=github --config playwright.config.ts + + - name: Timeout for debug + if: failure() + run: sleep 300s + + - name: Stop running containers + if: always() # run this step always + run: docker-compose -f "qa-tests/.docker/docker-compose.market.yml" -f "qa-tests/.docker/docker-compose.${{ matrix.network }}.yml" down --volumes +# run: docker-compose -f "qa-tests/.docker/docker-compose.market.yml" -f "qa-tests/.docker/docker-compose.${{ matrix.network }}.yml" down + + - name: Remove builder cache + if: always() # run this step always + run: | + docker builder prune -f + docker system prune -f + + - name: Clean Workspace + if: always() + uses: AutoModality/action-clean@v1.1.0 + + + + --- /dev/null +++ b/.github/workflows/node-only-update_v2.yml @@ -0,0 +1,271 @@ +name: nodes-only update + +# Controls when the action will run. +on: + workflow_call: +#Define Workflow variables +env: + REPO_URL: ${{ github.server_url }}/${{ github.repository }} + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + + execution-marix: + + name: execution matrix + + runs-on: self-hosted-ci + outputs: + matrix: ${{ steps.create_matrix.outputs.matrix }} + + 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: Create Execution matrix + uses: fabiocaccamo/create-matrix-action@v2 + id: create_matrix + with: + matrix: | + network {opal}, runtime {opal}, features {opal-runtime}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}} + network {quartz}, runtime {quartz}, features {quartz-runtime}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}} + network {unique}, runtime {unique}, features {unique-runtime}, mainnet_branch {${{ env.UNIQUE_MAINNET_TAG }}} + + + + forkless-update-nodata: + needs: execution-marix + # The type of runner that the job will run on + runs-on: [self-hosted-ci,large] + + + + 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: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}} + + 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-node.j2 + output_file: .docker/docker-compose.node.${{ matrix.network }}.yml + variables: | + REPO_URL=${{ github.server_url }}/${{ github.repository }}.git + RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} + POLKADOT_BUILD_BRANCH=${{ env.POLKADOT_BUILD_BRANCH }} + POLKADOT_MAINNET_BRANCH=${{ env.POLKADOT_MAINNET_BRANCH }} + MAINNET_TAG=${{ matrix.mainnet_tag }} + MAINNET_BRANCH=${{ matrix.mainnet_branch }} + FEATURE=${{ matrix.features }} + RUNTIME=${{ matrix.runtime }} + BRANCH=${{ github.head_ref }} + + - name: Show build configuration + run: cat .docker/docker-compose.node.${{ matrix.network }}.yml + + - name: Generate launch-config-forkless-nodata.json + uses: cuchi/jinja2-action@v1.2.0 + with: + template: .docker/forkless-config/launch-config-forkless-nodata.j2 + output_file: .docker/launch-config-forkless-nodata.json + variables: | + FEATURE=${{ matrix.features }} + RUNTIME=${{ matrix.runtime }} + + - name: Show launch-config-forkless configuration + run: cat .docker/launch-config-forkless-nodata.json + + - uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Build the stack + run: docker-compose -f ".docker/docker-compose-forkless.yml" -f ".docker/docker-compose.node.${{ matrix.network }}.yml" up -d --build --remove-orphans --force-recreate --timeout 300 + + # 🚀 POLKADOT LAUNCH COMPLETE 🚀 + - name: Check if docker logs consist messages related to testing of Node Parachain Upgrade. + if: success() + run: | + counter=160 + function check_container_status { + docker inspect -f {{.State.Running}} node-parachain + } + function do_docker_logs { + docker logs --details node-parachain 2>&1 + } + function is_started { + if [ "$(check_container_status)" == "true" ]; then + echo "Container: node-parachain RUNNING"; + echo "Check Docker logs" + DOCKER_LOGS=$(do_docker_logs) + if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then + echo "🚀 POLKADOT LAUNCH COMPLETE 🚀" + return 0 + else + echo "Message not found in logs output, repeating..." + return 1 + fi + else + echo "Container node-parachain NOT RUNNING" + echo "Halting all future checks" + exit 1 + fi + echo "something goes wrong" + exit 1 + } + while ! is_started; do + echo "Waiting for special message in log files " + sleep 30s + counter=$(( $counter - 1 )) + echo "Counter: $counter" + if [ "$counter" -gt "0" ]; then + continue + else + break + fi + done + echo "Halting script" + exit 0 + shell: bash + + - name: Run tests before Node Parachain upgrade + working-directory: tests + run: | + yarn install + yarn add mochawesome + node scripts/readyness.js + echo "Ready to start tests" + yarn polkadot-types + NOW=$(date +%s) && yarn test --reporter mochawesome --reporter-options reportFilename=test-${NOW} + env: + RPC_URL: http://127.0.0.1:9933/ + + - name: Test Report Before Node upgrade + uses: phoenix-actions/test-reporting@v8 + id: test-report-before + if: success() || failure() # run this step even if previous step failed + with: + name: Tests before node upgrade ${{ 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: Send SIGUSR1 to polkadotlaunch process + if: success() || failure() + run: | + #Get PID of polkadot-launch + PID=$(docker exec node-parachain pidof 'polkadot-launch') + echo "Polkadot-launch PID: $PID" + #Send SIGUSR1 signal to $PID + docker exec node-parachain kill -SIGUSR1 ${PID} + + # 🌗 All parachain collators restarted with the new binaries. + - name: Check if docker logs consist messages related to testing of Node Parachain Upgrade. + if: success() + run: | + counter=160 + function check_container_status { + docker inspect -f {{.State.Running}} node-parachain + } + function do_docker_logs { + docker logs --details node-parachain 2>&1 + } + function is_started { + if [ "$(check_container_status)" == "true" ]; then + echo "Container: node-parachain RUNNING"; + echo "Check Docker logs" + DOCKER_LOGS=$(do_docker_logs) + if [[ ${DOCKER_LOGS} = *"All parachain collators restarted with the new binaries."* ]];then + echo "🌗 All parachain collators restarted with the new binaries." + return 0 + else + echo "Message not found in logs output, repeating..." + return 1 + fi + else + echo "Container node-parachain NOT RUNNING" + echo "Halting all future checks" + exit 1 + fi + echo "something goes wrong" + exit 1 + } + while ! is_started; do + echo "Waiting for special message in log files " + sleep 30s + counter=$(( $counter - 1 )) + echo "Counter: $counter" + if [ "$counter" -gt "0" ]; then + continue + else + break + fi + done + echo "Halting script" + exit 0 + shell: bash + + - name: Run tests after Node Parachain upgrade + working-directory: tests + run: | + yarn install + yarn add mochawesome + node scripts/readyness.js + echo "Ready to start tests" + yarn polkadot-types + NOW=$(date +%s) && yarn test --reporter mochawesome --reporter-options reportFilename=test-${NOW} + env: + RPC_URL: http://127.0.0.1:9933/ + + - name: Test Report After Node upgrade + uses: phoenix-actions/test-reporting@v8 + id: test-report-after + if: success() || failure() # run this step even if previous step failed + with: + name: Tests after node upgrade ${{ 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: Stop running containers + if: always() # run this step always + run: docker-compose -f ".docker/docker-compose-forkless.yml" -f ".docker/docker-compose.node.${{ matrix.network }}.yml" down --volumes + + - name: Remove builder cache + if: always() # run this step always + run: | + docker builder prune -f + docker system prune -f + + - name: Clean Workspace + if: always() + uses: AutoModality/action-clean@v1.1.0 --- a/.github/workflows/nodes-only-update.yml +++ /dev/null @@ -1,305 +0,0 @@ -name: nodes-only update - -# 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: - - master - 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: - - prepare-execution-marix: - - name: Prepare execution matrix - - runs-on: self-hosted-ci - outputs: - matrix: ${{ steps.create_matrix.outputs.matrix }} - - 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: Create Execution matrix - uses: fabiocaccamo/create-matrix-action@v2 - id: create_matrix - with: - matrix: | - network {opal}, runtime {opal}, features {opal-runtime}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}} - network {quartz}, runtime {quartz}, features {quartz-runtime}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}} - network {unique}, runtime {unique}, features {unique-runtime}, mainnet_branch {${{ env.UNIQUE_MAINNET_TAG }}} - - - - forkless-update-nodata: - needs: prepare-execution-marix - # The type of runner that the job will run on - runs-on: [self-hosted-ci,large] - - - - 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: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}} - - - 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-node.j2 - output_file: .docker/docker-compose.node.${{ matrix.network }}.yml - variables: | - REPO_URL=${{ github.server_url }}/${{ github.repository }}.git - RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} - POLKADOT_BUILD_BRANCH=${{ env.POLKADOT_BUILD_BRANCH }} - POLKADOT_MAINNET_BRANCH=${{ env.POLKADOT_MAINNET_BRANCH }} - MAINNET_TAG=${{ matrix.mainnet_tag }} - MAINNET_BRANCH=${{ matrix.mainnet_branch }} - FEATURE=${{ matrix.features }} - RUNTIME=${{ matrix.runtime }} - BRANCH=${{ github.head_ref }} - - - name: Show build configuration - run: cat .docker/docker-compose.node.${{ matrix.network }}.yml - - - name: Generate launch-config-forkless-nodata.json - uses: cuchi/jinja2-action@v1.2.0 - with: - template: .docker/forkless-config/launch-config-forkless-nodata.j2 - output_file: .docker/launch-config-forkless-nodata.json - variables: | - FEATURE=${{ matrix.features }} - RUNTIME=${{ matrix.runtime }} - - - name: Show launch-config-forkless configuration - run: cat .docker/launch-config-forkless-nodata.json - - - uses: actions/setup-node@v3 - with: - node-version: 16 - - - name: Build the stack - run: docker-compose -f ".docker/docker-compose-forkless.yml" -f ".docker/docker-compose.node.${{ matrix.network }}.yml" up -d --build --remove-orphans --force-recreate --timeout 300 - - # 🚀 POLKADOT LAUNCH COMPLETE 🚀 - - name: Check if docker logs consist messages related to testing of Node Parachain Upgrade. - if: success() - run: | - counter=160 - function check_container_status { - docker inspect -f {{.State.Running}} node-parachain - } - function do_docker_logs { - docker logs --details node-parachain 2>&1 - } - function is_started { - if [ "$(check_container_status)" == "true" ]; then - echo "Container: node-parachain RUNNING"; - echo "Check Docker logs" - DOCKER_LOGS=$(do_docker_logs) - if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then - echo "🚀 POLKADOT LAUNCH COMPLETE 🚀" - return 0 - else - echo "Message not found in logs output, repeating..." - return 1 - fi - else - echo "Container node-parachain NOT RUNNING" - echo "Halting all future checks" - exit 1 - fi - echo "something goes wrong" - exit 1 - } - while ! is_started; do - echo "Waiting for special message in log files " - sleep 30s - counter=$(( $counter - 1 )) - echo "Counter: $counter" - if [ "$counter" -gt "0" ]; then - continue - else - break - fi - done - echo "Halting script" - exit 0 - shell: bash - - - name: Run tests before Node Parachain upgrade - working-directory: tests - run: | - yarn install - yarn add mochawesome - node scripts/readyness.js - echo "Ready to start tests" - yarn polkadot-types - NOW=$(date +%s) && yarn test --reporter mochawesome --reporter-options reportFilename=test-${NOW} - env: - RPC_URL: http://127.0.0.1:9933/ - - - name: Test Report Before Node upgrade - uses: phoenix-actions/test-reporting@v8 - id: test-report-before - if: success() || failure() # run this step even if previous step failed - with: - name: Tests before node upgrade ${{ 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: Send SIGUSR1 to polkadotlaunch process - if: success() || failure() - run: | - #Get PID of polkadot-launch - PID=$(docker exec node-parachain pidof 'polkadot-launch') - echo "Polkadot-launch PID: $PID" - #Send SIGUSR1 signal to $PID - docker exec node-parachain kill -SIGUSR1 ${PID} - - # 🌗 All parachain collators restarted with the new binaries. - - name: Check if docker logs consist messages related to testing of Node Parachain Upgrade. - if: success() - run: | - counter=160 - function check_container_status { - docker inspect -f {{.State.Running}} node-parachain - } - function do_docker_logs { - docker logs --details node-parachain 2>&1 - } - function is_started { - if [ "$(check_container_status)" == "true" ]; then - echo "Container: node-parachain RUNNING"; - echo "Check Docker logs" - DOCKER_LOGS=$(do_docker_logs) - if [[ ${DOCKER_LOGS} = *"All parachain collators restarted with the new binaries."* ]];then - echo "🌗 All parachain collators restarted with the new binaries." - return 0 - else - echo "Message not found in logs output, repeating..." - return 1 - fi - else - echo "Container node-parachain NOT RUNNING" - echo "Halting all future checks" - exit 1 - fi - echo "something goes wrong" - exit 1 - } - while ! is_started; do - echo "Waiting for special message in log files " - sleep 30s - counter=$(( $counter - 1 )) - echo "Counter: $counter" - if [ "$counter" -gt "0" ]; then - continue - else - break - fi - done - echo "Halting script" - exit 0 - shell: bash - - - name: Run tests after Node Parachain upgrade - working-directory: tests - run: | - yarn install - yarn add mochawesome - node scripts/readyness.js - echo "Ready to start tests" - yarn polkadot-types - NOW=$(date +%s) && yarn test --reporter mochawesome --reporter-options reportFilename=test-${NOW} - env: - RPC_URL: http://127.0.0.1:9933/ - - - name: Test Report After Node upgrade - uses: phoenix-actions/test-reporting@v8 - id: test-report-after - if: success() || failure() # run this step even if previous step failed - with: - name: Tests after node upgrade ${{ 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: Stop running containers - if: always() # run this step always - run: docker-compose -f ".docker/docker-compose-forkless.yml" -f ".docker/docker-compose.node.${{ matrix.network }}.yml" down --volumes - - - name: Remove builder cache - if: always() # run this step always - run: | - docker builder prune -f - docker system prune -f - - - name: Clean Workspace - if: always() - uses: AutoModality/action-clean@v1.1.0 --- /dev/null +++ b/.github/workflows/test_codestyle_v2.yml @@ -0,0 +1,20 @@ +name: yarn eslint + +on: + workflow_call: + +jobs: + code_style: + runs-on: [ self-hosted-ci ] + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Install modules + run: cd tests && yarn + - name: Run ESLint + run: cd tests && yarn eslint --ext .ts,.js src/ --- a/.github/workflows/tests_codestyle.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: yarn eslint - -on: - pull_request: - branches: - - develop - types: - - opened - - reopened - - synchronize - - ready_for_review - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref }} - cancel-in-progress: true - -jobs: - code_style: - runs-on: self-hosted-ci - - 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 - - - uses: actions/checkout@v3 - - - uses: actions/setup-node@v3 - with: - node-version: 16 - - - name: Install modules - run: cd tests && yarn - - name: Run ESLint - run: cd tests && yarn eslint --ext .ts,.js src/ --- a/.github/workflows/try-runtime.yml +++ /dev/null @@ -1,108 +0,0 @@ -name: try-runtime - -# 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: - - master - 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: - try-runtime: - # The type of runner that the job will run on - runs-on: self-hosted-ci - - 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: try-runtime,opal-runtime - replica_from_address: wss://eu-ws-opal.unique.network:443 - - network: quartz - features: try-runtime,quartz-runtime - replica_from_address: wss://eu-ws-quartz.unique.network:443 - - network: unique - features: try-runtime,unique-runtime - replica_from_address: wss://eu-ws.unique.network:443 - - 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.try-runtime.j2 - output_file: .docker/docker-compose.try-runtime.${{ matrix.network }}.yml - variables: | - RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} - FEATURE=${{ matrix.features }} - REPLICA_FROM=${{ matrix.replica_from_address }} - - - name: Show build configuration - run: cat .docker/docker-compose.try-runtime.${{ matrix.network }}.yml - - - name: Build the stack - run: docker-compose -f ".docker/docker-compose-try-runtime.yml" -f ".docker/docker-compose.try-runtime.${{ matrix.network }}.yml" up --build --force-recreate --timeout 300 --remove-orphans --exit-code-from try-runtime - - - name: Collect Docker Logs - if: success() || failure() - uses: jwalton/gh-docker-logs@v2.2.0 - with: - dest: './try-runtime-logs.${{ matrix.network }}' - images: 'try-runtime' - - - name: Show docker logs - run: cat './try-runtime-logs.${{ matrix.network }}/try-runtime.log' - - - name: Stop running containers - if: always() # run this step always - run: docker-compose -f ".docker/docker-compose-try-runtime.yml" -f ".docker/docker-compose.try-runtime.${{ matrix.network }}.yml" down --- /dev/null +++ b/.github/workflows/try-runtime_v2.yml @@ -0,0 +1,69 @@ +on: + workflow_call: + + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + try-runtime: + # The type of runner that the job will run on + runs-on: self-hosted-ci + + 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 + replica_from_address: wss://eu-ws-opal.unique.network:443 + - network: quartz + features: quartz-runtime + replica_from_address: wss://eu-ws-quartz.unique.network:443 + - network: unique + features: unique-runtime + replica_from_address: wss://eu-ws.unique.network:443 + + 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.try-runtime.j2 + output_file: .docker/docker-compose.try-runtime.${{ matrix.network }}.yml + variables: | + RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} + FEATURE=${{ matrix.features }} + REPLICA_FROM=${{ matrix.replica_from_address }} + + - name: Show build configuration + run: cat .docker/docker-compose.try-runtime.${{ matrix.network }}.yml + + - name: Build the stack + run: docker-compose -f ".docker/docker-compose-try-runtime.yml" -f ".docker/docker-compose.try-runtime.${{ matrix.network }}.yml" up --build --force-recreate --timeout 300 --remove-orphans --exit-code-from try-runtime + + - name: Collect Docker Logs + if: success() || failure() + uses: jwalton/gh-docker-logs@v2.2.0 + with: + dest: './try-runtime-logs.${{ matrix.network }}' + images: 'try-runtime' + + - name: Show docker logs + run: cat './try-runtime-logs.${{ matrix.network }}/try-runtime.log' + + - name: Stop running containers + if: always() # run this step always + run: docker-compose -f ".docker/docker-compose-try-runtime.yml" -f ".docker/docker-compose.try-runtime.${{ matrix.network }}.yml" down --- a/.github/workflows/unit-test.yml +++ /dev/null @@ -1,84 +0,0 @@ -name: unit tests - -# 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 - - master - 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: - -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: - - unit_tests: - # The type of runner that the job will run on - runs-on: [self-hosted-ci,medium] - timeout-minutes: 1380 - - name: ${{ github.base_ref }} - - 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 --build --force-recreate --timeout 300 --remove-orphans --exit-code-from node-dev - - - 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 --- /dev/null +++ b/.github/workflows/unit-test_v2.yml @@ -0,0 +1,51 @@ +name: unit tests + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the master branch + workflow_call: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + + unit_tests: + # The type of runner that the job will run on + runs-on: [self-hosted-ci,medium] + timeout-minutes: 1380 + + name: ${{ github.base_ref }} + + 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: 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 }} + + + - 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 --build --force-recreate --timeout 300 --remove-orphans --exit-code-from node-dev + + - 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 --- /dev/null +++ b/.github/workflows/xcm-testnet-build.yml @@ -0,0 +1,151 @@ +name: xcm-testnet-build + +# Controls when the action will run. +on: + workflow_call: + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +#Define Workflow variables +env: + REPO_URL: ${{ github.server_url }}/${{ github.repository }} + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + + prepare-execution-marix: + + name: Prepare execution matrix + + runs-on: [XL] + outputs: + matrix: ${{ steps.create_matrix.outputs.matrix }} + + 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: Create Execution matrix + uses: fabiocaccamo/create-matrix-action@v2 + id: create_matrix + with: + matrix: | + network {opal}, runtime {opal}, features {opal-runtime}, acala_version {${{ env.ACALA_BUILD_BRANCH }}}, moonbeam_version {${{ env.MOONBEAM_BUILD_BRANCH }}}, cumulus_version {${{ env.WESTMINT_BUILD_BRANCH }}} + network {quartz}, runtime {quartz}, features {quartz-runtime}, acala_version {${{ env.KARURA_BUILD_BRANCH }}}, moonbeam_version {${{ env.MOONRIVER_BUILD_BRANCH }}}, cumulus_version {${{ env.STATEMINE_BUILD_BRANCH }}} + network {unique}, runtime {unique}, features {unique-runtime}, acala_version {${{ env.ACALA_BUILD_BRANCH }}}, moonbeam_version {${{ env.MOONBEAM_BUILD_BRANCH }}}, cumulus_version {${{ env.STATEMINT_BUILD_BRANCH }}} + + xcm-build: + + needs: prepare-execution-marix + # The type of runner that the job will run on + runs-on: [XL] + + timeout-minutes: 600 + + 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: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}} + + steps: + - name: Skip if pull request is in Draft + 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 Dockerfile file + uses: cuchi/jinja2-action@v1.2.0 + with: + template: .docker/Dockerfile-xcm.j2 + output_file: .docker/Dockerfile-xcm.${{ matrix.network }}.yml + variables: | + RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} + NETWORK=${{ matrix.network }} + POLKADOT_BUILD_BRANCH=${{ env.POLKADOT_BUILD_BRANCH }} + POLKADOT_LAUNCH_BRANCH=${{ env.POLKADOT_LAUNCH_BRANCH }} + FEATURE=${{ matrix.features }} + RUNTIME=${{ matrix.runtime }} + BRANCH=${{ github.head_ref }} + ACALA_BUILD_BRANCH=${{ matrix.acala_version }} + MOONBEAM_BUILD_BRANCH=${{ matrix.moonbeam_version }} + CUMULUS_BUILD_BRANCH=${{ matrix.cumulus_version }} + + - name: Show build Dockerfile + run: cat .docker/Dockerfile-xcm.${{ matrix.network }}.yml + + - name: Show launch-config-xcm-${{ matrix.network }} configuration + run: cat .docker/xcm-config/launch-config-xcm-${{ matrix.network }}.json + + - name: Run find-and-replace to remove slashes from branch name + uses: mad9000/actions-find-and-replace-string@2 + id: branchname + with: + source: ${{ github.head_ref }} + find: '/' + replace: '-' + + - name: Log in to Docker Hub + uses: docker/login-action@v2.0.0 + with: + username: ${{ secrets.CORE_DOCKERHUB_USERNAME }} + password: ${{ secrets.CORE_DOCKERHUB_TOKEN }} + + - name: Pull acala docker image + run: docker pull uniquenetwork/builder-acala:${{ matrix.acala_version }} + + - name: Pull moonbeam docker image + run: docker pull uniquenetwork/builder-moonbeam:${{ matrix.moonbeam_version }} + + - name: Pull cumulus docker image + run: docker pull uniquenetwork/builder-cumulus:${{ matrix.cumulus_version }} + + - name: Pull polkadot docker image + run: docker pull uniquenetwork/builder-polkadot:${{ env.POLKADOT_BUILD_BRANCH }} + + - name: Pull chainql docker image + run: docker pull uniquenetwork/builder-chainql:latest + + - name: Build the stack + run: cd .docker/ && docker build --no-cache --file ./Dockerfile-xcm.${{ matrix.network }}.yml --tag uniquenetwork/xcm-${{ matrix.network }}-testnet-local:nightly-${{ steps.branchname.outputs.value }}-${{ github.sha }} --tag uniquenetwork/xcm-${{ matrix.network }}-testnet-local:latest . + + - name: Push docker image version + run: docker push uniquenetwork/xcm-${{ matrix.network }}-testnet-local:nightly-${{ steps.branchname.outputs.value }}-${{ github.sha }} + + - name: Push docker image latest + run: docker push uniquenetwork/xcm-${{ matrix.network }}-testnet-local:latest + + - name: Clean Workspace + if: always() + uses: AutoModality/action-clean@v1.1.0 + + - name: Remove builder cache + if: always() # run this step always + run: | + docker builder prune -f + docker system prune -f + + + --- /dev/null +++ b/.github/workflows/xcm-tests_v2.yml @@ -0,0 +1,175 @@ +name: xcm-tests + +# Controls when the action will run. +on: + # Allows you to run this workflow manually from the Actions tab + workflow_call: + +#Define Workflow variables +env: + REPO_URL: ${{ github.server_url }}/${{ github.repository }} + + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + + prepare-execution-marix: + + name: Prepare execution matrix + +# needs: [xcm-testnet-build] + + runs-on: XL + outputs: + matrix: ${{ steps.create_matrix.outputs.matrix }} + + 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: Create Execution matrix + uses: fabiocaccamo/create-matrix-action@v2 + id: create_matrix + with: + matrix: | + network {opal}, runtime {opal}, features {opal-runtime}, runtest {testXcmOpal} + network {quartz}, runtime {quartz}, features {quartz-runtime}, runtest {testXcmQuartz} + network {unique}, runtime {unique}, features {unique-runtime}, runtest {testXcmUnique} + + xcm-tests: + needs: prepare-execution-marix + # The type of runner that the job will run on + runs-on: [XL] + + timeout-minutes: 600 + + 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: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}} + + + steps: + - name: Skip if pull request is in Draft + 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-xcm-tests.j2 + output_file: .docker/docker-compose.xcm-tests.${{ matrix.network }}.yml + variables: | + NETWORK=${{ matrix.network }} + + - name: Show build configuration + run: cat .docker/docker-compose.xcm-tests.${{ matrix.network }}.yml + + - uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: Build the stack + run: docker-compose -f ".docker/docker-compose.xcm-tests.${{ matrix.network }}.yml" up -d --remove-orphans --force-recreate --timeout 300 + + # 🚀 POLKADOT LAUNCH COMPLETE 🚀 + - name: Check if docker logs consist messages related to testing of xcm tests + if: success() + run: | + counter=160 + function check_container_status { + docker inspect -f {{.State.Running}} xcm-${{ matrix.network }}-testnet-local + } + function do_docker_logs { + docker logs --details xcm-${{ matrix.network }}-testnet-local 2>&1 + } + function is_started { + if [ "$(check_container_status)" == "true" ]; then + echo "Container: xcm-${{ matrix.network }}-testnet-local RUNNING"; + echo "Check Docker logs" + DOCKER_LOGS=$(do_docker_logs) + if [[ ${DOCKER_LOGS} = *"POLKADOT LAUNCH COMPLETE"* ]];then + echo "🚀 POLKADOT LAUNCH COMPLETE 🚀" + return 0 + else + echo "Message not found in logs output, repeating..." + return 1 + fi + else + echo "Container xcm-${{ matrix.network }}-testnet-local NOT RUNNING" + echo "Halting all future checks" + exit 1 + fi + echo "something goes wrong" + exit 1 + } + while ! is_started; do + echo "Waiting for special message in log files " + sleep 30s + counter=$(( $counter - 1 )) + echo "Counter: $counter" + if [ "$counter" -gt "0" ]; then + continue + else + break + fi + done + echo "Halting script" + exit 0 + shell: bash + + - name: Run XCM tests + working-directory: tests + run: | + yarn install + yarn add mochawesome + node scripts/readyness.js + echo "Ready to start tests" + NOW=$(date +%s) && yarn ${{ matrix.runtest }} --reporter mochawesome --reporter-options reportFilename=test-${NOW} + + - name: XCM Test Report + uses: phoenix-actions/test-reporting@v8 + id: test-report + if: success() || failure() # run this step even if previous step failed + with: + name: XCM 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: Stop running containers + if: always() # run this step always + run: docker-compose -f ".docker/docker-compose.xcm-tests.${{ matrix.network }}.yml" down + + - name: Clean Workspace + if: always() + uses: AutoModality/action-clean@v1.1.0 + + - name: Remove builder cache + if: always() # run this step always + run: | + docker system prune -a -f + --- /dev/null +++ b/.github/workflows/xcm.yml @@ -0,0 +1,19 @@ +name: Nesting XCM + +on: + workflow_call: + + +jobs: + + xcm-testnet-build: + name: testnet build + uses: ./.github/workflows/xcm-testnet-build.yml + secrets: inherit + + xcm-tests: + name: tests + needs: [ xcm-testnet-build ] + uses: ./.github/workflows/xcm-tests_v2.yml + + -- gitstuff