From 0643ad58bc6c4e3d7e559ad784431a1241747149 Mon Sep 17 00:00:00 2001 From: Alexander Aksenov Date: Thu, 04 Aug 2022 09:48:19 +0000 Subject: [PATCH] Removed un-needed artefacts. Added additional build ARGS. --- --- a/.docker/Dockerfile-chain-dev +++ b/.docker/Dockerfile-chain-dev @@ -10,9 +10,10 @@ RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none -ARG RUST_TOOLCHAIN=nightly-2022-04-07 -ARG BRANCH=develop -ARG REPO_URL=https://github.com/UniqueNetwork/unique-chain.git +ARG RUST_TOOLCHAIN=nightly-2022-05-11 +ARG POLKA_VERSION=release-v0.9.24 +ARG BRANCH= +ARG REPO_URL= ARG FEATURE= RUN rustup toolchain uninstall $(rustup toolchain list) && \ @@ -24,12 +25,5 @@ WORKDIR /dev_chain RUN cargo build --release - -EXPOSE 9844 -EXPOSE 9944 -EXPOSE 9933 -EXPOSE 9833 -EXPOSE 40333 -EXPOSE 30333 CMD cargo run --release $FEATURE -- --dev -linfo --unsafe-ws-external --rpc-cors=all --unsafe-rpc-external --- a/.docker/Dockerfile-parachain +++ b/.docker/Dockerfile-parachain @@ -1,27 +1,10 @@ # ===== Rust builder ===== -FROM phusion/baseimage:focal-1.1.0 as rust-builder +FROM ubuntu:20.04 as rust-builder LABEL maintainer="Unique.Network" ARG RUST_TOOLCHAIN=nightly-2022-05-11 -#ARG RUST_C=1.62.0-nightly -ARG POLKA_VERSION=release-v0.9.24 -ARG UNIQUE_BRANCH=develop - -#ARG USER=*** -#ARG PASS=*** - ENV RUST_TOOLCHAIN $RUST_TOOLCHAIN -#ENV RUST_C $RUST_C -ENV POLKA_VERSION $POLKA_VERSION -ENV UNIQUE_BRANCH $UNIQUE_BRANCH - - -#RUN echo $RUST_TOOLCHAIN -#RUN echo $RUST_C -#RUN echo $POLKA_VERSION -#RUN echo $UNIQUE_BRANCH - ENV CARGO_HOME="/cargo-home" ENV PATH="/cargo-home/bin:$PATH" @@ -38,46 +21,41 @@ rustup show RUN rustup target add wasm32-unknown-unknown --toolchain $RUST_TOOLCHAIN -RUN cargo install cargo-chef +RUN pwd && ls -la RUN mkdir unique_parachain WORKDIR /unique_parachain -# ===== Chef ===== -FROM rust-builder as chef - -COPY . . -RUN cargo chef prepare --recipe-path recipe.json - # ===== BUILD ====== FROM rust-builder as builder +ARG PROFILE=release + RUN mkdir unique_parachain WORKDIR /unique_parachain -COPY --from=chef /unique_parachain/recipe.json recipe.json -ARG PROFILE=release -RUN cargo chef cook "--$PROFILE" --recipe-path recipe.json - +RUN pwd && ls -la COPY . . -RUN cargo build "--$PROFILE" +RUN cargo build --$PROFILE # && \ # cargo test # ===== BUILD POLKADOT ===== FROM rust-builder as builder-polkadot +ARG POLKA_VERSION=release-v0.9.24 +ENV POLKA_VERSION $POLKA_VERSION + RUN mkdir unique_parachain WORKDIR /unique_parachain RUN git clone -b $POLKA_VERSION --depth 1 https://github.com/paritytech/polkadot.git && \ cd polkadot && \ - git tag -n && \ - cargo build --release + cargo build --release # ===== RUN ====== -FROM phusion/baseimage:focal-1.1.0 +FROM ubuntu:20.04 ARG PROFILE=release @@ -87,26 +65,19 @@ 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 v15.5.0 && \ - nvm use v15.5.0 + nvm install v16.16.0 && \ + nvm use v16.16.0 -RUN git clone https://github.com/paritytech/polkadot-launch +RUN git clone https://github.com/uniquenetwork/polkadot-launch -b feature/parachain-forking RUN export NVM_DIR="$HOME/.nvm" && \ [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \ cd /polkadot-launch && \ npm install --global yarn && \ - yarn + yarn install COPY --from=builder /unique_parachain/target/$PROFILE/unique-collator /unique-chain/target/$PROFILE/ COPY --from=builder-polkadot /unique_parachain/polkadot/target/$PROFILE/polkadot /polkadot/target/$PROFILE/ - -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" && \ --- a/.docker/Dockerfile-parachain-v2 +++ /dev/null @@ -1,96 +0,0 @@ -# ===== Rust builder ===== -FROM phusion/baseimage:focal-1.1.0 as rust-builder -LABEL maintainer="Unique.Network" - -ARG RUST_TOOLCHAIN={{ actual_toolchain }} -ARG POLKA_VERSION=release-v0.9.24 - - -ENV RUST_TOOLCHAIN $RUST_TOOLCHAIN -ENV POLKA_VERSION $POLKA_VERSION - -ENV CARGO_HOME="/cargo-home" -ENV PATH="/cargo-home/bin:$PATH" - -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none - -RUN apt-get update && \ - apt-get dist-upgrade -y -o Dpkg::Options::="--force-confold" && \ - apt-get install -y cmake pkg-config libssl-dev git clang - -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 - -####works inside repo folder### - - -# ===== BUILD ====== -FROM rust-builder as builder-unique - -RUN mkdir unique_parachain -WORKDIR /unique_parachain - -ARG PROFILE='features=quartz-runtime --release' - -COPY . . -RUN cargo build --features=quartz-runtime --release - # && \ - # cargo test - -# ===== BUILD POLKADOT ===== -FROM rust-builder as builder-polkadot - -RUN mkdir unique_parachain -WORKDIR /unique_parachain - -RUN git clone -b $POLKA_VERSION --depth 1 https://github.com/paritytech/polkadot.git && \ - cd polkadot && \ - git tag -n && \ - cargo build --release - -# ===== RUN ====== - -FROM phusion/baseimage:focal-1.1.0 - -#ARG PROFILE='--features=quartz-runtime --release' - -RUN apt-get -y update && \ - apt-get -y upgrade && \ - 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 v15.5.0 && \ - nvm use v15.5.0 - -RUN git clone https://github.com/UniqueNetwork/polkadot-launch.git && \ - cd ./polkadot-launch && \ - git checkout feature/runtime-upgrade-testing - -RUN export NVM_DIR="$HOME/.nvm" && \ - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \ - cd /polkadot-launch && \ - npm install --global yarn && \ - yarn - -COPY --from=builder-unique /unique_parachain/target/release/unique-collator /unique-chain/target/release/ -COPY --from=builder-polkadot /unique_parachain/polkadot/target/release/polkadot /polkadot/target/release/ - -COPY ["./launch-config.json", "/polkadot-launch/launch-config.json"] - - -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 --- a/.docker/docker-compose-dev.yaml +++ b/.docker/docker-compose-dev.yaml @@ -1,12 +1,12 @@ version: "3.5" services: - node-o: + node-dev: build: context: . dockerfile: Dockerfile-chain-dev - image: node-o - container_name: node-o + image: node-dev + container_name: node-dev expose: - 9944 - 9933 --- a/.docker/docker-compose-tests-parachain.yml +++ /dev/null @@ -1,28 +0,0 @@ -version: "3.5" - -services: - blockchain_nodes: - build: - context: ./ - dockerfile: Dockerfile-parachain - args: - - RUST_TOOLCHAIN=${RUST_TOOLCHAIN:?err} - - RUST_C=${RUST_C:?err} - - POLKA_VERSION=${POLKA_VERSION:?err} - - UNIQUE_BRANCH=${UNIQUE_BRANCH:?err} - volumes: - - ./launch-config.json:/polkadot-launch/launch-config.json - env_file: - - ./.env - - integration_tests: - build: - context: tests/ - dockerfile: Dockerfile-tests - environment: - RPC_URL: http://blockchain_nodes:9933/ - volumes: - - ./tests/src/config_docker.ts:/unique_parachain/src/config.ts - - /home/ubuntu/mochawesome-report:/unique_parachain/mochawesome-report - depends_on: - - blockchain_nodes --- a/.docker/docker-compose.tmp.j2 +++ b/.docker/docker-compose.tmp.j2 @@ -1,13 +1,13 @@ version: "3.5" services: - node-o: + node-dev: build: args: - - "RUST_TOOLCHAIN={{ RUST_TOOLCHAIN }}" - - "BRANCH={{ BRANCH }}" - - "REPO_URL={{ REPO_URL }}" - - "FEATURE={{ FEATURE }}" + - "RUST_TOOLCHAIN={{ RUST_TOOLCHAIN:?err }}" + - "BRANCH={{ BRANCH:?err }}" + - "REPO_URL={{ REPO_URL:?err }}" + - "FEATURE={{ FEATURE:?err }}" + - "POLKA_VERSION={{ POLKA_VERSION:?err }}" command: cargo run --release $FEATURE -- --dev -linfo --unsafe-ws-external --rpc-cors=all --unsafe-rpc-external - --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,6 @@ .git/ .github/ +.docker/ doc/ target/ tests/ --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -6,7 +6,8 @@ - develop types: - opened - - edited + - reopened + - synchronize jobs: rustfmt: @@ -29,7 +30,7 @@ runs-on: self-hosted-ci steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: Install substrate dependencies run: sudo apt-get install libssl-dev pkg-config libclang-dev clang - name: Install latest nightly --- a/.github/workflows/node_build_test.yml +++ b/.github/workflows/node_build_test.yml @@ -1,51 +1,27 @@ -name: Build & test +name: Develop - Build & test # Controls when the action will run. on: # Triggers the workflow on push or pull request events but only for the master branch - #push: - # branches: [ develop ] pull_request: branches: - develop types: - opened - - edited - reopened - # pull_request: - # branches: [ develop ] + - synchronize #commit(s) pushed to the pull request + # Allows you to run this workflow manually from the Actions tab workflow_dispatch: #Define Workflow variables env: - ubuntu_version: focal - chains_release_dir: /opt/runner/chains_release - opal_chain_workdir: ./src_opal_chain - quartz_chain_workdir: ./src_quartz_chain - unique_chain_workdir: ./src_unique_chain RUST_TOOLCHAIN: nightly-2022-05-11 REPO_URL: ${{ github.server_url }}/${{ github.repository }} + POLKA_VERSION: release-v0.9.24 # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - pre-requisites: - # The type of runner that the job will run on - runs-on: self-hosted-ci - - steps: - #runs ssh connection - - name: Install dependencies - run: | - sudo apt-get install git curl libssl-dev llvm pkg-config libclang-dev clang make cmake - sudo apt autoremove - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none - . $HOME/.cargo/env && cargo install --locked --git https://github.com/chevdor/subwasm - rustup toolchain install ${{ env.RUST_TOOLCHAIN }} - rustup default ${{ env.RUST_TOOLCHAIN }} - rustup target add wasm32-unknown-unknown --toolchain ${{ env.RUST_TOOLCHAIN }} - - build: # The type of runner that the job will run on runs-on: self-hosted-ci @@ -53,13 +29,13 @@ needs: pre-requisites name: Build Container, Spin it Up an test - continue-on-error: true #Do not stop testing of matrix runs failed. + continue-on-error: false #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: "Opal" - features: " " + features: "--features=opal-runtime" - network: "Quartz" features: "--features=quartz-runtime" - network: "Unique" @@ -68,6 +44,8 @@ steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.sha }} #Checking out head commit - name: Generate ENV related extend file for docker-compose uses: cuchi/jinja2-action@v1.2.0 @@ -77,25 +55,23 @@ variables: | REPO_URL=${{ github.server_url }}/${{ github.repository }}.git RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }} + POLKA_VERSION=${{ env.POLKA_VERSION }} FEATURE=${{ matrix.features }} BRANCH=${{ github.head_ref }} - - name: Show temporary file + - name: Show build configuration run: cat .docker/docker-compose.${{ matrix.network }}.yml - name: Build the stack run: docker-compose -f ".docker/docker-compose-dev.yaml" -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build -# - name: "Build the Docker image with Feature: ${{ env.features }}" -# run: docker build -t build-${{ github.head_ref }} --file .docker/Dockerfile-chain-dev --build-arg REPO_URL=${{ github.server_url }}/${{ github.repository }}.git --build-arg RUST_TOOLCHAIN=${{ env.actual_toolchain }} --build-arg FEATURE="${{ env.features }}" --build-arg BRANCH=${{ github.head_ref }} --no-cache . - - name: Wait run: sleep 420s - name: Install node uses: actions/setup-node@v1 with: - node-version: 14.x + node-version: 16.x - name: Install dependencies run: | --- a/.github/workflows/notify.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: telegram message -on: - pull_request: - branches: - - develop - types: - - opened - - edited -jobs: - build: - runs-on: self-hosted-ci - steps: - - uses: avkviring/telegram-github-action@v0.0.13 - env: - telegram_to: ${{ secrets.TELEGRAM_TO }} - telegram_token: ${{ secrets.TELEGRAM_TOKEN }} - event: ${{ toJson(github.event) }} --- a/.github/workflows/tests_codestyle.yml +++ b/.github/workflows/tests_codestyle.yml @@ -6,13 +6,14 @@ - develop types: - opened - - edited + - reopened + - synchronize jobs: build: runs-on: self-hosted-ci steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install modules run: cd tests && yarn - name: Run ESLint --- a/Dockerfile-parachain +++ /dev/null @@ -1,107 +0,0 @@ -# ===== Rust builder ===== -FROM phusion/baseimage:focal-1.1.0 as rust-builder -LABEL maintainer="Unique.Network" - -ARG RUST_TOOLCHAIN=nightly-2022-05-11 -#ARG RUST_C=1.62.0-nightly -ARG POLKA_VERSION=release-v0.9.24 -ARG UNIQUE_BRANCH=develop - -#ARG USER=*** -#ARG PASS=*** - - -ENV RUST_TOOLCHAIN $RUST_TOOLCHAIN -#ENV RUST_C $RUST_C -ENV POLKA_VERSION $POLKA_VERSION -ENV UNIQUE_BRANCH $UNIQUE_BRANCH - - -#RUN echo $RUST_TOOLCHAIN -#RUN echo $RUST_C -#RUN echo $POLKA_VERSION -#RUN echo $UNIQUE_BRANCH - -ENV CARGO_HOME="/cargo-home" -ENV PATH="/cargo-home/bin:$PATH" - -RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain none - -RUN apt-get update && \ - apt-get dist-upgrade -y -o Dpkg::Options::="--force-confold" && \ - apt-get install -y cmake pkg-config libssl-dev git clang - -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 cargo install cargo-chef - -RUN mkdir unique_parachain -WORKDIR /unique_parachain - -# ===== Chef ===== -FROM rust-builder as chef - -COPY . . -RUN cargo chef prepare --recipe-path recipe.json - -# ===== BUILD ====== -FROM rust-builder as builder - -RUN mkdir unique_parachain -WORKDIR /unique_parachain - -COPY --from=chef /unique_parachain/recipe.json recipe.json -ARG PROFILE=release -RUN cargo chef cook "--$PROFILE" --recipe-path recipe.json - -COPY . . -RUN cargo build "--$PROFILE" - # && \ - # cargo test - -# ===== BUILD POLKADOT ===== -FROM rust-builder as builder-polkadot - -RUN mkdir unique_parachain -WORKDIR /unique_parachain - -RUN git clone -b $POLKA_VERSION --depth 1 https://github.com/paritytech/polkadot.git && \ - cd polkadot && \ - git tag -n && \ - cargo build --release - -# ===== RUN ====== - -FROM phusion/baseimage:focal-1.1.0 - -ARG PROFILE=release - -RUN apt-get -y update && \ - apt-get -y upgrade && \ - 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 v15.5.0 && \ - nvm use v15.5.0 - -RUN git clone https://github.com/paritytech/polkadot-launch - -RUN export NVM_DIR="$HOME/.nvm" && \ - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \ - cd /polkadot-launch && \ - npm install --global yarn && \ - yarn - -COPY --from=builder /unique_parachain/target/$PROFILE/unique-collator /unique-chain/target/$PROFILE/ -COPY --from=builder-polkadot /unique_parachain/polkadot/target/$PROFILE/polkadot /polkadot/target/$PROFILE/ - -CMD export NVM_DIR="$HOME/.nvm" && \ - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \ - cd /polkadot-launch && \ - yarn start launch-config.json --- a/docker-compose-tests-parachain.yml +++ /dev/null @@ -1,28 +0,0 @@ -version: "3.5" - -services: - blockchain_nodes: - build: - context: ./ - dockerfile: Dockerfile-parachain - args: - - RUST_TOOLCHAIN=${RUST_TOOLCHAIN:?err} - - RUST_C=${RUST_C:?err} - - POLKA_VERSION=${POLKA_VERSION:?err} - - UNIQUE_BRANCH=${UNIQUE_BRANCH:?err} - volumes: - - ./launch-config.json:/polkadot-launch/launch-config.json - env_file: - - ./.env - - integration_tests: - build: - context: tests/ - dockerfile: Dockerfile-tests - environment: - RPC_URL: http://blockchain_nodes:9933/ - volumes: - - ./tests/src/config_docker.ts:/unique_parachain/src/config.ts - - /home/ubuntu/mochawesome-report:/unique_parachain/mochawesome-report - depends_on: - - blockchain_nodes -- gitstuff