Skip to content

feat: support token validation for buckal cli #902

feat: support token validation for buckal cli

feat: support token validation for buckal cli #902

Workflow file for this run

name: Test with Services
on:
workflow_dispatch:
pull_request:
paths-ignore:
- 'config/**'
- 'docker/**'
- 'docs/**'
- 'moon/**'
- 'rust/**'
- 'scripts/**'
- 'toolchains/**'
- 'extensions/**'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
# Label of the runner job
runner-job:
# You must use a Linux environment when using service containers or container jobs
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
# Set the base directory for the mono binary
MEGA_BASE_DIR: ${{ github.workspace }}/testing
# Service containers to run with `runner-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_USER: mono
POSTGRES_PASSWORD: mono
POSTGRES_DB: mono
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
# Downloads a copy of the code in your repository before running CI tests
- name: Checkout out mega repository
uses: actions/checkout@v4
with:
submodules: recursive
# Install system dependencies
- name: Install system dependencies
uses: ./.github/install-dep
with:
cache-key: sysdeps
platform: ubuntu
# Set up the environment for git and git-lfs
- name: Set up git lfs
run: |
echo "GPG_TTY=$(tty)" >> $GITHUB_ENV
git lfs install
git config --global user.email "[email protected]"
git config --global user.name "Mono Web3Infra"
git config --global lfs.url http://localhost:8000
# Build the mono and libra binaries
- name: Build mono
run: |
cargo build --bin mono
echo "The mono volumn located at: ${{ github.workspace }}/testing"
mkdir -p ${{ github.workspace }}/testing
mkdir -p ${{ github.workspace }}/testing/etc
mkdir -p ${{ github.workspace }}/testing/cache
mkdir -p ${{ github.workspace }}/testing/lfs
mkdir -p ${{ github.workspace }}/testing/logs
mkdir -p ${{ github.workspace }}/testing/objects
mkdir -p ${{ github.workspace }}/testing/etc/ssh
mkdir -p ${{ github.workspace }}/testing/etc/https
ssh-keygen -t rsa -b 4096 -f "${{ github.workspace }}/testing/etc/ssh/ssh_host_rsa_key" -N "" -C "sshd host key" >/dev/null 2>&1
cp ${{ github.workspace }}/config/config-workflow.toml ${{ github.workspace }}/testing/etc/config.toml
echo "Directory structure has been successfully created:"
echo "${{ github.workspace }}/testing"
echo "├── etc"
echo "│ ├── ssh"
echo "│ │ ├── ssh_host_rsa_key"
echo "│ │ └── ssh_host_rsa_key.pub"
echo "│ ├── https"
echo "│ └── config.toml"
echo "├── cache"
echo "├── lfs"
echo "├── logs"
echo "├── objects"
- name: Start Mono services
run: |
export MEGA_BASE_DIR="${{ github.workspace }}/testing"
nohup ${{ github.workspace }}/target/debug/mono -c ${{ github.workspace }}/testing/etc/config.toml service multi http ssh --host 0.0.0.0 --port 8000 --ssh-port 9000 >/dev/null 2>&1 &
echo "mono has been successfully built and started in the background"
sleep 30
- name: Testing cases with mono service
run: |
echo "TODO: Desigin testing cases with mono service"
- name: Testing Mono Test Cases
run: |
cargo test --manifest-path mono/Cargo.toml --all-features --no-fail-fast -- --nocapture