From 98753eca331bc14a8ca641aca9cb6c7ebdc7e931 Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Tue, 05 Sep 2023 15:41:21 +0000 Subject: [PATCH] Merge pull request #981 from UniqueNetwork/ci/governance-workflow enable governance workflow for develop and master branch --- --- a/.github/workflows/ci-develop.yml +++ b/.github/workflows/ci-develop.yml @@ -5,7 +5,7 @@ # Triger: PR at 'develop' branch with following types of events. on: pull_request: - branches: [ 'develop', 'ci/baedeker' ] + branches: [ 'develop' ] types: [ opened, reopened, synchronize, ready_for_review, converted_to_draft ] #Concurency group for control execution queue over github runners. @@ -61,9 +61,9 @@ uses: ./.github/workflows/node-only-update.yml secrets: inherit - gov: + governance: if: ${{ (github.event.pull_request.draft == false && contains( github.event.pull_request.labels.*.name, 'CI-gov')) }} # Conditional check for draft & labels per job. - uses: ./.github/workflows/gov.yml + uses: ./.github/workflows/governance.yml secrets: inherit # pass all secrets from initial workflow to nested codestyle: --- a/.github/workflows/ci-master.yml +++ b/.github/workflows/ci-master.yml @@ -52,6 +52,10 @@ uses: ./.github/workflows/node-only-update.yml secrets: inherit + governance: + uses: ./.github/workflows/governance.yml + secrets: inherit + codestyle: uses: ./.github/workflows/codestyle.yml secrets: inherit --- a/.github/workflows/gov.yml +++ /dev/null @@ -1,117 +0,0 @@ -# Governance tests in --dev mode with gov-test-timings feature enabled to reduce gov timings -name: governance tests - -# Triger: only call from main workflow(re-usable workflows) -on: - workflow_call: - -# 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.1.0 - with: - ref: ${{ github.head_ref }} #Checking out head commit - - - name: Read .env file - uses: xom9ikk/dotenv@v2 - - - name: Create Execution matrix - uses: CertainLach/create-matrix-action@v4 - id: create_matrix - with: - matrix: | - network {quartz}, wasm_name {quartz} - network {opal}, wasm_name {opal} - network {sapphire}, wasm_name {quartz} - - dev_build_int_tests: - needs: prepare-execution-marix - # The type of runner that the job will run on - runs-on: [self-hosted-ci, medium] - timeout-minutes: 1380 - - name: ${{ matrix.network }} - strategy: - matrix: - include: ${{fromJson(needs.prepare-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.1.0 - with: - ref: ${{ github.head_ref }} #Checking out head commit - - - name: Read .env file - uses: xom9ikk/dotenv@v2 - - - name: Generate ENV related extend file for docker-compose - uses: cuchi/jinja2-action@v1.2.0 - with: - template: .docker/docker-compose.gov.j2 - output_file: .docker/docker-compose.${{ matrix.network }}.yml - variables: | - RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} - NETWORK=${{ matrix.network }} - WASM_NAME=${{ matrix.wasm_name }} - - - name: Show build configuration - run: cat .docker/docker-compose.${{ matrix.network }}.yml - - - name: Build the stack - run: docker-compose -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build --remove-orphans - - - uses: actions/setup-node@v3.5.1 - with: - node-version: 16 - - - name: Run tests - working-directory: tests - run: | - yarn install - yarn add mochawesome - ./scripts/wait_for_first_block.sh - echo "Ready to start tests" - NOW=$(date +%s) && yarn testGovernance --reporter mochawesome --reporter-options reportFilename=test-${NOW} - env: - RPC_URL: http://127.0.0.1:9944/ - - - name: Test Report - uses: phoenix-actions/test-reporting@v10 - 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.${{ matrix.network }}.yml" down - - - name: Remove builder cache - if: always() # run this step always - run: | - docker builder prune -f -a - docker system prune -f - docker image prune -f -a --- /dev/null +++ b/.github/workflows/governance.yml @@ -0,0 +1,117 @@ +# Governance tests in --dev mode with gov-test-timings feature enabled to reduce gov timings +name: governance tests + +# Triger: only call from main workflow(re-usable workflows) +on: + workflow_call: + +# 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.1.0 + with: + ref: ${{ github.head_ref }} #Checking out head commit + + - name: Read .env file + uses: xom9ikk/dotenv@v2 + + - name: Create Execution matrix + uses: CertainLach/create-matrix-action@v4 + id: create_matrix + with: + matrix: | + network {quartz}, wasm_name {quartz} + network {opal}, wasm_name {opal} + network {sapphire}, wasm_name {quartz} + + dev_build_int_tests: + needs: prepare-execution-marix + # The type of runner that the job will run on + runs-on: [self-hosted-ci, medium] + timeout-minutes: 1380 + + name: ${{ matrix.network }} + strategy: + matrix: + include: ${{fromJson(needs.prepare-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.1.0 + with: + ref: ${{ github.head_ref }} #Checking out head commit + + - name: Read .env file + uses: xom9ikk/dotenv@v2 + + - name: Generate ENV related extend file for docker-compose + uses: cuchi/jinja2-action@v1.2.0 + with: + template: .docker/docker-compose.gov.j2 + output_file: .docker/docker-compose.${{ matrix.network }}.yml + variables: | + RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} + NETWORK=${{ matrix.network }} + WASM_NAME=${{ matrix.wasm_name }} + + - name: Show build configuration + run: cat .docker/docker-compose.${{ matrix.network }}.yml + + - name: Build the stack + run: docker-compose -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build --remove-orphans + + - uses: actions/setup-node@v3.5.1 + with: + node-version: 16 + + - name: Run tests + working-directory: tests + run: | + yarn install + yarn add mochawesome + ./scripts/wait_for_first_block.sh + echo "Ready to start tests" + NOW=$(date +%s) && yarn testGovernance --reporter mochawesome --reporter-options reportFilename=test-${NOW} + env: + RPC_URL: http://127.0.0.1:9944/ + + - name: Test Report + uses: phoenix-actions/test-reporting@v10 + 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.${{ matrix.network }}.yml" down + + - name: Remove builder cache + if: always() # run this step always + run: | + docker builder prune -f -a + docker system prune -f + docker image prune -f -a -- gitstuff