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

difftreelog

add job in workflow that build testnet-local

Konstantin Astakhov2022-08-29parent: #036aece.patch.diff
in: master

6 files changed

added.docker/Dockerfile-testnetdiffbeforeafterboth
--- /dev/null
+++ b/.docker/Dockerfile-testnet
@@ -0,0 +1,96 @@
+# ===== Rust builder =====
+FROM ubuntu:20.04 as rust-builder
+LABEL maintainer="Unique.Network"
+
+ARG RUST_TOOLCHAIN=
+
+ENV RUST_TOOLCHAIN $RUST_TOOLCHAIN
+ENV CARGO_HOME="/cargo-home"
+ENV PATH="/cargo-home/bin:$PATH"
+ENV TZ=UTC
+RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
+
+RUN apt-get update && \
+    apt-get install -y curl cmake pkg-config libssl-dev git clang llvm libudev-dev && \
+    apt-get clean && \
+    rm -r /var/lib/apt/lists/*
+
+RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none
+
+RUN rustup toolchain uninstall $(rustup toolchain list) && \
+    rustup toolchain install $RUST_TOOLCHAIN && \
+    rustup default $RUST_TOOLCHAIN && \
+    rustup target list --installed && \
+    rustup show
+RUN rustup target add wasm32-unknown-unknown --toolchain $RUST_TOOLCHAIN
+
+RUN mkdir /unique_parachain
+WORKDIR /unique_parachain
+
+
+# ===== BUILD ======
+FROM rust-builder as builder-unique
+
+ARG PROFILE=release
+ARG FEATURE=
+ARG BRANCH=
+
+
+WORKDIR /unique_parachain
+
+RUN git clone -b $BRANCH https://github.com/UniqueNetwork/unique-chain.git && \
+    cd unique-chain && \
+    cargo build --features=$FEATURE --$PROFILE
+
+# ===== BUILD POLKADOT =====
+FROM rust-builder as builder-polkadot
+
+ARG POLKADOT_BUILD_BRANCH=
+ENV POLKADOT_BUILD_BRANCH $POLKADOT_BUILD_BRANCH
+
+
+WORKDIR /unique_parachain
+
+RUN git clone -b $POLKADOT_BUILD_BRANCH --depth 1 https://github.com/paritytech/polkadot.git && \
+    cd polkadot && \
+    cargo build --release
+
+# ===== RUN ======
+
+FROM ubuntu:20.04
+
+ARG POLKADOT_LAUNCH_BRANCH=
+ENV POLKADOT_LAUNCH_BRANCH $POLKADOT_LAUNCH_BRANCH
+
+RUN apt-get -y update && \
+      apt-get -y install curl git && \
+      curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash && \
+      export NVM_DIR="$HOME/.nvm" && \
+      [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
+      nvm install v16.16.0 && \
+      nvm use v16.16.0
+
+RUN git clone https://github.com/uniquenetwork/polkadot-launch -b $POLKADOT_LAUNCH_BRANCH
+
+RUN export NVM_DIR="$HOME/.nvm" && \
+    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
+    cd /polkadot-launch && \
+    npm install --global yarn && \
+    yarn install
+
+COPY --from=builder-unique /unique_parachain/unique-chain/target/release/unique-collator /unique-chain/target/release/
+COPY --from=builder-polkadot /unique_parachain/polkadot/target/release/polkadot /polkadot/target/release/
+
+EXPOSE 9844
+EXPOSE 9944
+EXPOSE 9933
+EXPOSE 9833
+EXPOSE 40333
+EXPOSE 30333
+
+CMD export NVM_DIR="$HOME/.nvm" && \
+    [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
+    cd /polkadot-launch && \
+    yarn start launch-config.json
+
+
added.docker/docker-compose-testnet.ymldiffbeforeafterboth
--- /dev/null
+++ b/.docker/docker-compose-testnet.yml
@@ -0,0 +1,17 @@
+version: "3.5"
+
+services:
+  xcm_nodes:
+    build:
+      context: ../
+      dockerfile: .docker/Dockerfile-testnet
+    expose:
+      - 9844
+      - 9944
+    ports:
+      - 127.0.0.1:9844:9844
+      - 127.0.0.1:9944:9944
+    logging:
+      options:
+        max-size: "1m"
+        max-file: "3"
added.docker/docker-compose.tmp-testnet.j2diffbeforeafterboth
--- /dev/null
+++ b/.docker/docker-compose.tmp-testnet.j2
@@ -0,0 +1,18 @@
+version: "3.5"
+
+services:
+  xcm_nodes:
+    build:
+      args:
+        - "RUST_TOOLCHAIN={{ RUST_TOOLCHAIN }}"
+        - "BRANCH={{ BRANCH }}"
+        - "FEATURE={{ FEATURE }}"
+        - "POLKADOT_BUILD_BRANCH={{ POLKADOT_BUILD_BRANCH }}"
+        - "POLKADOT_LAUNCH_BRANCH={{ POLKADOT_LAUNCH_BRANCH }}"
+    image: testnet_node_{{ NETWORK }}
+    container_name: testnet_node_{{ NETWORK }}
+    volumes:
+       - type: bind
+         source: ./testnet-config/launch-config-testnet.json
+         target: /polkadot-launch/launch-config.json
+         read_only: true          
added.docker/testnet-config/launch-config-testnet.jsondiffbeforeafterboth
--- /dev/null
+++ b/.docker/testnet-config/launch-config-testnet.json
@@ -0,0 +1,121 @@
+{
+    "relaychain": {
+        "bin": "../polkadot/target/release/polkadot",
+        "chain": "rococo-local",
+        "nodes": [
+            {
+                "name": "alice",
+                "wsPort": 9844,
+                "rpcPort": 9843,
+                "port": 30444,
+                "flags": [
+                    "-lparachain::candidate_validation=debug",
+                    "-lxcm=trace",
+                    "--rpc-cors=all",
+                    "--unsafe-rpc-external",
+                    "--unsafe-ws-external"
+                ]
+            },
+            {
+                "name": "bob",
+                "wsPort": 9855,
+                "rpcPort": 9854,
+                "port": 30555,
+                "flags": [
+                    "-lparachain::candidate_validation=debug",
+                    "-lxcm=trace",
+                    "--rpc-cors=all",
+                    "--unsafe-rpc-external",
+                    "--unsafe-ws-external"
+                ]
+            },
+            {
+                "name": "charlie",
+                "wsPort": 9866,
+                "rpcPort": 9865,
+                "port": 30666,
+                "flags": [
+                    "-lparachain::candidate_validation=debug",
+                    "-lxcm=trace",
+                    "--rpc-cors=all",
+                    "--unsafe-rpc-external",
+                    "--unsafe-ws-external"
+                ]
+            },
+            {
+                "name": "dave",
+                "wsPort": 9877,
+                "rpcPort": 9876,
+                "port": 30777,
+                "flags": [
+                    "-lparachain::candidate_validation=debug",
+                    "-lxcm=trace",
+                    "--rpc-cors=all",
+                    "--unsafe-rpc-external",
+                    "--unsafe-ws-external"
+                ]
+            },
+            {
+                "name": "eve",
+                "wsPort": 9888,
+                "rpcPort": 9887,
+                "port": 30888,
+                "flags": [
+                    "-lparachain::candidate_validation=debug",
+                    "-lxcm=trace",
+                    "--rpc-cors=all",
+                    "--unsafe-rpc-external",
+                    "--unsafe-ws-external"
+                ]
+            }
+        ],
+        "genesis": {
+            "runtime": {
+                "runtime_genesis_config": {
+                    "parachainsConfiguration": {
+                        "config": {
+                            "validation_upgrade_frequency": 1,
+                            "validation_upgrade_delay": 1
+                        }
+                    }
+                }
+            }
+        }
+    },
+    "parachains": [
+        {
+            "bin": "../unique-chain/target/release/unique-collator",
+            "id": "1000",
+            "balance": "1000000000000000000000000",
+            "nodes": [
+                {
+                    "port": 31200,
+                    "wsPort": 9944,
+                    "rpcPort": 9933,
+                    "name": "alice",
+                    "flags": [
+                        "--rpc-cors=all",
+                        "--unsafe-rpc-external",
+                        "--unsafe-ws-external",
+                        "-lxcm=trace"
+                    ]
+                },
+                {
+                    "port": 31201,
+                    "wsPort": 9945,
+                    "rpcPort": 9934,
+                    "name": "bob",
+                    "flags": [
+                        "--rpc-cors=all",
+                        "--unsafe-rpc-external",
+                        "--unsafe-ws-external",
+                        "-lxcm=trace"
+                    ]
+                }
+            ]
+        }
+    ],
+    "simpleParachains": [],
+    "hrmpChannels": [],
+    "finalization": false
+}
modified.envdiffbeforeafterboth
--- a/.env
+++ b/.env
@@ -10,3 +10,12 @@
 OPAL_REPLICA_FROM=wss://eu-ws-opal.unique.network:443
 QUARTZ_REPLICA_FROM=wss://eu-ws-quartz.unique.network:443
 UNIQUE_REPLICA_FROM=wss://eu-ws.unique.network:443
+
+
+POLKADOT_LAUNCH_BRANCH=feature/rewrite-chain-id-in-spec
+
+ACALA_BUILD_BRANCH=2.9.0
+MOONBEAM_BUILD_BRANCH=v0.25.0
+CUMULUS_BUILD_BRANCH=release-v0.9.230
+
+
added.github/workflows/xcm-testnet.ymldiffbeforeafterboth
after · .github/workflows/xcm-testnet.yml
1name: upgrade nodata23# Controls when the action will run.4on:5 # Triggers the workflow on push or pull request events but only for the master branch6  pull_request:7    branches:8      - master9    types:10      - opened11      - reopened12      - synchronize   #commit(s) pushed to the pull request13      - ready_for_review1415  # Allows you to run this workflow manually from the Actions tab16  workflow_dispatch:1718#Define Workflow variables19env:20  REPO_URL: ${{ github.server_url }}/${{ github.repository }}2122concurrency:23  group: ${{ github.workflow }}-${{ github.ref }}24  cancel-in-progress: true2526# A workflow run is made up of one or more jobs that can run sequentially or in parallel27jobs:2829  prepare-execution-marix:3031    name: Prepare execution matrix3233    runs-on: XL34    outputs:35      matrix: ${{ steps.create_matrix.outputs.matrix }}3637    steps:3839      - name: Clean Workspace40        uses: AutoModality/action-clean@v1.1.04142      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it43      - uses: actions/checkout@v344        with:45          ref: ${{ github.head_ref }}  #Checking out head commit4647      - name: Read .env file48        uses: xom9ikk/dotenv@v1.0.24950      - name: Create Execution matrix51        uses: fabiocaccamo/create-matrix-action@v252        id: create_matrix53        with:54          matrix: |55            network {opal}, runtime {opal}, features {opal-runtime}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}}56            network {quartz}, runtime {quartz}, features {quartz-runtime}, mainnet_branch {${{ env.QUARTZ_MAINNET_TAG }}}57            network {unique}, runtime {unique}, features {unique-runtime}, mainnet_branch {${{ env.UNIQUE_MAINNET_TAG }}}5859  xcm-build:60    needs: prepare-execution-marix61    # The type of runner that the job will run on62    runs-on: [XL]6364    timeout-minutes: 6006566    name: ${{ matrix.network }}6768    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.6970    strategy:71      matrix:72        include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}737475    steps:76      - name: Skip if pull request is in Draft77        # `if: github.event.pull_request.draft == true` should be kept here, at78        # the step level, rather than at the job level. The latter is not79        # recommended because when the PR is moved from "Draft" to "Ready to80        # review" the workflow will immediately be passing (since it was skipped),81        # even though it hasn't actually ran, since it takes a few seconds for82        # the workflow to start. This is also disclosed in:83        # https://github.community/t/dont-run-actions-on-draft-pull-requests/16817/1784        # That scenario would open an opportunity for the check to be bypassed:85        # 1. Get your PR approved86        # 2. Move it to Draft87        # 3. Push whatever commits you want88        # 4. Move it to "Ready for review"; now the workflow is passing (it was89        #    skipped) and "Check reviews" is also passing (it won't be updated90        #    until the workflow is finished)91        if: github.event.pull_request.draft == true92        run: exit 19394      - name: Clean Workspace95        uses: AutoModality/action-clean@v1.1.09697      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it98      - uses: actions/checkout@v399        with:100          ref: ${{ github.head_ref }}  #Checking out head commit101102      - name: Read .env file103        uses: xom9ikk/dotenv@v1.0.2104105      - name: Generate ENV related extend file for docker-compose106        uses: cuchi/jinja2-action@v1.2.0107        with:108          template: .docker/docker-compose.tmp-xcm.j2109          output_file: .docker/docker-compose-xcm.${{ matrix.network }}.yml110          variables: |111            REPO_URL=${{ github.server_url }}/${{ github.repository }}.git112            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}113            NETWORK=${{ matrix.network }}114            POLKADOT_BUILD_BRANCH=${{ env.POLKADOT_BUILD_BRANCH }}115            POLKADOT_LAUNCH_BRANCH=${{ env.POLKADOT_LAUNCH_BRANCH }}116            MAINNET_BRANCH=${{ matrix.mainnet_branch }}117            FEATURE=${{ matrix.features }}118            RUNTIME=${{ matrix.runtime }}119            BRANCH=${{ github.head_ref }}120            ACALA_BUILD_BRANCH=${{ env.ACALA_BUILD_BRANCH }}121            MOONBEAM_BUILD_BRANCH=${{ env.MOONBEAM_BUILD_BRANCH }}122            CUMULUS_BUILD_BRANCH=${{ env.CUMULUS_BUILD_BRANCH }}123124      - name: Show build configuration125        run: cat .docker/docker-compose-xcm.${{ matrix.network }}.yml126127      - name: Show launch-config-xcm-${{ matrix.network }} configuration128        run: cat .docker/xcm-config/launch-config-xcm-${{ matrix.network }}.json129130      - name: Build the stack131        run: docker-compose -f ".docker/docker-compose-xcm.yml" -f ".docker/docker-compose-xcm.${{ matrix.network }}.yml" up -d --build132133      - name: Collect Docker Logs134        if: success() || failure()135        uses: jwalton/gh-docker-logs@v2.2.0136        with:137          dest: './xcm-build-logs.${{ matrix.features }}'138          images: 'xcm-nodes-${{ matrix.network }}'139140      - name: Show docker logs141        if: success() || failure()142        run: cat './xcm-build-logs.${{ matrix.features }}/xcm-nodes-${{ matrix.network }}.log'143144      - name: Stop running containers145        if: always()                   # run this step always146        run: docker-compose -f ".docker/docker-compose-xcm.yml" -f ".docker/docker-compose-xcm.${{ matrix.network }}.yml" down147148      - name: Log in to Docker Hub149        uses: docker/login-action150        with:151          username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}152          password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}153154      - name: Tag docker image155        run: docker tag xcm_nodes_${{ matrix.network }} uniquenetwork/xcm-${{ matrix.network }}-testnet-local:nightly-${{ github.head_ref }}-${{ github.sha }}156157      - name: Push docker image158        run: docker push uniquenetwork/xcm-${{ matrix.network }}-testnet-local:nightly-${{ github.head_ref }}-${{ github.sha }}159160  testnet-build:161    needs: prepare-execution-marix162    # The type of runner that the job will run on163    runs-on: [XL]164165    timeout-minutes: 600166167    name: ${{ matrix.network }}168169    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.170171    strategy:172      matrix:173        include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}174175    steps:176      - name: Skip if pull request is in Draft177        # `if: github.event.pull_request.draft == true` should be kept here, at178        # the step level, rather than at the job level. The latter is not179        # recommended because when the PR is moved from "Draft" to "Ready to180        # review" the workflow will immediately be passing (since it was skipped),181        # even though it hasn't actually ran, since it takes a few seconds for182        # the workflow to start. This is also disclosed in:183        # https://github.community/t/dont-run-actions-on-draft-pull-requests/16817/17184        # That scenario would open an opportunity for the check to be bypassed:185        # 1. Get your PR approved186        # 2. Move it to Draft187        # 3. Push whatever commits you want188        # 4. Move it to "Ready for review"; now the workflow is passing (it was189        #    skipped) and "Check reviews" is also passing (it won't be updated190        #    until the workflow is finished)191        if: github.event.pull_request.draft == true192        run: exit 1193194      - name: Clean Workspace195        uses: AutoModality/action-clean@v1.1.0196197      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it198      - uses: actions/checkout@v3199        with:200          ref: ${{ github.head_ref }}  #Checking out head commit201202      - name: Read .env file203        uses: xom9ikk/dotenv@v1.0.2204205      - name: Generate ENV related extend file for docker-compose206        uses: cuchi/jinja2-action@v1.2.0207        with:208          template: .docker/docker-compose.tmp-testnet.j2209          output_file: .docker/docker-compose-testnet.${{ matrix.network }}.yml210          variables: |211            REPO_URL=${{ github.server_url }}/${{ github.repository }}.git212            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}213            NETWORK=${{ matrix.network }}214            POLKADOT_BUILD_BRANCH=${{ env.POLKADOT_BUILD_BRANCH }}215            POLKADOT_LAUNCH_BRANCH=${{ env.POLKADOT_LAUNCH_BRANCH }}216            MAINNET_BRANCH=${{ matrix.mainnet_branch }}217            FEATURE=${{ matrix.features }}218            RUNTIME=${{ matrix.runtime }}219            BRANCH=${{ github.head_ref }}220221      - name: Show build configuration222        run: cat .docker/docker-compose-testnet.${{ matrix.network }}.yml223224      - name: Build the stack225        run: docker-compose -f ".docker/docker-compose-testnet.yml" -f ".docker/docker-compose-testnet.${{ matrix.network }}.yml" up -d --build226227      - name: Collect Docker Logs228        if: success() || failure()229        uses: jwalton/gh-docker-logs@v2.2.0230        with:231          dest: './testnet-build-logs.${{ matrix.features }}'232          images: 'testnet_node_${{ matrix.network }}'233234      - name: Show docker logs235        if: success() || failure()236        run: cat './testnet-build-logs.${{ matrix.features }}/testnet_node_${{ matrix.network }}.log'237238      - name: Stop running containers239        if: always()                   # run this step always240        run: docker-compose -f ".docker/docker-compose-testnet.yml" -f ".docker/docker-compose-testnet.${{ matrix.network }}.yml" down241242      - name: Log in to Docker Hub243        uses: docker/login-action244        with:245          username: ${{ secrets.CORE_DOCKERHUB_USERNAME }}246          password: ${{ secrets.CORE_DOCKERHUB_TOKEN }}247248      - name: Tag docker image249        run: docker tag testnet_node_${{ matrix.network }} uniquenetwork/${{ matrix.network }}-testnet-local:nightly-${{ github.head_ref }}-${{ github.sha }}250251      - name: Push docker image252        run: docker push uniquenetwork/${{ matrix.network }}-testnet-local:nightly-${{ github.head_ref }}-${{ github.sha }}253254