git.delta.rocks / unique-network / refs/commits / 9f61f19a60cd

difftreelog

source

.github/workflows/xnft.yml8.9 KiBsourcehistory
1name: xnft-testnet23# 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:16  prepare-execution-marix:17    name: Prepare execution matrix1819    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@v3.1.029        with:30          ref: ${{ github.head_ref }} #Checking out head commit3132      - name: Read .env file33        uses: xom9ikk/dotenv@v23435      - name: Create Execution matrix36        uses: CertainLach/create-matrix-action@v437        id: create_matrix38        with:39          matrix: |40            network {quartz}, relay_branch {${{ env.KUSAMA_MAINNET_BRANCH }}}, acala_version {${{ env.KARURA_BUILD_BRANCH }}}, runtest {all-quartz}, runtime_features {quartz-runtime}4142  xnft:43    needs: prepare-execution-marix44    # The type of runner that the job will run on45    runs-on: [XL]4647    timeout-minutes: 6004849    name: ${{ matrix.network }}5051    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.5253    strategy:54      matrix:55        include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}5657    steps:58      - name: Skip if pull request is in Draft59        if: github.event.pull_request.draft == true60        run: exit 16162      - name: Clean Workspace63        uses: AutoModality/action-clean@v1.1.06465      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it66      - uses: actions/checkout@v3.1.067        with:68          ref: ${{ github.head_ref }} #Checking out head commit6970      # Prepare SHA71      - name: Prepare SHA72        uses: ./.github/actions/prepare7374      - name: Read .env file75        uses: xom9ikk/dotenv@v27677      - name: Log in to Docker Hub78        uses: docker/login-action@v2.1.079        with:80          username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}81          password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}8283      # Check POLKADOT version and build it if it doesn't exist in repository84      - name: Generate ENV related extend Dockerfile file for POLKADOT85        uses: cuchi/jinja2-action@v1.2.086        with:87          template: .docker/Dockerfile-polkadot.j288          output_file: .docker/Dockerfile-polkadot.${{ matrix.relay_branch }}.yml89          variables: |90            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}91            POLKADOT_BUILD_BRANCH=${{ matrix.relay_branch }}9293      - name: Check if the dockerhub repository contains the needed version POLKADOT94        run: |95          # aquire token96            TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)97            export TOKEN=$TOKEN9899          # Get TAGS from DOCKERHUB POLKADOT repository100            POLKADOT_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-polkadot/tags/?page_size=100 | jq -r '."results"[]["name"]')101          # Show TAGS102            echo "POLKADOT TAGS:"103            echo $POLKADOT_TAGS104          # Check correct version POLKADOT and build it if it doesn't exist in POLKADOT TAGS105            if [[ ${POLKADOT_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.relay_branch }}"($|[[:space:]]) ]]; then106                echo "Repository has needed POLKADOT version";107                docker pull uniquenetwork/builder-polkadot:${{ matrix.relay_branch }}108            else109                echo "Repository has not needed POLKADOT version, so build it";110                cd .docker/ && docker build --file ./Dockerfile-polkadot.${{ matrix.relay_branch }}.yml --tag uniquenetwork/builder-polkadot:${{ matrix.relay_branch }} .111                echo "Push needed POLKADOT version to the repository";112                docker push uniquenetwork/builder-polkadot:${{ matrix.relay_branch }}113            fi114        shell: bash115116      # Check ACALA version and build it if it doesn't exist in repository117      - name: Generate ENV related extend Dockerfile file for ACALA118        uses: cuchi/jinja2-action@v1.2.0119        with:120          template: .docker/Dockerfile-acala.j2121          output_file: .docker/Dockerfile-acala.${{ matrix.acala_version }}.yml122          variables: |123            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}124            ACALA_BUILD_BRANCH=${{ matrix.acala_version }}125126      - name: Check if the dockerhub repository contains the needed ACALA version127        run: |128          # aquire token129            TOKEN=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'${{ secrets.CORE_DOCKERHUB_USERNAME }}'", "password": "'${{ secrets.CORE_DOCKERHUB_TOKEN }}'"}' https://hub.docker.com/v2/users/login/ | jq -r .token)130            export TOKEN=$TOKEN131132          # Get TAGS from DOCKERHUB repository133            ACALA_TAGS=$(curl -s -H "Authorization: JWT ${TOKEN}" https://hub.docker.com/v2/repositories/uniquenetwork/builder-acala/tags/?page_size=100 | jq -r '."results"[]["name"]')134          # Show TAGS135            echo "ACALA TAGS:"136            echo $ACALA_TAGS137          # Check correct version ACALA and build it if it doesn't exist in ACALA TAGS138            if [[ ${ACALA_TAGS[*]} =~ (^|[[:space:]])"${{ matrix.acala_version }}"($|[[:space:]]) ]]; then139                echo "Repository has needed ACALA version";140                docker pull uniquenetwork/builder-acala:${{ matrix.acala_version }}141            else142                echo "Repository has not needed ACALA version, so build it";143                cd .docker/ && docker build --file ./Dockerfile-acala.${{ matrix.acala_version }}.yml --tag uniquenetwork/builder-acala:${{ matrix.acala_version }} .144                echo "Push needed ACALA version to the repository";145                docker push uniquenetwork/builder-acala:${{ matrix.acala_version }}146            fi147        shell: bash148149      - name: Build unique-chain150        run: |151          docker build --file .docker/Dockerfile-unique \152            --build-arg RUNTIME_FEATURES=${{ matrix.runtime_features }} \153            --build-arg RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} \154            --tag uniquenetwork/ci-xnft-local:${{ matrix.network }}-${{ env.REF_SLUG }}-${{ env.BUILD_SHA }} \155            .156157      - name: Push docker image version158        run: docker push uniquenetwork/ci-xnft-local:${{ matrix.network }}-${{ env.REF_SLUG }}-${{ env.BUILD_SHA }}159160      - uses: actions/setup-node@v3.5.1161        with:162          node-version: 20163164      - name: Clone xnft-tests165        run: git clone https://github.com/UniqueNetwork/xnft-tests.git166167      - name: Install baedeker168        uses: UniqueNetwork/baedeker-action/setup@built169170      - name: Setup library171        run: mkdir -p .baedeker/vendor/ && git clone https://github.com/UniqueNetwork/baedeker-library .baedeker/vendor/baedeker-library172173      - name: Start network174        uses: UniqueNetwork/baedeker-action@built175        id: bdk176        with:177          jpath: |178            .baedeker/vendor179          tla-str: |180            relay_spec=rococo-local181          inputs: |182            xnft-tests/.baedeker/testnets.jsonnet183            snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/polkadot':{dockerImage:'uniquenetwork/builder-polkadot:${{ matrix.relay_branch }}'}})184            snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/quartz':{dockerImage:'uniquenetwork/ci-xnft-local:${{ matrix.network }}-${{ env.REF_SLUG }}-${{ env.BUILD_SHA }}'}})185            snippet:(import 'baedeker-library/ops/rewrites.libsonnet').rewriteNodePaths({'bin/karura':{dockerImage:'uniquenetwork/builder-acala:${{ matrix.acala_version }}'}})186187      - name: Yarn install188        working-directory: xnft-tests189        run: |190          yarn install191          yarn add mochawesome192193      - name: Run XNFT Tests194        working-directory: xnft-tests195        run: |196          NOW=$(date +%s) && yarn ${{ matrix.runtest }} --reporter mochawesome --reporter-options reportFilename=test-${NOW}197198      - name: XNFT Tests Report199        uses: phoenix-actions/test-reporting@v10200        id: test-report201        if: success() || failure()202        with:203          name: XNFT Tests ${{ matrix.network }}204          path: xnft-tests/mochawesome-report/test-*.json205          reporter: mochawesome-json206          fail-on-error: 'false'207208      - name: Clean Workspace209        if: always()210        uses: AutoModality/action-clean@v1.1.0211212      - name: Remove builder cache213        if: always()214        run: |215          docker system prune -a -f