Skip to content

Commit

Permalink
Merge branch 'dev' into chore/polish-slot-page
Browse files Browse the repository at this point in the history
  • Loading branch information
begonaalvarezd authored Apr 22, 2024
2 parents c418e69 + a636113 commit 82aa756
Show file tree
Hide file tree
Showing 186 changed files with 475 additions and 449 deletions.
147 changes: 32 additions & 115 deletions .github/workflows/nova-build-temp.yaml
Original file line number Diff line number Diff line change
@@ -1,129 +1,46 @@
name: Nova Deply Workflow (with SDK build)
name: Nova Deploy Workflow

on:
workflow_dispatch:
inputs:
TARGET_COMMIT:
description: "Target Commit Hash for the SDK"
required: false
default: "0694acfa2258fe3c28de2b88ea9c1a911de35051"
environment:
type: choice
description: "Select the environment to deploy to"
options:
- nova
required: false
default: nova
deployment:
type: boolean
description: "Deploy after build?"
required: false
default: false
on: workflow_dispatch

env:
DEPLOY_ENV: nova

jobs:
build-and-deploy:
set_env_vars:
name: Set Environment Variables
runs-on: ubuntu-latest
environment: release
outputs:
version_tag: ${{ steps.env_vars.outputs.version_tag }}
steps:
- name: Checkout Repository
uses: actions/checkout@v2

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

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.IOTALEDGER_DOCKER_USERNAME }}
password: ${{ secrets.IOTALEDGER_DOCKER_PASSWORD }}

- name: Get the short commit hash
- name: Set up the version tag for docker images and deploy environment
id: env_vars
run: |
COMMIT_HASH=$(git rev-parse --short HEAD)
echo "VERSION=$COMMIT_HASH" >> $GITHUB_ENV
- name: Set up Environment Variable
run: echo "DEPLOY_ENV=${{ github.event.inputs.environment }}" >> $GITHUB_ENV

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "16"

- name: Install System Dependencies
run: |
sudo apt-get update
sudo apt-get install -y python2 gcc-multilib g++-multilib build-essential libssl-dev rpm libsecret-1-dev software-properties-common apt-transport-https libudev-dev libusb-1.0-0-dev llvm-dev libclang-dev clang yarn
echo 'LIBCLANG_PATH=/usr/lib/llvm-14/lib' >> $GITHUB_ENV
echo 'DEBUG=electron-builder' >> $GITHUB_ENV
echo 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/snap:/root/.cargo/bin' >> $GITHUB_ENV
- name: Install Rust and wasm-bindgen-cli
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
cargo install wasm-bindgen-cli
rustup target add wasm32-unknown-unknown
- name: Global Git Configuration
run: git config --global --add safe.directory ${{ github.workspace }}

- name: Yarn Add crypto-browserify
run: yarn add crypto-browserify

- name: Setup SDK
run: |
git clone -b 2.0 https://github.com/iotaledger/iota-sdk
cd iota-sdk
echo "Checking out nova-sdk commit ${{ github.event.inputs.TARGET_COMMIT }}"
git checkout ${{ github.event.inputs.TARGET_COMMIT }}
- name: Build Node.js Bindings
run: |
cd iota-sdk/bindings/nodejs
echo "Renaming nodejs sdk (sdk-nova)"
sed -i.bak '2s/.*/ \"name\": \"@iota\/sdk-nova\",/' package.json
rm package.json.bak
echo "Building nodejs bindings"
source $HOME/.cargo/env
yarn
yarn build
- name: Build WASM Bindings
run: |
cd iota-sdk/bindings/wasm
echo "Renaming wasm sdk (sdk-wasm-nova)"
sed -i.bak '2s/.*/ \"name\": \"@iota\/sdk-wasm-nova\",/' package.json
rm package.json.bak
echo "Building wasm bindings"
source $HOME/.cargo/env
yarn
yarn build
- name: Build and push API Docker image
uses: docker/build-push-action@v2
with:
context: ./
file: ./api/Dockerfile
push: true
tags: iotaledger/explorer-api:${{ env.VERSION }}
no-cache: true

- name: Build and push Client Docker image
uses: docker/build-push-action@v2
with:
context: ./
file: ./client/Dockerfile
push: true
tags: iotaledger/explorer-client:${{ env.VERSION }}
no-cache: true

echo "VERSION_TAG=$COMMIT_HASH" >> $GITHUB_ENV
use-reusable-workflow:
strategy:
matrix:
directory: [api, client]
name: Build Images
needs: set_env_vars
uses: ./.github/workflows/build-images.reusable.yaml
with:
directory: ${{ matrix.directory }}
image_tags: |
iotaledger/explorer-${{ matrix.directory }}:${{ needs.set_env_vars.outputs.version_tag }}
secrets: inherit

deploy_to_server:
name: Deploy Production to Server
needs: [set_env_vars, use-reusable-workflow]
runs-on: ubuntu-latest
steps:
- name: Add SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.UPDATER_SSH_PRIVATE_KEY }}

- name: Deploy to Server
if: ${{ github.event.inputs.deployment }}
run: |
ssh -o StrictHostKeyChecking=no updater@${{ secrets.EXPLORER_NOVA_GATEWAY }} "${{ env.DEPLOY_ENV }} ${{ env.VERSION }}"
ssh -o StrictHostKeyChecking=no updater@${{ secrets.EXPLORER_NOVA_GATEWAY }} "${{ env.DEPLOY_ENV }} ${{ needs.set_env_vars.outputs.version_tag }}"
114 changes: 71 additions & 43 deletions api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
"@iota/identity-wasm-stardust": "npm:@iota/identity-wasm@^1.1.0",
"@iota/iota.js-chrysalis": "npm:@iota/iota.js@^1.8.6",
"@iota/mqtt.js": "^1.8.6",
"@iota/sdk": "1.1.1",
"@iota/sdk-nova": "../iota-sdk/bindings/nodejs",
"@iota/sdk-wasm": "^1.0.4",
"@iota/sdk-stardust": "npm:@iota/sdk@1.1.1",
"@iota/sdk-nova": "npm:@iota/[email protected]",
"@iota/sdk-wasm-stardust": "npm:@iota/[email protected]",
"@iota/util.js": "^1.8.6",
"@iota/validators": "^1.0.0-beta.30",
"@types/node-cron": "^3.0.2",
Expand Down Expand Up @@ -84,4 +84,4 @@
"eslint --fix"
]
}
}
}
3 changes: 1 addition & 2 deletions api/src/initServices.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable import/no-unresolved */
import { MqttClient as ChrysalisMqttClient } from "@iota/mqtt.js";
import { IClientOptions as IStardustClientOptions, Client as StardustClient } from "@iota/sdk";
import { ClientOptions as INovaClientOptions, Client as NovaClient } from "@iota/sdk-nova";
import { IClientOptions as IStardustClientOptions, Client as StardustClient } from "@iota/sdk-stardust";
import { ServiceFactory } from "./factories/serviceFactory";
import logger from "./logger";
import { IConfiguration } from "./models/configuration/IConfiguration";
Expand Down
2 changes: 0 additions & 2 deletions api/src/models/api/nova/IAccountDetailsResponse.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable import/no-unresolved */
/* eslint-disable @typescript-eslint/no-unsafe-argument */
import { OutputWithMetadataResponse } from "@iota/sdk-nova";
import { IResponse } from "./IResponse";

Expand Down
2 changes: 0 additions & 2 deletions api/src/models/api/nova/IAccountValidatorDetailsResponse.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable import/no-unresolved */
/* eslint-disable @typescript-eslint/no-unsafe-argument */
import { ValidatorResponse } from "@iota/sdk-nova";
import { IResponse } from "./IResponse";

Expand Down
2 changes: 0 additions & 2 deletions api/src/models/api/nova/IAddressDetails.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable import/no-unresolved */
/* eslint-disable @typescript-eslint/no-unsafe-argument */
import { AddressType } from "@iota/sdk-nova";

export interface IAddressDetails {
Expand Down
2 changes: 0 additions & 2 deletions api/src/models/api/nova/IAddressDetailsResponse.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable import/no-unresolved */
/* eslint-disable @typescript-eslint/no-unsafe-argument */
import { OutputWithMetadataResponse } from "@iota/sdk-nova";
import { IResponse } from "./IResponse";

Expand Down
Loading

0 comments on commit 82aa756

Please sign in to comment.