Skip to content

Commit

Permalink
Merge pull request #526 from gear-foundation/master
Browse files Browse the repository at this point in the history
Release: Varaman bump dependencies
  • Loading branch information
vraja-nayaka authored Nov 29, 2024
2 parents ec7794b + 56f03a6 commit 6809c17
Show file tree
Hide file tree
Showing 1,037 changed files with 39,329 additions and 19,582 deletions.
Binary file removed .DS_Store
Binary file not shown.
112 changes: 112 additions & 0 deletions .github/workflows/Release-warriors-battle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Release - Deploy New Tamagotchi/Warriors Battle

on:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
ENVIRONMENT: prod
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
KUBECTL_VERSION: "v1.22.17"
KUBE_NAMESPACE: gear-dapps
KUBE_DEPLOYMENT_PREFIX: tamagotchi-battle-new
REGISTRY: ghcr.io/${{ github.repository }}

jobs:
prepair:
runs-on: ubuntu-latest
outputs:
image_name: ${{ steps.image.outputs.image_name }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Get branch
id: branch
run: |
branch_name=${GITHUB_REF#refs/heads/}
echo "branch_name=$branch_name" >> $GITHUB_ENV
- name: Get short SHA
id: sha
run: |
sha_short=$(git rev-parse --short HEAD)
echo "sha_short=$sha_short" >> $GITHUB_ENV
- name: Set IMAGE_NAME
id: image
run: |
image_name=${{ env.REGISTRY }}-${{ env.KUBE_DEPLOYMENT_PREFIX }}:${{ env.branch_name }}-${{ env.sha_short }}
echo "image_name=$image_name" >> $GITHUB_OUTPUT
build-and-push-image:
needs: [prepair]
runs-on: ubuntu-latest
environment: prod
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the github container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push image
uses: docker/build-push-action@v5
with:
file: frontend/apps/web3-warriors-battle/Dockerfile
push: true
tags: ${{ needs.prepair.outputs.image_name }}
build-args: |
VITE_DNS_API_URL=${{ secrets.VITE_DNS_API_URL_TESTNET }}
VITE_NODE_ADDRESS=${{ secrets.VITE_NODE_ADDRESS_TESTNET }}
VITE_DNS_NAME=${{ secrets.VITE_DNS_NAME_BATTLE_NEW }}
VITE_SENTRY_DSN=${{ secrets.VITE_SENTRY_DSN }}
VITE_GTM_ID=${{ secrets.VITE_GTM_ID_BATTLE_NEW }}
deploy-to-k8s:
needs: [prepair, build-and-push-image]
runs-on: ubuntu-latest
environment: prod
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Update deployment image
uses: kodermax/kubectl-aws-eks@main
with:
args: |
set image deployment/${{ env.KUBE_DEPLOYMENT_PREFIX }}-${{ env.ENVIRONMENT }} \
${{ env.KUBE_DEPLOYMENT_PREFIX }}-${{ env.ENVIRONMENT }}=${{ needs.prepair.outputs.image_name }} \
-n ${{ env.KUBE_NAMESPACE }}
- name: Restart deployment
uses: kodermax/kubectl-aws-eks@main
with:
args: |
rollout restart deployment/${{ env.KUBE_DEPLOYMENT_PREFIX }}-${{ env.ENVIRONMENT }} \
-n ${{ env.KUBE_NAMESPACE }}
- name: Check deployment
uses: kodermax/kubectl-aws-eks@main
with:
args: |
rollout status deployment/${{ env.KUBE_DEPLOYMENT_PREFIX }}-${{ env.ENVIRONMENT }} \
--timeout=240s \
-n ${{ env.KUBE_NAMESPACE }}
117 changes: 117 additions & 0 deletions .github/workflows/STG-tamagotchi-battle-new.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: Staging - Deploy New Tamagotchi Battle

on:
workflow_dispatch:
push:
branches: ["master", "main"]
paths:
- frontend/apps/web3-warriors-battle/**
- frontend/packages/**

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
ENVIRONMENT: stg
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
KUBECTL_VERSION: "v1.22.17"
KUBE_NAMESPACE: gear-dapps
KUBE_DEPLOYMENT_PREFIX: tamagotchi-battle-new
REGISTRY: ghcr.io/${{ github.repository }}

jobs:
prepair:
runs-on: ubuntu-latest
outputs:
image_name: ${{ steps.image.outputs.image_name }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Get branch
id: branch
run: |
branch_name=${GITHUB_REF#refs/heads/}
echo "branch_name=$branch_name" >> $GITHUB_ENV
- name: Get short SHA
id: sha
run: |
sha_short=$(git rev-parse --short HEAD)
echo "sha_short=$sha_short" >> $GITHUB_ENV
- name: Set IMAGE_NAME
id: image
run: |
image_name=${{ env.REGISTRY }}-${{ env.KUBE_DEPLOYMENT_PREFIX }}:${{ env.branch_name }}-${{ env.sha_short }}
echo "image_name=$image_name" >> $GITHUB_OUTPUT
build-and-push-image:
needs: [prepair]
runs-on: ubuntu-latest
environment: stg
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Log in to the github container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push image
uses: docker/build-push-action@v5
with:
file: frontend/apps/web3-warriors-battle/Dockerfile
push: true
tags: ${{ needs.prepair.outputs.image_name }}
build-args: |
VITE_DNS_API_URL=${{ secrets.VITE_DNS_API_URL }}
VITE_NODE_ADDRESS=${{ secrets.VITE_NODE_ADDRESS }}
VITE_DNS_NAME=${{ secrets.VITE_DNS_NAME_BATTLE_NEW }}
VITE_SENTRY_DSN=${{ secrets.VITE_SENTRY_DSN }}
VITE_GASLESS_BACKEND_ADDRESS=${{ secrets.VITE_GASLESS_BACKEND_ADDRESS }}
deploy-to-k8s:
needs: [prepair, build-and-push-image]
runs-on: ubuntu-latest
environment: stg
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ env.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ env.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Update deployment image
uses: kodermax/kubectl-aws-eks@main
with:
args: |
set image deployment/${{ env.KUBE_DEPLOYMENT_PREFIX }}-${{ env.ENVIRONMENT }} \
${{ env.KUBE_DEPLOYMENT_PREFIX }}-${{ env.ENVIRONMENT }}=${{ needs.prepair.outputs.image_name }} \
-n ${{ env.KUBE_NAMESPACE }}
- name: Restart deployment
uses: kodermax/kubectl-aws-eks@main
with:
args: |
rollout restart deployment/${{ env.KUBE_DEPLOYMENT_PREFIX }}-${{ env.ENVIRONMENT }} \
-n ${{ env.KUBE_NAMESPACE }}
- name: Check deployment
uses: kodermax/kubectl-aws-eks@main
with:
args: |
rollout status deployment/${{ env.KUBE_DEPLOYMENT_PREFIX }}-${{ env.ENVIRONMENT }} \
--timeout=240s \
-n ${{ env.KUBE_NAMESPACE }}
62 changes: 54 additions & 8 deletions .github/workflows/UpdateGearDependency.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,89 @@ name: Update GEAR Dependencies

on:
schedule:
- cron: '0 0 * * *' # Runs every day at midnight
- cron: '0 */2 * * *' # Runs every 30 minutes
workflow_dispatch: # Allows manual triggering of the workflow

defaults:
run:
working-directory: scripts

permissions:
contents: write
actions: write
pull-requests: write

jobs:
update-dependencies:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.UPDATE_GEAR_TAG_TOKEN }}
token: ${{ secrets.WF_SECRET }}

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install GitPython
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests packaging gitpython
- name: Check for new tag and update Cargo.toml
env:
GITHUB_TOKEN: ${{ secrets.UPDATE_GEAR_TAG_TOKEN }}
GITHUB_TOKEN: ${{ secrets.WF_SECRET }}
run: |
python update_gear_version.py
if ! git diff --exit-code; then
echo "Changes detected in the repository after running the update_gear_version.py script."
# Configure git
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add ../contracts/Cargo.toml
git config user.email "github-actions[bot]@users.noreply.github.com"
# Output changes for logging
echo "The following changes were made:"
git diff
# Create a new branch
branch_name="update-gear-dependencies-$(date +%Y%m%d%H%M%S)"
echo "Creating a new branch: $branch_name"
git checkout -b $branch_name
# Remove and update Cargo.lock file
echo "Removing contracts/Cargo.lock"
rm -f ../contracts/Cargo.lock
echo "Updating contracts/Cargo.lock"
cd ../contracts && cargo generate-lockfile
# Stage and commit changes
echo "Staging changed files."
git add Cargo.toml
git add ../.github/workflows/contracts-tests.yml
git add Cargo.lock
echo "Committing changes with message: 'Update GEAR dependencies to latest tag in contracts'"
git commit -m "Update GEAR dependencies to latest tag in contracts"
git push origin master -f
# Check if there's an open PR with the label 'auto-update-gear'
open_prs=$(gh pr list --label "auto-update-gear" --state open --json number --jq '.[].number')
if [ -n "$open_prs" ]; then
echo "An open pull request with the label 'auto-update-gear' already exists. Exiting."
exit 0
fi
# If no matching PR was found, push the branch and create a new PR
echo "Pushing the new branch: $branch_name"
git push origin $branch_name
echo "Creating a new pull request."
gh pr create --title "Update GEAR dependencies" --body "Automatically created pull request to update GEAR dependencies" --base master --head $branch_name --label "auto-update-gear"
else
echo "No changes were detected after running the update_gear_version.py script."
fi
23 changes: 11 additions & 12 deletions .github/workflows/contracts-tests.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
name: Contracts CI - Tests

on:
workflow_dispatch:
pull_request:
paths-ignore:
- 'frontend/**'
- 'docker/**'
branches: [master, main]
paths:
- contracts/**
push:
paths-ignore:
- 'frontend/**'
- 'docker/**'
branches: [master]
branches: [master, main]
paths:
- contracts/**
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
GEAR_VERSION: 1.5.0
GEAR_VERSION: 1.7.0

defaults:
run:
Expand Down Expand Up @@ -44,18 +43,18 @@ jobs:
with:
toolchain: stable
targets: wasm32-unknown-unknown

- name: Install rust-src component
run: rustup component add rust-src --toolchain stable-x86_64-unknown-linux-gnu

- name: Prepare Gear Binary
run: |
mkdir -p target/tmp
wget -qO- https://get.gear.rs/gear-v${{ env.GEAR_VERSION }}-x86_64-unknown-linux-gnu.tar.xz| tar xJ -C target/tmp
# mandatory tasks
- name: Fmt
run: 'cargo +nightly fmt --all -- --config imports_granularity=Crate,edition=2021'
- name: Clippy
run: 'cargo clippy --release --workspace --all-targets --all-features -- -D warnings'
- name: Test
run: cargo test --release --workspace


5 changes: 4 additions & 1 deletion .github/workflows/contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:

env:
CARGO_TERM_COLOR: always
DEFAULT_TOOLCHAIN: 1.78.0
DEFAULT_TOOLCHAIN: 1.82.0

defaults:
run:
Expand All @@ -30,6 +30,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Install rust-src component
run: rustup component add rust-src --toolchain stable-x86_64-unknown-linux-gnu

- name: Build
run: 'cargo build --release --workspace;'

Expand Down
Loading

0 comments on commit 6809c17

Please sign in to comment.