Skip to content

Commit

Permalink
Merge pull request #330 from Lumerin-protocol/test
Browse files Browse the repository at this point in the history
Main-1.0.60
  • Loading branch information
abs2023 authored Dec 3, 2024
2 parents 6079dff + ddd09ae commit 441f249
Show file tree
Hide file tree
Showing 92 changed files with 2,843 additions and 1,153 deletions.
4 changes: 3 additions & 1 deletion .github/actions/copy_env_files/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ runs:
run: |
cp ./.github/workflows/models-config.json ./proxy-router/models-config.json
cp ./.github/workflows/models-config.json models-config.json
cp ./.github/workflows/rating-config.json ./proxy-router/rating-config.json
cp ./.github/workflows/rating-config.json rating-config.json
if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then
cp ./.github/workflows/proxy-router.main.env ./proxy-router/.env
cp ./.github/workflows/proxy-router.main.env .env
cp ./.github/workflows/ui-desktop.main.env ./ui-desktop/.env
elif [[ "${GITHUB_REF}" == "refs/heads/stg" ]]; then
elif [[ "${GITHUB_REF}" == "refs/heads/test" ]]; then
cp ./.github/workflows/proxy-router.test.env ./proxy-router/.env
cp ./.github/workflows/proxy-router.test.env .env
cp ./.github/workflows/ui-desktop.test.env ./ui-desktop/.env
Expand Down
32 changes: 22 additions & 10 deletions .github/actions/gen_tag_name/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,27 @@ runs:
id: tag
shell: bash
run: |
SHORT_HASH="$(git rev-parse --short=7 HEAD)"
echo $SHORT_HASH
if [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then
PREFIX="main-"
elif [[ "${GITHUB_REF}" == "refs/heads/stg" ]]; then
PREFIX="test-"
VMAJ=1
VMIN=0
VPAT=0
set +o pipefail
VLAST=$(git describe --tags --abbrev=0 --match='v[1-9]*' 2>/dev/null | cut -c2-)
[ $VLAST ] && declare $(echo $VLAST | awk -F '.' '{print "VMAJ="$1" VMIN="$2" VPAT="$3}')
if [ "$GITHUB_REF_NAME" = "main" ]
then
VPAT=0
VMIN=$((VMIN+1))
VFULL=${VMAJ}.${VMIN}
VTAG=v$VFULL
else
PREFIX="dev-"
MB=$(git merge-base refs/remotes/origin/main HEAD)
VPAT=$(git rev-list --count --no-merges ${MB}..HEAD)
VFULL=${VMAJ}.${VMIN}.${VPAT}
RNAME=${GITHUB_REF_NAME##*/}
[ "$GITHUB_EVENT_NAME" = "pull_request" ] && RNAME=pr${GITHUB_REF_NAME%/merge}
VTAG=v${VFULL}-${RNAME}
fi
TAG_NAME="${PREFIX}${SHORT_HASH}"
echo $TAG_NAME
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV
echo "VLAST=$VLAST VMAJ=$VMAJ VMIN=$VMIN VPAT=$VPAT VFULL=$VFULL VTAG=$VTAG"
echo "TAG_NAME=${VTAG}" >> $GITHUB_ENV
echo "VTAG=${VTAG}" >> $GITHUB_ENV
echo "VFULL=${VFULL}" >> $GITHUB_ENV
133 changes: 117 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: CI-CD

on:
workflow_dispatch:
Expand All @@ -7,11 +7,14 @@ on:
description: 'Create new release'
required: true
type: boolean

push:
branches:
- main
- stg
- test
- dev
paths: ['.github/workflows/**', '**/Makefile', '**/*.go', '**/*.json', '**/*.yml', '**/*.ts', '**/*.js']

pull_request:
types: [opened, reopened, synchronize]
paths: ['.github/workflows/**', '**/Makefile', '**/*.go', '**/*.json', '**/*.yml', '**/*.ts', '**/*.js']
Expand All @@ -25,12 +28,79 @@ defaults:
shell: bash

jobs:
GitLab-Deploy:
if: ${{ github.repository != 'MorpheusAIs/Morpheus-Lumerin-Node' && (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/test' || github.ref == 'refs/heads/dev')) }}
runs-on: ubuntu-latest
steps:
- name: Clone
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get install -y jq
- name: Generate Tag Name
uses: ./.github/actions/gen_tag_name

- name: Determine GitLab Target Branch
id: set_target_branch
run: |
if [ "${{ github.ref_name }}" == "dev" ]; then
echo "gitlab_branch=dev" >> $GITHUB_ENV
elif [ "${{ github.ref_name }}" == "test" ]; then
echo "gitlab_branch=stg" >> $GITHUB_ENV
elif [ "${{ github.ref_name }}" == "main" ]; then
echo "gitlab_branch=main" >> $GITHUB_ENV
else
echo "This branch is not configured to trigger GitLab pipelines."
exit 1
fi
- name: Trigger GitLab Pipeline
run: |
echo "Triggering GitLab Build and Deploy for branch ${{ github.ref_name }} with tag ${{ env.TAG_NAME }}"
# Send request to GitLab
response=$(curl --silent \
--request POST \
--url "${{ secrets.GITLAB_TRIGGER_URL }}" \
--form "token=${{ secrets.GITLAB_TRIGGER_TOKEN }}" \
--form "ref=${{ env.gitlab_branch }}" \
--form "variables[SOURCE_REPO]=${{ github.repository }}" \
--form "variables[SOURCE_BRANCH]=${{ github.ref_name }}" \
--form "variables[GITHUB_TAG]=${{ env.TAG_NAME }}")

# Parse JSON response using jq
gitlab_status=$(echo "$response" | jq -r '.status // "unknown"')
gitlab_web_url=$(echo "$response" | jq -r '.web_url // "N/A"')

# Log the response
echo "GitLab Response: $response"

# Validate the status field
if [[ "$gitlab_status" =~ ^(created|preparing|success|running|scheduled)$ ]]; then
echo "GitLab pipeline triggered successfully! Status: $gitlab_status"
echo "Pipeline details: $gitlab_web_url"
else
echo "GitLab pipeline FAILED. Invalid status: $gitlab_status"
echo "Pipeline details: $gitlab_web_url"
exit 1
fi

Ubuntu-22-x64:
if: ${{ github.repository != 'MorpheusAIs/Morpheus-Lumerin-Node' }}
runs-on: ubuntu-22.04
steps:
- name: Clone
uses: actions/checkout@v4
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Setup Go
uses: actions/setup-go@v5
Expand Down Expand Up @@ -72,20 +142,24 @@ jobs:
cd ../cli
make build
cd ../ui-desktop
echo "Injecting version ${VFULL} into package.json"
sed -i "s/\"version\": \".*\"/\"version\": \"${VFULL}\"/" package.json
cat package.json | grep '"version"' # Optional: Verify the change
yarn build:linux
- name: Pack artifacts
id: pack_artifacts
run: |
ARTIFACT="mor-launch-$TAG_NAME-ubuntu-x64.zip"
echo "Artifact: $ARTIFACT"
LLAMACPP=llama-b3256-bin-ubuntu-x64.zip
MODEL=tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf
wget -nv https://github.com/ggerganov/llama.cpp/releases/download/b3256/$LLAMACPP
wget -nv https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/$MODEL
unzip -o -j $LLAMACPP build/bin/llama-server
echo '{"run":["./llama-server -m ./'$MODEL'","./proxy-router","./ui-desktop-1.0.0-x64-linux.AppImage"]}' > mor-launch.json
echo '{"run":["./llama-server -m ./'$MODEL'","./proxy-router","./morpheus-ui-${VFULL}-x86_64-linux.AppImage"]}' > mor-launch.json
mv ./cli/mor-cli mor-cli
zip -j $ARTIFACT ./LICENSE ./launcher/mor-launch llama-server ./proxy-router/bin/proxy-router .env $MODEL mor-launch.json ./ui-desktop/dist/ui-desktop-1.0.0-x64-linux.AppImage models-config.json mor-cli
zip -j $ARTIFACT ./LICENSE ./launcher/mor-launch llama-server ./proxy-router/bin/proxy-router .env $MODEL mor-launch.json ./ui-desktop/dist/morpheus-ui-${VFULL}-x86_64-linux.AppImage models-config.json rating-config.json mor-cli
- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand All @@ -94,11 +168,15 @@ jobs:
name: mor-launch-ubuntu-x64.zip

macOS-13-x64:
if: ${{ github.repository != 'MorpheusAIs/Morpheus-Lumerin-Node' }}
runs-on: macos-13
steps:
- name: Clone
uses: actions/checkout@v4
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Setup Go
uses: actions/setup-go@v5
Expand Down Expand Up @@ -141,21 +219,25 @@ jobs:
cd ../cli
make build
cd ../ui-desktop
echo "Injecting version ${VFULL} into package.json"
sed -i "" "s/\"version\": \".*\"/\"version\": \"${VFULL}\"/" package.json
cat package.json | grep '"version"' # Optional: Verify the change
yarn build:mac
- name: Pack artifacts
id: pack_artifacts
run: |
ARTIFACT="mor-launch-$TAG_NAME-macos-x64.zip"
echo "Artifact: $ARTIFACT"
LLAMACPP=llama-b3256-bin-macos-x64.zip
MODEL=tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf
wget -nv https://github.com/ggerganov/llama.cpp/releases/download/b3256/$LLAMACPP
wget -nv https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/$MODEL
unzip -o -j $LLAMACPP build/bin/llama-server
echo '{"run":["./llama-server -m ./'$MODEL'","./proxy-router","./MorpheusUI.app/Contents/MacOS/MorpheusUI"]}' > mor-launch.json
mv ./cli/mor-cli mor-cli
unzip ./ui-desktop/dist/morpheus-ui-1.0.0-x64-mac.zip
zip -j $ARTIFACT ./LICENSE ./launcher/mor-launch ./proxy-router/bin/proxy-router .env llama-server $MODEL mor-launch.json models-config.json mor-cli
unzip ./ui-desktop/dist/morpheus-ui-${VFULL}-x64-mac.zip
zip -j $ARTIFACT ./LICENSE ./launcher/mor-launch ./proxy-router/bin/proxy-router .env llama-server $MODEL mor-launch.json models-config.json rating-config.json mor-cli
zip -r $ARTIFACT 'MorpheusUI.app'
- name: Upload artifacts
Expand All @@ -165,11 +247,15 @@ jobs:
name: mor-launch-macos-x64.zip

macOS-14-arm64:
if: ${{ github.repository != 'MorpheusAIs/Morpheus-Lumerin-Node' }}
runs-on: macos-14
steps:
- name: Clone
uses: actions/checkout@v4
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Setup Go
uses: actions/setup-go@v5
Expand Down Expand Up @@ -212,21 +298,25 @@ jobs:
cd ../cli
make build
cd ../ui-desktop
echo "Injecting version ${VFULL}} into package.json"
sed -i "" "s/\"version\": \".*\"/\"version\": \"${VFULL}\"/" package.json
cat package.json | grep '"version"' # Optional: Verify the change
yarn build:mac
- name: Pack artifacts
id: pack_artifacts
run: |
ARTIFACT="mor-launch-$TAG_NAME-macos-arm64.zip"
echo "Artifact: $ARTIFACT"
LLAMACPP=llama-b3256-bin-macos-arm64.zip
MODEL=tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf
wget -nv https://github.com/ggerganov/llama.cpp/releases/download/b3256/$LLAMACPP
wget -nv https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/$MODEL
unzip -o -j $LLAMACPP build/bin/llama-server
echo '{"run":["./llama-server -m ./'$MODEL'","./proxy-router","./MorpheusUI.app/Contents/MacOS/MorpheusUI"]}' > mor-launch.json
mv ./cli/mor-cli mor-cli
unzip ./ui-desktop/dist/morpheus-ui-1.0.0-arm64-mac.zip
zip -j $ARTIFACT ./LICENSE ./launcher/mor-launch ./proxy-router/bin/proxy-router .env llama-server $MODEL mor-launch.json models-config.json mor-cli
unzip ./ui-desktop/dist/morpheus-ui-${VFULL}-arm64-mac.zip
zip -j $ARTIFACT ./LICENSE ./launcher/mor-launch ./proxy-router/bin/proxy-router .env llama-server $MODEL mor-launch.json models-config.json rating-config.json mor-cli
zip -r $ARTIFACT 'MorpheusUI.app'
- name: Upload artifacts
Expand All @@ -236,11 +326,15 @@ jobs:
name: mor-launch-macos-arm64.zip

Windows-avx2-x64:
if: ${{ github.repository != 'MorpheusAIs/Morpheus-Lumerin-Node' }}
runs-on: windows-latest
steps:
- name: Clone
uses: actions/checkout@v4
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Setup Go
uses: actions/setup-go@v5
Expand Down Expand Up @@ -287,25 +381,29 @@ jobs:
cd ../cli
make build
cd ../ui-desktop
echo "Injecting version ${VFULL} into package.json"
sed -i "s/\"version\": \".*\"/\"version\": \"${VFULL}\"/" package.json
cat package.json | grep '"version"' # Optional: Verify the change
yarn build:win
- name: Pack artifacts
id: pack_artifacts
run: |
ARTIFACT="mor-launch-$TAG_NAME-win-x64.zip"
echo "Artifact: $ARTIFACT"
LLAMACPP=llama-b3256-bin-win-avx2-x64.zip
MODEL=tinyllama-1.1b-chat-v1.0.Q4_K_M.gguf
wget -nv https://github.com/ggerganov/llama.cpp/releases/download/b3256/$LLAMACPP
wget -nv https://huggingface.co/TheBloke/TinyLlama-1.1B-Chat-v1.0-GGUF/resolve/main/$MODEL
unzip -o -j $LLAMACPP llama-server.exe llama.dll ggml.dll
echo '{"run":["./llama-server.exe -m ./'$MODEL'","./proxy-router.exe","./morpheus-ui-1.0.0-x64-win.exe"]}' > mor-launch.json
echo '{"run":["./llama-server.exe -m ./'$MODEL'","./proxy-router.exe","./morpheus-ui-${VFULL}-x64-win.exe"]}' > mor-launch.json
mv .env .env.tmp
sed 's|\./data/|.\\data\\|g' .env.tmp > .env
mv ./proxy-router/bin/proxy-router proxy-router.exe
mv ./cli/mor-cli mor-cli.exe
mv ./launcher/mor-launch mor-launch.exe
mv "./ui-desktop/dist/morpheus-ui-1.0.0-x64-win" morpheus-ui-1.0.0-x64-win.exe
7z a $ARTIFACT LICENSE mor-launch.exe proxy-router.exe .env llama-server.exe llama.dll ggml.dll $MODEL mor-launch.json morpheus-ui-1.0.0-x64-win.exe models-config.json mor-cli.exe
mv "./ui-desktop/dist/morpheus-ui-${VFULL}-x64-win" morpheus-ui-${VFULL}-x64-win.exe
7z a $ARTIFACT LICENSE mor-launch.exe proxy-router.exe .env llama-server.exe llama.dll ggml.dll $MODEL mor-launch.json morpheus-ui-${VFULL}-x64-win.exe models-config.json rating-config.json mor-cli.exe
- name: Upload artifacts
uses: actions/upload-artifact@v4
Expand All @@ -314,7 +412,7 @@ jobs:
name: mor-launch-win-x64.zip

release:
if: ${{ (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/stg')) || github.event.inputs.create_release == 'true' }}
if: ${{ github.repository != 'MorpheusAIs/Morpheus-Lumerin-Node' && (github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/test' )) || github.event.inputs.create_release == 'true' }}
runs-on: ubuntu-latest
needs:
- Ubuntu-22-x64
Expand All @@ -325,6 +423,9 @@ jobs:
- name: Clone
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Generate Tag Name
uses: ./.github/actions/gen_tag_name
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/models-config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"0x0000000000000000000000000000000000000000000000000000000000000000": {
"$schema": "https://raw.githubusercontent.com/Lumerin-protocol/Morpheus-Lumerin-Node/a719073670adb17de6282b12d1852d39d629cb6e/proxy-router/internal/config/models-config-schema.json",
"models": [
{
"modelId": "0x0000000000000000000000000000000000000000000000000000000000000000",
"modelName": "llama2",
"apiType": "openai",
"apiUrl": "http://localhost:8080/v1"
}
}
]
}
30 changes: 26 additions & 4 deletions .github/workflows/proxy-router.main.env
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
# This file is used to set the environment variables for the cicd workflow
# To Generate the STG or TestNet release
# Contract and Token current as of 11/15/2024 (and are using the same values as the testnet)
# ...when mainnet release is imminent, update the values
# Contract and Token current as of 11/15/2024
# Full ENV details can be found in /docs/proxy-router.full.env
# Includes both TestNet and MainNet values, uncomment sections as desired

# Wallet_Private_Key is not needed if you will be running the MorpheusUI in conjunction with proxy-router
WALLET_PRIVATE_KEY=

# MAINNET VALUES (only MAINNET or TESTNET section should be uncommented)
DIAMOND_CONTRACT_ADDRESS=0xDE819AaEE474626E3f34Ef0263373357e5a6C71b
MOR_TOKEN_ADDRESS=0x092bAaDB7DEf4C3981454dD9c0A0D7FF07bCFc86
EXPLORER_API_URL="https://api.arbiscan.io/api"
ETH_NODE_CHAIN_ID=42161

# TESTNET VALUES
# DIAMOND_CONTRACT_ADDRESS=0xb8C55cD613af947E73E262F0d3C54b7211Af16CF
# MOR_TOKEN_ADDRESS=0x34a285a1b1c166420df5b6630132542923b5b27e
# EXPLORER_API_URL="https://api-sepolia.arbiscan.io/api"
# ETH_NODE_CHAIN_ID=421614

# COMMON
PROXY_ADDRESS=0.0.0.0:3333
WEB_ADDRESS=0.0.0.0:8082
WEB_PUBLIC_URL=http://localhost:8082
MODELS_CONFIG_PATH=
ETH_NODE_USE_SUBSCRIPTIONS=false
ETH_NODE_ADDRESS=
ETH_NODE_LEGACY_TX=false
PROXY_STORE_CHAT_CONTEXT=true
# PROXY_STORAGE_PATH=.\data\ (for windows)
PROXY_STORAGE_PATH=./data/
LOG_COLOR=true
LOG_COLOR=true

# Set to true to reset mac keychain on start (MorpheusUI only on Mac)
APP_RESET_KEYCHAIN=false
Loading

0 comments on commit 441f249

Please sign in to comment.