Skip to content

Commit

Permalink
Merge branch 'master' into vs/rpc-call-gas
Browse files Browse the repository at this point in the history
  • Loading branch information
ukint-vs committed Sep 22, 2023
2 parents 5294a70 + 6c64798 commit 177806c
Show file tree
Hide file tree
Showing 192 changed files with 4,623 additions and 3,491 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/CI-docker-gear.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI | docker-gear release version

on:
workflow_dispatch:
inputs:
release_version:
description: 'Release version from https://get.gear.rs Example: v1.0.0. *Null = latest'
required: false
default: ''

env:
RELEASE_VERSION: ${{ github.event.inputs.release_version }}

jobs:
build:
runs-on: [kuberunner]
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v2

- uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-gear-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-gear
- uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- run: |
if [ -z "${{ env.RELEASE_VERSION }}" ]; then
echo "DOCKER_TAGS=ghcr.io/gear-tech/node:latest" >> $GITHUB_ENV
else
echo "DOCKER_TAGS=ghcr.io/gear-tech/node:latest,ghcr.io/gear-tech/node:${{ env.RELEASE_VERSION }}" >> $GITHUB_ENV
fi
- uses: docker/build-push-action@v4
with:
file: ./docker/Dockerfile-release
push: true
tags: ${{ env.DOCKER_TAGS }}
build-args: |
RELEASE_VERSION=${{ env.RELEASE_VERSION }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
31 changes: 23 additions & 8 deletions .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@ name: Benchmarks
on:
workflow_dispatch:
inputs:
create_pr:
description: Whether to create a pull request after the benchmarks are completed
required: false
type: boolean
change-type:
description: How should changes be made after the benchmarks are completed?
required: true
default: ignore
type: choice
options:
- ignore
- commit
- pull_request

env:
CARGO_TERM_COLOR: always
Expand All @@ -15,6 +20,9 @@ env:
jobs:
benchmarks:
runs-on: bench
permissions:
contents: write
pull-requests: write
env:
RUSTUP_HOME: /tmp/rustup_home
steps:
Expand Down Expand Up @@ -65,11 +73,18 @@ jobs:
run: |
echo "::notice::You can download the artifacts and use script \`./scripts/unpack-weights.sh\` to apply the changes to your branch"
- name: Create Pull Request
if: ${{ inputs.create_pr }}
- name: Create commit
if: ${{ inputs.change-type == 'commit' }}
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: >-
chore(runtime): update weights
file_pattern: "pallets/gear/src/ runtime/gear/src/weights/ runtime/vara/src/weights/"

- name: Create pull Request
if: ${{ inputs.change-type == 'pull_request' }}
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GH_TOKEN_FOR_PR }}
add-paths: |
pallets/gear/src/
runtime/gear/src/weights/
Expand All @@ -78,7 +93,7 @@ jobs:
branch: weights/patch
branch-suffix: short-commit-hash
title: >-
chore: update weights
chore(runtime): update weights
body: |
`run_all_benchmarks.sh` script is applied to update weights (branch: `${{ github.ref_name }}`, commit ${{ github.sha }})
**Note:** If CI fails, try manually updating the heuristic tests: `runtime/{gear, vara}/src/tests.rs`
46 changes: 46 additions & 0 deletions .github/workflows/comparison-table.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Comparison table

on:
workflow_dispatch:
inputs:
runtime:
description: For which runtime generate comparison table?
required: true
type: choice
options:
- gear
- vara

env:
CARGO_TERM_COLOR: always
TERM: xterm-256color

jobs:
comparison-table:
runs-on: [kuberunner]
env:
RUSTUP_HOME: /tmp/rustup_home
steps:
- name: "ACTIONS: Checkout & fetch all history"
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: "Install: Set cargo path"
run: echo "/tmp/cargo/bin" >> $GITHUB_PATH

- name: "Install: Rust toolchain"
uses: dsherret/rust-toolchain-file@v1

- name: "Build: Init"
run: ./scripts/gear.sh init cargo

- name: "Generate comparison tables (${{ inputs.runtime }})"
run: |
./scripts/weight-diff.sh master $(git branch --show-current) ${{ inputs.runtime }} --display-units > ${{ inputs.runtime }}-tables.txt
- name: "ACTIONS: Upload artifact with comparison tables (${{ inputs.runtime }})"
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.runtime }}-tables
path: ${{ inputs.runtime }}-tables.txt
2 changes: 1 addition & 1 deletion .github/workflows/time-consuming-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: "Install: Rust toolchain"
uses: dsherret/rust-toolchain-file@v1

- name: "Buid: Init"
- name: "Build: Init"
run: ./scripts/gear.sh init cargo

- name: "Build: Node"
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Live check on Vara Network Validator machine

on:
pull_request:
types: [synchronize, labeled, opened, reopened, ready_for_review]
branches: [master]
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

jobs:
tag-image:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'check-validator')
outputs:
image_tag: ${{ steps.image-tag.outputs.tag }}
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Create image tag
id: image-tag
run: echo "tag=ghcr.io/gear-tech/node:0.1.0-`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_OUTPUT

build-update-validator:
runs-on: [kuberunner]
if: contains(github.event.pull_request.labels.*.name, 'check-validator')
needs: tag-image
steps:

- name: Checkout repo
uses: actions/checkout@v4

- name: Echo tag
run: echo ${{ needs.tag-image.outputs.image_tag }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to DockerHub
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
context: .
file: ./docker/Dockerfile
push: true
tags: ghcr.io/gear-tech/node:latest, ${{ needs.tag-image.outputs.image_tag }}

- name: SSH into VM
uses: appleboy/[email protected]
env:
NEW_IMAGE: ${{ needs.tag-image.outputs.image_tag }}
with:
host: ${{ secrets.VARA_VALIDATOR_8 }}
username: ${{ secrets.SSH_VARA_USERNAME }}
key: ${{ secrets.VARA_SSH_PRIVATE_KEY }}
envs: NEW_IMAGE
script: |
sudo docker-compose -f /home/gear/docker-compose.yaml down
awk -v new_image="$NEW_IMAGE" '{gsub(/image: ghcr.io\/gear-tech\/node:.*/, "image: " new_image)}1' /home/gear/docker-compose.yaml > tmp && mv tmp /home/gear/docker-compose.yaml
sudo docker-compose -f /home/gear/docker-compose.yaml up -d
Loading

0 comments on commit 177806c

Please sign in to comment.