Skip to content

updated test script and github ci yml file to run the automated tests #17

updated test script and github ci yml file to run the automated tests

updated test script and github ci yml file to run the automated tests #17

Workflow file for this run

name: Quickstart Tests
on:
push:
branches:
- feat/updating_test_script
pull_request:
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
env:
RPC_URL: ${{ secrets.RPC_URL }}
BACKUP_WALLET: ${{ secrets.BACKUP_WALLET }}
TEST_PASSWORD: ${{ secrets.TEST_PASSWORD }}
PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }}
STAKING_CHOICE: ${{ secrets.STAKING_CHOICE }}
DOCKER_LOGS_DIR: ${GITHUB_WORKSPACE}/logs
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Set up Docker
run: |
# Stop and remove existing Docker installations
sudo systemctl stop docker || true
sudo systemctl stop docker.socket || true
# Clean existing installations
sudo apt-get remove -y docker docker-engine docker.io containerd runc
sudo apt-get update
# Install prerequisites
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg \
lsb-release
# Add Docker's GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
# Add Docker repository
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Install Docker
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
# Get current user info
CURRENT_USER=$(id -u)
CURRENT_GROUP=$(id -g)
# Start Docker service
sudo systemctl start docker
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y git
- name: Clean Python cache
run: |
sudo rm -rf ~/.cache/pip
sudo rm -rf ~/.cache/poetry
sudo rm -rf .pytest_cache
sudo rm -rf .venv
sudo rm -rf poetry.lock
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Configure Poetry
run: |
poetry config virtualenvs.create true
poetry config virtualenvs.in-project true
- name: Create .env file
run: |
echo "RPC_URL=${RPC_URL}" > .env
echo "BACKUP_WALLET=${BACKUP_WALLET}" >> .env
echo "TEST_PASSWORD=${TEST_PASSWORD}" >> .env
echo "PRIVATE_KEY=${PRIVATE_KEY}" >> .env
echo "STAKING_CHOICE=${STAKING_CHOICE}" >> .env
echo "DOCKER_LOGS_DIR=${DOCKER_LOGS_DIR}" >> .env
- name: Install project dependencies
run: |
python -m pip install --upgrade pip
poetry env use python3.10
poetry install --no-interaction
- name: Run tests
run: |
# Run the tests with debug logging
poetry run pytest -v tests/test_run_service.py -s --log-cli-level=DEBUG
- name: Debug container failure
if: failure()
run: |
echo "==== Docker container status ===="
docker ps -a
echo "==== Container logs ===="
for container in $(docker ps -aq); do
echo "=== Logs for $container ==="
docker logs $container
echo "=== Inspect for $container ==="
docker inspect $container
done
echo "==== Directory permissions ===="
ls -la /logs/
ls -la ${GITHUB_WORKSPACE}/logs/
- name: Upload test logs
if: always()
uses: actions/upload-artifact@v3
with:
name: test-logs
path: |
logs/
/logs/
.env