Skip to content

Commit

Permalink
change try-runtime wf
Browse files Browse the repository at this point in the history
  • Loading branch information
BuddyGlas committed Oct 10, 2024
1 parent 77f2403 commit a20cc67
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 102 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}
2 changes: 1 addition & 1 deletion .docker/docker-compose.try-runtime.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
112 changes: 16 additions & 96 deletions .github/workflows/try-runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ jobs:
include: ${{fromJson(needs.prepare-execution-marix.outputs.matrix)}}

steps:

- name: Clean Workspace
uses: AutoModality/[email protected]

Expand All @@ -69,25 +68,6 @@ jobs:
- name: Read .env file
uses: xom9ikk/[email protected]

- name: Log in to Docker Hub
uses: docker/[email protected]
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/[email protected]
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
Expand All @@ -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/[email protected]

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/[email protected]
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/[email protected]
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/[email protected]
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/[email protected]
with:
node-version: 20

- name: Log in to Docker Hub
uses: docker/[email protected]
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()
Expand Down

0 comments on commit a20cc67

Please sign in to comment.