--- /dev/null +++ b/.github/workflows/polkadot-types.yml @@ -0,0 +1,88 @@ +# Integration test in --dev mode +# https://cryptousetech.atlassian.net/wiki/spaces/CI/pages/2586411104/Integration+tests +name: Polkadot types + +# Triger: only call from main workflow(re-usable workflows) +on: + workflow_call: + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + + polkadot_generate_types: + # 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: sapphire + usage: "--sapphire" + - network: "opal" + usage: "" + - network: "quartz" + usage: "" + - network: "unique" + usage: "" + + 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@v2 + + - 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 }} + 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/setup-node@v3 + with: + node-version: 16 + + - name: Install jq + run: sudo apt install jq -y + + - name: Run generate_types_package script + working-directory: tests + run: | + yarn install + /bin/bash ./scripts/generate_types_package.sh --release ${{ matrix.usage }} + env: + RPC_URL: http://127.0.0.1:9933/ + + - 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