governance #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Governance tests in --dev mode with gov-test-timings feature enabled to reduce gov timings | |
name: governance | |
# Triger: only call from main workflow(re-usable workflows) | |
on: | |
workflow_call: | |
workflow_dispatch: | |
# 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: [ ci ] | |
outputs: | |
matrix: ${{ steps.create_matrix.outputs.matrix }} | |
steps: | |
- name: Clean Workspace | |
uses: AutoModality/[email protected] | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/[email protected] | |
with: | |
ref: ${{ github.head_ref }} #Checking out head commit | |
- name: Read .env file | |
uses: xom9ikk/[email protected] | |
- name: Create Execution matrix | |
uses: CertainLach/create-matrix-action@v4 | |
id: create_matrix | |
with: | |
matrix: | | |
network {unique} | |
network {quartz} | |
network {opal} | |
dev_build_int_tests: | |
needs: prepare-execution-marix | |
# The type of runner that the job will run on | |
runs-on: [ ci ] | |
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/[email protected] | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/[email protected] | |
with: | |
ref: ${{ github.head_ref }} #Checking out head commit | |
- name: Read .env file | |
uses: xom9ikk/[email protected] | |
- name: Generate ENV related extend file for docker-compose | |
uses: cuchi/[email protected] | |
with: | |
template: .docker/docker-compose.gov.j2 | |
output_file: .docker/docker-compose.${{ matrix.network }}.yml | |
variables: | | |
NETWORK=${{ matrix.network }} | |
- 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/[email protected] | |
with: | |
node-version: 20 | |
- name: Run tests | |
working-directory: js-packages/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@v15 | |
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: js-packages/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 |