diff --git a/.docker/Dockerfile-try-runtime.j2 b/.docker/Dockerfile-try-runtime similarity index 66% rename from .docker/Dockerfile-try-runtime.j2 rename to .docker/Dockerfile-try-runtime index 71ce9e793a..54cce5c64d 100644 --- a/.docker/Dockerfile-try-runtime.j2 +++ b/.docker/Dockerfile-try-runtime @@ -19,17 +19,18 @@ RUN cargo install --git https://github.com/paritytech/try-runtime-cli --tag v0.8 RUN mkdir /unique_parachain WORKDIR /unique_parachain - # ===== BUILD ====== FROM rust-builder as builder-unique ARG PROFILE=release +ARG NETWORK +ARG REPLICA_FROM COPY . /unique_parachain WORKDIR /unique_parachain -RUN echo "Requested features: {{ NETWORK }}-runtime\n" && \ - echo "Fork from: {{ REPLICA_FROM }}\n" && \ - cargo build --features=try-runtime,{{ NETWORK }}-runtime --release +RUN echo "Requested features: ${NETWORK}-runtime\n" && \ + echo "Fork from: ${REPLICA_FROM}\n" && \ + cargo build --features=try-runtime,${NETWORK}-runtime --release -CMD try-runtime --runtime target/release/wbuild/{{ NETWORK }}-runtime/{{ NETWORK }}_runtime.compact.compressed.wasm on-runtime-upgrade --blocktime 6000 --checks all live --uri {{ REPLICA_FROM }} +CMD try-runtime --runtime target/release/wbuild/${NETWORK}-runtime/${NETWORK}_runtime.compact.compressed.wasm on-runtime-upgrade --blocktime 6000 --checks all live --uri ${REPLICA_FROM} diff --git a/.docker/docker-compose.try-runtime.j2 b/.docker/docker-compose.try-runtime.j2 index 879a6f2666..492d5480dc 100644 --- a/.docker/docker-compose.try-runtime.j2 +++ b/.docker/docker-compose.try-runtime.j2 @@ -2,7 +2,7 @@ version: "3.5" services: try-runtime: - image: uniquenetwork/ci-tryruntime-local:{{ NETWORK }}-{{ BUILD_TAG }} + image: uniquenetwork/ci-tryruntime-local:{{ BUILD_TAG }} container_name: try-runtime expose: - 9944 diff --git a/.github/workflows/try-runtime.yml b/.github/workflows/try-runtime.yml index f69d6e90f3..ea7b9204a0 100644 --- a/.github/workflows/try-runtime.yml +++ b/.github/workflows/try-runtime.yml @@ -53,7 +53,6 @@ jobs: include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}} steps: - - name: Clean Workspace uses: AutoModality/action-clean@v1.1.0 @@ -69,25 +68,6 @@ jobs: - name: Read .env file uses: xom9ikk/dotenv@v2.3.0 - - name: Log in to Docker Hub - uses: docker/login-action@v3.2.0 - with: - username: ${{ secrets.CORE_DOCKERHUB_USERNAME }} - password: ${{ secrets.CORE_DOCKERHUB_TOKEN }} - - # Build main image for TRY-RUNTIME - - name: Generate ENV related extend Dockerfile file - uses: cuchi/jinja2-action@v1.2.0 - with: - template: .docker/Dockerfile-try-runtime.j2 - output_file: .docker/Dockerfile-try-runtime.${{ matrix.network }}.yml - variables: | - NETWORK=${{ matrix.network }} - REPLICA_FROM=${{ matrix.replica_from_address }} - - - name: Show build Dockerfile - run: cat .docker/Dockerfile-try-runtime.${{ matrix.network }}.yml - - name: Run find-and-replace to remove slashes from branch name uses: mad9000/actions-find-and-replace-string@5 id: branchname @@ -101,90 +81,30 @@ jobs: run: | echo "BUILD_SHA=${LAST_COMMIT_SHA:0:8}" >> $GITHUB_ENV - - name: Build the stack - run: cd .docker/ && docker build --no-cache --file ./Dockerfile-try-runtime.${{ matrix.network }}.yml --tag uniquenetwork/ci-tryruntime-local:${{ matrix.network }}-${{ steps.branchname.outputs.value }}-$BUILD_SHA ../ - - - name: Push docker image version - run: docker push uniquenetwork/ci-tryruntime-local:${{ matrix.network }}-${{ steps.branchname.outputs.value }}-$BUILD_SHA - - - name: Remove builder cache - if: always() # run this step always - run: | - docker builder prune -f - docker system prune -f - - - try-runtime-tests: - needs: [prepare-execution-marix, try-runtime-build] - # The type of runner that the job will run on - runs-on: [medium] - - timeout-minutes: 600 - - name: ${{ matrix.network }}-try-runtime-tests - - 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: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}} - - steps: - - name: Skip if pull request is in Draft - if: github.event.pull_request.draft == true - run: exit 1 - - - 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@v4.1.7 - with: - ref: ${{ github.head_ref }} #Checking out head commit - - - name: Prepare - uses: ./.github/actions/prepare - - - name: Set build SHA - shell: bash - run: | - echo "BUILD_SHA=${LAST_COMMIT_SHA:0:8}" >> $GITHUB_ENV - - - name: Run find-and-replace to remove slashes from branch name - uses: mad9000/actions-find-and-replace-string@5 - id: branchname + - name: Prepare container + uses: ./.github/actions/buildContainer + id: try-runtime with: - source: ${{ github.head_ref }} - find: '/' - replace: '-' - - - name: Read .env file - uses: xom9ikk/dotenv@v2.3.0 + container: uniquenetwork/ci-tryruntime-local + tag: ${{ matrix.network }}-${{ steps.branchname.outputs.value }}-$BUILD_SHA + context: .docker + dockerfile: Dockerfile-try-runtime + args: | + --build-arg NETWORK=${{ matrix.network }} + --build-arg REPLICA_FROM=${{ matrix.replica_from_address }} + dockerhub_username: ${{ secrets.CORE_DOCKERHUB_USERNAME }} + dockerhub_token: ${{ secrets.CORE_DOCKERHUB_TOKEN }} - name: Generate ENV related extend file for docker-compose uses: cuchi/jinja2-action@v1.2.0 with: template: .docker/docker-compose.try-runtime.j2 - output_file: .docker/docker-compose.try-runtime.${{ matrix.network }}.yml + output_file: .docker/docker-compose.try-runtime.yml variables: | - NETWORK=${{ matrix.network }} - BUILD_TAG=${{ steps.branchname.outputs.value }}-$BUILD_SHA - - - name: Show build configuration - run: cat .docker/docker-compose.try-runtime.${{ matrix.network }}.yml - - - uses: actions/setup-node@v4.0.2 - with: - node-version: 20 - - - name: Log in to Docker Hub - uses: docker/login-action@v3.2.0 - with: - username: ${{ secrets.CORE_DOCKERHUB_USERNAME }} - password: ${{ secrets.CORE_DOCKERHUB_TOKEN }} + BUILD_TAG=${{ matrix.network }}-${{ steps.branchname.outputs.value }}-$BUILD_SHA - - name: Build the stack - run: docker compose -f ".docker/docker-compose.try-runtime.${{ matrix.network }}.yml" up -d --remove-orphans --force-recreate --timeout 300 + - name: RUN the stack + run: docker compose -f ".docker/docker-compose.try-runtime.yml" up -d --remove-orphans --force-recreate --timeout 300 - name: Check if docker logs consist logs related to Runtime Upgrade testing. if: success()