Skip to content

Merge pull request #674 from multiversx/fix-parse-esdt-token-identifi… #659

Merge pull request #674 from multiversx/fix-parse-esdt-token-identifi…

Merge pull request #674 from multiversx/fix-parse-esdt-token-identifi… #659

Workflow file for this run

name: MultiversX Integration Tests
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
jobs:
integration_tests:
runs-on: ubuntu-latest
steps:
# Install system dependencies
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libusb-1.0-0-dev libudev-dev pkg-config
# Step 1: Checkout the repository
- name: Checkout code
uses: actions/checkout@v3
# Step 2: Set up Python environment
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
# Step 3: Install pipx (to manage Python tools)
- name: Install pipx
run: |
python3 -m pip install --user pipx
python3 -m pipx ensurepath
# Add the pipx binary location to PATH
echo "$HOME/.local/bin" >> $GITHUB_PATH
shell: bash
# Step 4: Install mxpy (MultiversX Python SDK)
- name: Install mxpy (MultiversX SDK)
run: |
pipx install multiversx-sdk-cli --force
# Step 5: Set up MultiversX localnet using mxpy
- name: Set up MultiversX localnet
run: |
# Start the local testnet with mxpy
mkdir -p ~/localnet && cd ~/localnet
mxpy localnet setup --configfile=${GITHUB_WORKSPACE}/localnet.toml
echo "Localnet setup completed."
echo "Starting localnet..."
nohup mxpy localnet start --configfile=${GITHUB_WORKSPACE}/localnet.toml > localnet.log 2>&1 & echo $! > localnet.pid
echo "Localnet started, waiting for it to be fully operational..."
# Allow time for the testnet to fully start
timeout=300
elapsed=0
while ! curl -s http://127.0.0.1:7950/network/config > /dev/null; do
if [ $elapsed -ge $timeout ]; then
echo "Timeout waiting for localnet to start"
cat ~/localnet/localnet.log
exit 1
fi
echo "Waiting for localnet... ($elapsed/$timeout seconds)"
sleep 10
elapsed=$((elapsed + 10))
done
echo "Localnet is ready!"
# Step 6: Install Node.js and dependencies
- name: Set up Node.js environment
uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: Install Node.js dependencies
run: npm install
# Step 7: Run integration tests
- name: Run integration tests
run: |
npm run tests-localnet
# Step 8: Stop the testnet using the stored PID
- name: Stop MultiversX local testnet
if: success() || failure()
run: |
kill $(cat localnet.pid) || echo "Testnet already stopped"