Source Build

Before starting, it is recommended to read YAO Architecture Analysis, understand the source code structure of YAO.

Development environment

YAO is developed in golang, and a development environment can be established in a Mac or Linux environment.

ToolsVersionsInstructions
Golang1.18+Golang
MySQL8.0+optional

Golang

It is recommended to use Docker to install the service

MySQL Docker image

Download

YAO related code repository

WarehouseInstructions
https://github.com/yaoapp/yaoYao
https://github.com/yaoapp/gouEngine Framework
https://github.com/yaoapp/xunORM
https://github.com/yaoapp/kunCommon data processing packages
https://github.com/yaoapp/v8goV8 JavaScript engine

Download the source code to the project directory

mkdir /your-project/root
git clone https://github.com/yaoapp/yao
git clone https://github.com/yaoapp/gou
git clone https://github.com/yaoapp/xun
git clone https://github.com/yaoapp/kun
git clone https://github.com/yaoapp/v8go

Environment variables

Set environment variables for source code debugging

variabledescriptionexample
YAO_DEVSource path/your-project/root/yao
YAO_ENVHow to start the test application development | productiondevelopment
YAO_ROOTTest application directory/your-project/root/yao/tests
YAO_HOSTListening host0.0.0.0
YAO_PORTListening port5099
YAO_LOGTest application log file/your-project/root/yao/tests/logs
YAO_JWT_SECRETJWT secretqo-2U+hoTRU
YAO_DB_AESKEYDatabase AES KEYLX=T&f6refe
export YAO_DEV="/your-project/root/yao"
export YAO_ENV="development"
export YAO_ROOT="/your-project/root/yao/tests"
export YAO_HOST="0.0.0.0"
export YAO_PORT="5099"
export YAO_LOG="/your-project/root/yao/tests/logs"
export YAO_JWT_SECRET="qo-2U+hoTRU"
# Enable MySQL database
export YAO_DB_DRIVER=mysql
export YAO_DB_PRIMARY="root:db-password@tcp(db-server:3308)/xiang?charset=utf8mb4&parseTime=True&loc=Local"
export YAO_DB_AESKEY="LX=T&f6refe"

unit test

Go to the Yao project directory to run unit tests

cd /your-project/root/yao
make test

Debugging

Debugging with Go commands

cd /your-project/root/yao
go run .
go run . run xiang.sys.ping
go run . start

Compile

For the first compilation, you need to install related tools

cd /your-project/root/yao
make tools

During the compilation process, the code will be pulled from the https://github.com/YaoApp/xgen.git repository and built Need to install nodejs 16+ in advance

###MacOS

cd /your-project/root/yao
make release

Artifact is dist/release/yao

Linux

cd /your-project/root/yao
make linux-release

Artifact is dist/release/yao

Does not integrate XGen

Does not integrate XGen interface engine

make debug

Artifact is dist/release/yao-debug

Workflows

https://github.com/YaoApp/yao/blob/main/.github/workflows/release-linux.yml https://github.com/YaoApp/yao/blob/main/.github/workflows/release-macos.yml

Source Build

Before starting, it is recommended to read YAO Architecture Analysis, understand the source code structure of YAO.

Development environment

YAO is developed in golang, and a development environment can be established in a Mac or Linux environment.

ToolsVersionsInstructions
Golang1.18+Golang
MySQL8.0+optional

Golang

It is recommended to use Docker to install the service

MySQL Docker image

Download

YAO related code repository

WarehouseInstructions
https://github.com/yaoapp/yaoYao
https://github.com/yaoapp/gouEngine Framework
https://github.com/yaoapp/xunORM
https://github.com/yaoapp/kunCommon data processing packages
https://github.com/yaoapp/v8goV8 JavaScript engine

Download the source code to the project directory

mkdir /your-project/root
git clone https://github.com/yaoapp/yao
git clone https://github.com/yaoapp/gou
git clone https://github.com/yaoapp/xun
git clone https://github.com/yaoapp/kun
git clone https://github.com/yaoapp/v8go

Environment variables

Set environment variables for source code debugging

variabledescriptionexample
YAO_DEVSource path/your-project/root/yao
YAO_ENVHow to start the test application development | productiondevelopment
YAO_ROOTTest application directory/your-project/root/yao/tests
YAO_HOSTListening host0.0.0.0
YAO_PORTListening port5099
YAO_LOGTest application log file/your-project/root/yao/tests/logs
YAO_JWT_SECRETJWT secretqo-2U+hoTRU
YAO_DB_AESKEYDatabase AES KEYLX=T&f6refe
export YAO_DEV="/your-project/root/yao"
export YAO_ENV="development"
export YAO_ROOT="/your-project/root/yao/tests"
export YAO_HOST="0.0.0.0"
export YAO_PORT="5099"
export YAO_LOG="/your-project/root/yao/tests/logs"
export YAO_JWT_SECRET="qo-2U+hoTRU"
# Enable MySQL database
export YAO_DB_DRIVER=mysql
export YAO_DB_PRIMARY="root:db-password@tcp(db-server:3308)/xiang?charset=utf8mb4&parseTime=True&loc=Local"
export YAO_DB_AESKEY="LX=T&f6refe"

unit test

Go to the Yao project directory to run unit tests

cd /your-project/root/yao
make test

Debugging

Debugging with Go commands

cd /your-project/root/yao
go run .
go run . run xiang.sys.ping
go run . start

Compile

For the first compilation, you need to install related tools

cd /your-project/root/yao
make tools

During the compilation process, the code will be pulled from the https://github.com/YaoApp/xgen.git repository and built Need to install nodejs 16+ in advance

###MacOS

cd /your-project/root/yao
make release

Artifact is dist/release/yao

Linux

cd /your-project/root/yao
make linux-release

Artifact is dist/release/yao

Does not integrate XGen

Does not integrate XGen interface engine

make debug

Artifact is dist/release/yao-debug

Workflows

https://github.com/YaoApp/yao/blob/main/.github/workflows/release-linux.yml https://github.com/YaoApp/yao/blob/main/.github/workflows/release-macos.yml