git.delta.rocks / unique-network / refs/commits / a73c3160b586

difftreelog

source

.github/workflows/collator-selection.yml5.9 KiBsourcehistory
1name: collator-selection23# Controls when the action will run.4on:5  workflow_call:67  # Allows you to run this workflow manually from the Actions tab8  workflow_dispatch:910#Define Workflow variables11env:12  REPO_URL: ${{ github.server_url }}/${{ github.repository }}1314# A workflow run is made up of one or more jobs that can run sequentially or in parallel15jobs:1617  prepare-execution-marix:18    name: Prepare execution matrix19    runs-on: [ self-hosted-ci ]20    outputs:21      matrix: ${{ steps.create_matrix.outputs.matrix }}2223    steps:24      - name: Clean Workspace25        uses: AutoModality/action-clean@v1.1.02627      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it28      - uses: actions/checkout@v4.1.729        with:30          ref: ${{ github.head_ref }}  #Checking out head commit3132      - name: Read .env file33        uses: xom9ikk/dotenv@v2.3.03435      - name: Create Execution matrix36        uses: CertainLach/create-matrix-action@v437        id: create_matrix38        with:39          matrix: |40            network {opal}, relay_branch {${{ env.UNIQUEWEST_MAINNET_BRANCH }}}41            network {quartz}, relay_branch {${{ env.KUSAMA_MAINNET_BRANCH }}}4243  collator-selection:44    needs: prepare-execution-marix45    # The type of runner that the job will run on46    runs-on: [ self-hosted-ci ]4748    timeout-minutes: 13804950    name: ${{ matrix.network }}5152    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.5354    strategy:55      matrix:56        include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}5758    steps:59      - name: Skip if pull request is in Draft60        if: github.event.pull_request.draft == true61        run: exit 16263      - name: Clean Workspace64        uses: AutoModality/action-clean@v1.1.06566      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it67      - uses: actions/checkout@v4.1.768        with:69          ref: ${{ github.head_ref }}  #Checking out head commit7071      # Prepare SHA72      - name: Prepare SHA73        uses: ./.github/actions/prepare7475      - name: Read .env file76        uses: xom9ikk/dotenv@v2.3.07778      - name: Log in to Docker Hub79        uses: docker/login-action@v3.2.080        with:81          username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}82          password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}8384      - name: Check and pull polkadot image85        id: polkadot86        uses: cloudposse/github-action-docker-image-exists@main87        with:88          registry: registry.hub.docker.com89          organization: parity90          repository: polkadot91          login: ${{ secrets.CORE_DOCKERHUB_USERNAME }}92          password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}93          tag: ${{ matrix.relay_branch }}9495      - name: Prepare latest96        uses: ./.github/actions/buildContainer97        id: latest98        with:99          container: uniquenetwork/ci-collator-selection-local100          tag: ${{ matrix.network }}-${{ env.REF_SLUG }}-${{ env.BUILD_SHA }}101          context: .102          dockerfile: .docker/Dockerfile-unique103          args: |104            --build-arg FEATURES=${{ matrix.network }}-runtime,session-test-timings105          dockerhub_username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}106          dockerhub_token: ${{ secrets.CORE_DOCKERHUB_TOKEN }}107108      - uses: actions/setup-node@v4.0.2109        with:110          node-version: 20111112      - name: Install baedeker113        uses: UniqueNetwork/baedeker-action/setup@v1-no-debug-output114        with:115          useCache: false        116117      - name: Setup library118        run: mkdir -p .baedeker/vendor/ && git clone https://github.com/UniqueNetwork/baedeker-library .baedeker/vendor/baedeker-library119120      - name: Start network121        uses: UniqueNetwork/baedeker-action@v1-no-debug-output122        if: success()123        id: bdk124        with:125          jpath: |126            .baedeker/vendor127          tla-str: |128            relay_spec=${{ env.RELAY_CHAIN_TYPE }}-local129          inputs: |130            .baedeker/collator-selection.jsonnet131            snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/polkadot':{dockerImage:'${{ steps.polkadot.outputs.image }}:${{ steps.polkadot.outputs.tag }}'}})132            snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/unique':{dockerImage:'${{ steps.latest.outputs.name }}'}})133134      - name: Upload network config135        uses: actions/upload-artifact@v3136        with:137          name: ${{ matrix.network }}-network-config138          path: ${{ steps.bdk.outputs.composeProject }}139          retention-days: 2140141      - name: Ensure network is alive142        working-directory: js-packages/tests143        id: alive1144        if: ${{ !cancelled() && steps.bdk.outcome == 'success' }}145        run: |146          yarn147          yarn add mochawesome148          ../scripts/wait_for_first_block.sh149        env:150          RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}151152      - name: Run tests153        working-directory: js-packages/tests154        if: ${{ !cancelled() && steps.alive1.outcome == 'success' }}      155        run: |156          echo "Ready to start tests"157          NOW=$(date +%s) && yarn testCollators --reporter mochawesome --reporter-options reportFilename=test-collators-${NOW}158        env:159          RPC_URL: ${{ env.RELAY_UNIQUE_HTTP_URL }}          160161      - name: Test Report162        uses: phoenix-actions/test-reporting@v15163        id: test-report164        if: success() || failure()165        with:166          name: Collator Selection Tests ${{ matrix.network }}167          path: js-packages/tests/mochawesome-report/test-collators-*.json168          reporter: mochawesome-json169          fail-on-error: 'false'170171      - name: Clean Workspace172        if: always()173        uses: AutoModality/action-clean@v1.1.0174175      - name: Remove builder cache176        if: always()177        run: |178          docker system prune -a -f